#!/usr/bin/env bash set -euo pipefail SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TARGETS=("/opt/modInteractive" "$HOME/modInteractive") sudo systemctl stop modinteractive 2>/dev/null || true pkill mpv 2>/dev/null || true rm -f /tmp/modinteractive-mpv.sock for target in "${TARGETS[@]}"; do if [[ -d "$target" ]]; then mkdir -p "$target/admin/templates" "$target/admin/static" cp "$SRC_DIR/admin/templates/index.html" "$target/admin/templates/index.html" cp "$SRC_DIR/admin/static/app.js" "$target/admin/static/app.js" cp "$SRC_DIR/admin/static/style.css" "$target/admin/static/style.css" cp "$SRC_DIR/admin/server.py" "$target/admin/server.py" echo "patched $target" fi done python3 -m py_compile /opt/modInteractive/admin/server.py echo "OK: modern admin patch applied" echo "Start manually: cd /opt/modInteractive && /opt/modInteractive/venv/bin/python main.py --source pir" echo "Or service: sudo systemctl restart modinteractive"