#!/usr/bin/env bash # deploy.sh - Deploy Authelia Portal Theme, 3D Shield Logo & Favicon # Hosts: free-warez.win & free-warez.top -> /opt/containers/authelia/ set -euo pipefail HOSTS=("free-warez.win" "free-warez.top") TARGET_ASSET_DIR="/opt/containers/authelia/config/assets" LOCAL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "🚀 Deploying Authelia Portal Theme & Assets" echo "===============================================" for HOST in "${HOSTS[@]}"; do echo "📡 Connecting to $HOST..." if ssh -q -o BatchMode=yes -o ConnectTimeout=5 "$HOST" exit; then echo "📁 Ensuring asset directory exists on $HOST..." ssh "$HOST" "mkdir -p $TARGET_ASSET_DIR" echo "🔄 Syncing 3D Cyber Shield Logo & Favicon to $HOST:$TARGET_ASSET_DIR..." rsync -avz "$LOCAL_DIR/custom/logo.png" "$HOST:$TARGET_ASSET_DIR/logo.png" rsync -avz "$LOCAL_DIR/custom/favicon.ico" "$HOST:$TARGET_ASSET_DIR/favicon.ico" rsync -avz "$LOCAL_DIR/custom/cyber_bg.jpg" "$HOST:$TARGET_ASSET_DIR/cyber_bg.jpg" echo "⚙️ Ensuring theme: dark and server.asset_path are active on $HOST..." ssh "$HOST" "python3 -c ' path = \"/opt/containers/authelia/config/configuration.yml\" with open(path) as f: content = f.read() lines = content.splitlines(True) new_lines = [] has_theme = False has_asset_path = False for line in lines: if line.startswith(\"theme:\"): new_lines.append(\"theme: dark\n\") has_theme = True elif \"asset_path:\" in line: new_lines.append(\" asset_path: /config/assets/\n\") has_asset_path = True elif line.startswith(\"server:\"): new_lines.append(line) if not has_asset_path: new_lines.append(\" asset_path: /config/assets/\n\") has_asset_path = True else: new_lines.append(line) if not has_theme: new_lines.insert(4, \"theme: dark\n\") with open(path, \"w\") as f: f.writelines(new_lines) '" echo "🔄 Restarting Authelia container on $HOST..." ssh "$HOST" "docker restart authelia" echo "✅ $HOST updated!" else echo "⚠️ Could not connect to $HOST, skipping." fi done echo "✨ Authelia Deployment finished!"