diff --git a/scripts/fix-navbar.sh b/scripts/fix-navbar.sh new file mode 100755 index 00000000..ef98733c --- /dev/null +++ b/scripts/fix-navbar.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# ═══════════════════════════════════════════════════════════════ +# SecuBox Navbar Integration Script +# Ensures all HTML pages have proper navbar/sidebar integration +# ═══════════════════════════════════════════════════════════════ + +set -e + +WWW_DIR="${1:-/usr/share/secubox/www}" +FIXED=0 +ERRORS=0 + +echo "🔧 SecuBox Navbar Integration Check" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "Scanning: $WWW_DIR" +echo "" + +for html in $(find "$WWW_DIR" -name "index.html" 2>/dev/null); do + module=$(dirname "$html" | xargs basename) + issues="" + + # Check for crt-light.css + if ! grep -q 'crt-light.css' "$html" 2>/dev/null; then + issues+=" ⚠ Missing crt-light.css\n" + # Fix: Add before sidebar-light.css or at end of head + if grep -q 'sidebar-light.css' "$html"; then + sed -i 's||\n |' "$html" + else + sed -i 's|| \n|' "$html" + fi + fi + + # Check for sidebar-light.css + if ! grep -q 'sidebar-light.css' "$html" 2>/dev/null; then + issues+=" ⚠ Missing sidebar-light.css\n" + sed -i 's|| \n|' "$html" + fi + + # Check for sidebar.js + if ! grep -q '/shared/sidebar.js' "$html" 2>/dev/null; then + issues+=" ⚠ Missing /shared/sidebar.js\n" + # Check if it uses wrong path + if grep -q 'sidebar.js' "$html"; then + sed -i 's|src="[^"]*sidebar.js"|src="/shared/sidebar.js"|g' "$html" + else + sed -i 's|| \n|' "$html" + fi + fi + + # Check for body class + if grep -q '' "$html" 2>/dev/null; then + issues+=" ⚠ Missing body class (should be crt-light)\n" + sed -i 's///g' "$html" + fi + + # Check for old dark theme class + if grep -q 'crt-body crt-scanlines' "$html" 2>/dev/null; then + issues+=" ⚠ Old dark theme body class\n" + sed -i 's/class="crt-body crt-scanlines[^"]*"/class="crt-light"/g' "$html" + fi + + # Check for sidebar nav element + if ! grep -q '