#!/bin/bash # Cache-Busting Verification Script # Checks that all components are properly configured for cache invalidation echo "==========================================" echo "Cache-Busting Verification" echo "==========================================" echo "" SUCCESS=0 FAIL=0 # Function to check and report check() { local description="$1" local command="$2" echo -n "Checking: $description... " if eval "$command" > /dev/null 2>&1; then echo "✓ PASS" ((SUCCESS++)) else echo "✗ FAIL" ((FAIL++)) fi } # 1. Check server is listening on port 3010 (most reliable) check "Server listening on port 3010" "netstat -tlnp 2>/dev/null | grep -q 3010 || ss -tlnp 2>/dev/null | grep -q 3010" # 2. Check HTML file exists check "HTML file exists" "test -f /home/uroma/obsidian-web-interface/public/claude-ide/index.html" # 3. Check all script tags have cache-busting check "All script tags have ?v= parameter" "grep -q 'ide.js?v=' /home/uroma/obsidian-web-interface/public/claude-ide/index.html" # 4. Check no old ?t= parameters remain check "No old ?t= parameters remain" "! grep -q '?t=' /home/uroma/obsidian-web-interface/public/claude-ide/index.html" # 5. Check cache-busting meta tags check "Cache-busting meta tags present" "grep -q 'http-equiv=\"Cache-Control\"' /home/uroma/obsidian-web-interface/public/claude-ide/index.html" # 6. Check server.js includes HTML in cache-busting check "Server includes HTML in cache-busting" "grep -q \"filePath.endsWith('.html')\" /home/uroma/obsidian-web-interface/server.js" # 7. Check cache-busting middleware exists check "Cache-busting middleware exists" "test -f /home/uroma/obsidian-web-interface/cache-bust-middleware.js" # 8. Check middleware is imported in server check "Middleware imported in server" "grep -q 'createCacheBustingMiddleware' /home/uroma/obsidian-web-interface/server.js" # 9. Check force-cache-refresh script exists and is executable check "Force cache refresh script exists" "test -x /home/uroma/obsidian-web-interface/force-cache-refresh.sh" # 10. Verify ide.js has the fixed regex (line 494) check "ide.js has regex fix at line 494" "grep -q 'explanationMatch = content.match' /home/uroma/obsidian-web-interface/public/claude-ide/ide.js" echo "" echo "==========================================" echo "Results" echo "==========================================" echo "Passed: $SUCCESS" echo "Failed: $FAIL" echo "" if [ $FAIL -eq 0 ]; then echo "✓ All checks passed! Cache-busting is properly configured." echo "" echo "Next steps:" echo "1. Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)" echo "2. Open DevTools Network tab" echo "3. Verify all assets load with ?v= parameter" echo "4. Check response headers show no-cache directives" exit 0 else echo "✗ Some checks failed. Please review the configuration." exit 1 fi