secubox-openwrt/deploy-modules-with-theme.sh
CyberMind-FR b884b12970 feat: Integrate global CyberMood theme into core modules
Migrated three core modules to use the global secubox-theme package:

Modules Updated:
- luci-app-secubox (dashboard, modules views)
- luci-app-network-modes (overview view)
- luci-app-system-hub (overview, services views)

Changes Per Module:
- Replaced module-specific theme imports with 'require secubox-theme/theme as Theme'
- Updated CSS imports to use global secubox-theme.css bundle
- Initialized global theme with Theme.init({ theme: 'dark', language: 'en' })
- Removed redundant theme.getTheme() calls from load() functions
- Added global theme CSS link tags to view renders

Benefits:
- Unified CyberMood design system across all modules
- Access to 100+ CSS variables (colors, spacing, effects)
- Theme switching support (dark, light, cyberpunk)
- Multi-language support (en, fr, de, es) via Theme.t()
- Reduced CSS duplication
- Consistent UI components (cards, buttons, badges)

Deployment:
- Created deploy-modules-with-theme.sh for batch deployment
- All modules successfully deployed to router 192.168.8.191
- Verified HTTP access to updated JavaScript files

Testing:
-  SecuBox dashboard loads with global theme
-  Network-modes overview uses theme CSS
-  System-hub views integrate theme properly
-  All 27 view files deployed successfully

Next Steps:
- Modules can now use Theme.createCard(), createButton(), createBadge()
- Translation keys available for internationalization
- Theme variants switchable via Theme.apply('dark'|'light'|'cyberpunk')

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 17:16:37 +01:00

110 lines
5.4 KiB
Bash
Executable File

#!/bin/bash
# Deploy luci-app-secubox, network-modes, and system-hub with global theme support
# Usage: ./deploy-modules-with-theme.sh [router_host]
set -e
ROUTER_HOST="${1:-root@192.168.8.191}"
MODULES="luci-app-secubox luci-app-network-modes luci-app-system-hub"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Deploying SecuBox modules with global theme to $ROUTER_HOST"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Modules: secubox, network-modes, system-hub"
echo "Theme: Global CyberMood (secubox-theme)"
echo ""
for MODULE in $MODULES; do
MODULE_NAME=$(basename "$MODULE" | sed 's/luci-app-//')
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📦 Deploying $MODULE_NAME"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Create backup on router
echo "📦 Creating backup..."
ssh "$ROUTER_HOST" "if [ -d '/www/luci-static/resources/$MODULE_NAME' ]; then \
cp -r '/www/luci-static/resources/$MODULE_NAME' '/www/luci-static/resources/$MODULE_NAME.bak.$(date +%Y%m%d_%H%M%S)'; \
echo '✓ Backup created'; \
else \
echo '✓ No existing module to backup'; \
fi"
# Create tarball
echo "📦 Creating tarball..."
TARBALL="/tmp/${MODULE_NAME}-$(date +%Y%m%d_%H%M%S).tar.gz"
(cd "$MODULE/htdocs/luci-static/resources" && tar czf "$TARBALL" "$MODULE_NAME" "view/$MODULE_NAME")
# Upload
echo "🚀 Uploading to router..."
scp "$TARBALL" "$ROUTER_HOST:/tmp/${MODULE_NAME}.tar.gz"
# Extract
echo "📂 Extracting..."
ssh "$ROUTER_HOST" "cd /www/luci-static/resources && tar xzf /tmp/${MODULE_NAME}.tar.gz && rm /tmp/${MODULE_NAME}.tar.gz"
# Set permissions
echo "🔐 Setting permissions..."
ssh "$ROUTER_HOST" "find /www/luci-static/resources/$MODULE_NAME -type f -name '*.css' -exec chmod 644 {} \; && \
find /www/luci-static/resources/$MODULE_NAME -type f -name '*.js' -exec chmod 644 {} \; && \
find /www/luci-static/resources/$MODULE_NAME -type d -exec chmod 755 {} \; && \
find /www/luci-static/resources/view/$MODULE_NAME -type f -name '*.js' -exec chmod 644 {} \; && \
find /www/luci-static/resources/view/$MODULE_NAME -type d -exec chmod 755 {} \;"
# Cleanup
rm -f "$TARBALL"
echo "$MODULE_NAME deployed"
echo ""
done
# Clear LuCI cache
echo "🧹 Clearing LuCI cache..."
ssh "$ROUTER_HOST" "rm -rf /tmp/luci-*"
# Restart services
echo "🔄 Restarting services..."
ssh "$ROUTER_HOST" "/etc/init.d/uhttpd restart"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Verification"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
for MODULE in $MODULES; do
MODULE_NAME=$(basename "$MODULE" | sed 's/luci-app-//')
echo "📦 $MODULE_NAME:"
ssh "$ROUTER_HOST" "if [ -d '/www/luci-static/resources/$MODULE_NAME' ]; then \
echo ' ✅ Module files: OK'; \
echo ' ✅ Views: \$(find /www/luci-static/resources/view/$MODULE_NAME -name \"*.js\" | wc -l) files'; \
else \
echo ' ❌ Module deployment failed'; \
fi"
done
echo ""
echo "Theme status:"
ssh "$ROUTER_HOST" "if [ -f '/www/luci-static/resources/secubox-theme/theme.js' ]; then \
echo ' ✅ Global theme: Available'; \
else \
echo ' ⚠️ Global theme: Not found (run ./deploy-theme.sh first)'; \
fi"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Deployment complete!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "📋 Updated modules now use:"
echo " - 'require secubox-theme/theme as Theme'"
echo " - Global CyberMood CSS variables"
echo " - Dark/Light/Cyberpunk theme variants"
echo " - Multi-language support (en, fr, de, es)"
echo ""
echo "🌐 Access modules:"
echo " - SecuBox: http://$ROUTER_HOST/cgi-bin/luci/admin/secubox"
echo " - Network Modes: http://$ROUTER_HOST/cgi-bin/luci/admin/secubox/network-modes"
echo " - System Hub: http://$ROUTER_HOST/cgi-bin/luci/admin/secubox/system-hub"
echo ""