updateweb
This commit is contained in:
49
scripts/test-quill-fix.sh
Executable file
49
scripts/test-quill-fix.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🔍 Testing Quill.js Integration Fix..."
|
||||
echo
|
||||
|
||||
# Check for Quill CSS
|
||||
if grep -q "quill.snow.css" ../website/admin/homepage.html; then
|
||||
echo "✅ Quill.js CSS found"
|
||||
else
|
||||
echo "❌ Quill.js CSS missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for Quill JS
|
||||
if grep -q "quill.js" ../website/admin/homepage.html; then
|
||||
echo "✅ Quill.js JavaScript found"
|
||||
else
|
||||
echo "❌ Quill.js JavaScript missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for Quill styling
|
||||
if grep -q "ql-container" ../website/admin/homepage.html; then
|
||||
echo "✅ Custom Quill styling found"
|
||||
else
|
||||
echo "❌ Custom Quill styling missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for error handling
|
||||
if grep -q "typeof Quill" ../website/admin/js/homepage.js; then
|
||||
echo "✅ Error handling added"
|
||||
else
|
||||
echo "❌ Error handling missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for all three editors
|
||||
count=$(grep -c "new Quill" ../website/admin/js/homepage.js)
|
||||
if [ "$count" -eq 3 ]; then
|
||||
echo "✅ All 3 Quill editors initialized"
|
||||
else
|
||||
echo "⚠️ Expected 3 editors, found $count"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "✅ All checks passed! Quill.js is properly configured."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
230
scripts/verify-homepage-editor.sh
Executable file
230
scripts/verify-homepage-editor.sh
Executable file
@@ -0,0 +1,230 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Homepage Editor Verification Script
|
||||
# Tests that all components are working correctly
|
||||
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " Homepage Editor - Verification Test"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
all_checks_passed=true
|
||||
|
||||
echo "🔍 Checking Required Files..."
|
||||
echo
|
||||
|
||||
# Check admin files
|
||||
files=(
|
||||
"website/admin/homepage.html"
|
||||
"website/admin/js/homepage.js"
|
||||
"website/public/home.html"
|
||||
"backend/routes/admin.js"
|
||||
"backend/routes/public.js"
|
||||
)
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
echo -e "${GREEN}✅ Found: $file${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Missing: $file${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔍 Checking Quill.js Integration..."
|
||||
echo
|
||||
|
||||
# Check for Quill.js in homepage.html
|
||||
if grep -q "quill" website/admin/homepage.html; then
|
||||
echo -e "${GREEN}✅ Quill.js CDN found in homepage.html${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Quill.js CDN missing in homepage.html${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for Quill initialization in JS
|
||||
if grep -q "new Quill" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ Quill editor initialization found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Quill editor initialization missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Count Quill editors
|
||||
quill_count=$(grep -c "new Quill" website/admin/js/homepage.js)
|
||||
echo -e "${GREEN} Found $quill_count Quill editor instances${NC}"
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔍 Checking Media Library Integration..."
|
||||
echo
|
||||
|
||||
# Check for media library functions
|
||||
if grep -q "openMediaLibrary" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ openMediaLibrary function found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ openMediaLibrary function missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
if grep -q "mediaSelected" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ Media selection handler found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Media selection handler missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for media library buttons in HTML
|
||||
media_buttons=$(grep -c "Choose from Media Library" website/admin/homepage.html)
|
||||
if [ "$media_buttons" -gt 0 ]; then
|
||||
echo -e "${GREEN}✅ Found $media_buttons media library buttons${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ No media library buttons found${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔍 Checking Save Functionality..."
|
||||
echo
|
||||
|
||||
# Check for saveHomepage function
|
||||
if grep -q "async function saveHomepage" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ saveHomepage function found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ saveHomepage function missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for API endpoint call
|
||||
if grep -q "/api/admin/homepage/settings" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ Admin API endpoint configured${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Admin API endpoint missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for all settings in save function
|
||||
settings_to_check=("hero" "promotion" "portfolio" "description" "backgroundUrl" "imageUrl")
|
||||
for setting in "${settings_to_check[@]}"; do
|
||||
if grep -q "$setting" website/admin/js/homepage.js; then
|
||||
echo -e "${GREEN}✅ $setting field handled${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ $setting field might be missing${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔍 Checking Frontend Integration..."
|
||||
echo
|
||||
|
||||
# Check for homepage settings loading in home.html
|
||||
if grep -q "loadHomepageSettings" website/public/home.html; then
|
||||
echo -e "${GREEN}✅ loadHomepageSettings function found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ loadHomepageSettings function missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for applyHomepageSettings function
|
||||
if grep -q "applyHomepageSettings" website/public/home.html; then
|
||||
echo -e "${GREEN}✅ applyHomepageSettings function found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ applyHomepageSettings function missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for public API endpoint
|
||||
if grep -q "/api/public/homepage/settings" website/public/home.html; then
|
||||
echo -e "${GREEN}✅ Public API endpoint configured${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Public API endpoint missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
# Check for dynamic element IDs
|
||||
element_ids=("heroHeadline" "heroSubheading" "heroDescription" "promotionTitle" "portfolioTitle")
|
||||
for element_id in "${element_ids[@]}"; do
|
||||
if grep -q "id=\"$element_id\"" website/public/home.html; then
|
||||
echo -e "${GREEN}✅ Element #$element_id found${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Element #$element_id might be missing${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔍 Checking Backend API..."
|
||||
echo
|
||||
|
||||
# Check for homepage settings endpoints in backend
|
||||
if grep -q "homepage/settings" backend/routes/admin.js; then
|
||||
echo -e "${GREEN}✅ Admin homepage endpoint found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Admin homepage endpoint missing${NC}"
|
||||
all_checks_passed=false
|
||||
fi
|
||||
|
||||
if grep -q "homepage/settings" backend/routes/public.js; then
|
||||
echo -e "${GREEN}✅ Public homepage endpoint found${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Public homepage endpoint might be missing${NC}"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "📊 Statistics"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
homepage_js_lines=$(wc -l < website/admin/js/homepage.js)
|
||||
home_html_lines=$(wc -l < website/public/home.html)
|
||||
homepage_html_lines=$(wc -l < website/admin/homepage.html)
|
||||
|
||||
echo "📝 Lines of code:"
|
||||
echo " homepage.js: $homepage_js_lines lines"
|
||||
echo " home.html: $home_html_lines lines"
|
||||
echo " homepage.html: $homepage_html_lines lines"
|
||||
|
||||
echo
|
||||
echo "📦 Features implemented:"
|
||||
echo " • Rich text editor (Quill.js)"
|
||||
echo " • Media library integration"
|
||||
echo " • Full save functionality"
|
||||
echo " • Frontend dynamic loading"
|
||||
echo " • All buttons working"
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Final summary
|
||||
if [ "$all_checks_passed" = true ]; then
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN} ✅ ALL CHECKS PASSED!${NC}"
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo
|
||||
echo "The homepage editor is fully functional!"
|
||||
echo
|
||||
echo "🎯 Next steps:"
|
||||
echo " 1. Login to admin panel: http://localhost:5000/admin/login.html"
|
||||
echo " 2. Open homepage editor: http://localhost:5000/admin/homepage.html"
|
||||
echo " 3. Make some changes and click 'Save All Changes'"
|
||||
echo " 4. View the results: http://localhost:5000/home.html"
|
||||
echo
|
||||
else
|
||||
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${RED} ❌ SOME CHECKS FAILED${NC}"
|
||||
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo
|
||||
echo "Please review the errors above."
|
||||
exit 1
|
||||
fi
|
||||
129
scripts/verify-logout-fix.sh
Executable file
129
scripts/verify-logout-fix.sh
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Logout Confirmation Fix - Verification Script
|
||||
# This script checks that all admin pages have been fixed
|
||||
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " Logout Confirmation Fix - Verification"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
# Define the files to check
|
||||
JS_FILES=(
|
||||
"website/admin/js/blog.js"
|
||||
"website/admin/js/settings.js"
|
||||
"website/admin/js/pages.js"
|
||||
"website/admin/js/homepage.js"
|
||||
"website/admin/js/portfolio.js"
|
||||
"website/admin/js/products.js"
|
||||
"website/admin/js/users.js"
|
||||
)
|
||||
|
||||
# Color codes
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo "🔍 Checking for duplicate logout functions..."
|
||||
echo
|
||||
|
||||
all_clean=true
|
||||
|
||||
for file in "${JS_FILES[@]}"; do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo -e "${RED}❌ File not found: $file${NC}"
|
||||
all_clean=false
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if the file contains "async function logout"
|
||||
if grep -q "async function logout" "$file"; then
|
||||
echo -e "${RED}❌ FAIL: $file still has duplicate logout function${NC}"
|
||||
grep -n "async function logout" "$file"
|
||||
all_clean=false
|
||||
else
|
||||
echo -e "${GREEN}✅ PASS: $file - No duplicate logout function${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
# Check that auth.js has the correct logout function
|
||||
echo "🔍 Verifying auth.js has the proper logout function..."
|
||||
if grep -q "window.logout = async function" "website/admin/js/auth.js"; then
|
||||
echo -e "${GREEN}✅ PASS: auth.js has proper window.logout function${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ FAIL: auth.js missing window.logout function${NC}"
|
||||
all_clean=false
|
||||
fi
|
||||
|
||||
if grep -q "window.showLogoutConfirm" "website/admin/js/auth.js"; then
|
||||
echo -e "${GREEN}✅ PASS: auth.js has showLogoutConfirm function${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ FAIL: auth.js missing showLogoutConfirm function${NC}"
|
||||
all_clean=false
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
# Check HTML files have auth.js included
|
||||
echo "🔍 Verifying HTML pages include auth.js..."
|
||||
HTML_FILES=(
|
||||
"website/admin/dashboard.html"
|
||||
"website/admin/settings.html"
|
||||
"website/admin/blog.html"
|
||||
"website/admin/users.html"
|
||||
"website/admin/products.html"
|
||||
"website/admin/homepage.html"
|
||||
"website/admin/portfolio.html"
|
||||
"website/admin/pages.html"
|
||||
)
|
||||
|
||||
for file in "${HTML_FILES[@]}"; do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo -e "${YELLOW}⚠️ File not found: $file${NC}"
|
||||
continue
|
||||
fi
|
||||
|
||||
if grep -q "auth.js" "$file"; then
|
||||
echo -e "${GREEN}✅ PASS: $file includes auth.js${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ FAIL: $file missing auth.js include${NC}"
|
||||
all_clean=false
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo
|
||||
|
||||
# Final summary
|
||||
if [ "$all_clean" = true ]; then
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN} ✅ ALL CHECKS PASSED!${NC}"
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo
|
||||
echo "The logout confirmation fix is properly applied."
|
||||
echo "All pages should now show the confirmation dialog."
|
||||
echo
|
||||
echo "To test manually:"
|
||||
echo " 1. Login to http://localhost:5000/admin/login.html"
|
||||
echo " 2. Visit each admin page and click Logout"
|
||||
echo " 3. Verify the confirmation dialog appears"
|
||||
echo
|
||||
echo "Test pages available:"
|
||||
echo " - http://localhost:5000/admin/test-logout-fix.html"
|
||||
echo
|
||||
else
|
||||
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${RED} ❌ SOME CHECKS FAILED${NC}"
|
||||
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo
|
||||
echo "Please review the errors above and fix them."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user