#!/bin/bash
# Victory desktop launcher: dedicated Electron application
# The container serves the UI on localhost:18800 and the API on localhost:18789

LOG=/tmp/victory-open.log
log() { echo "[$(date '+%H:%M:%S')] $*" >> "$LOG" 2>/dev/null || true; }
log "=== Victory launch ==="

# One-shot update check at app launch. Offline checks allow normal startup.
CHECK=/usr/lib/victoryclaw/victory-update-check.py
if [ "${1:-}" != "--skip-update-check" ] && [ -f "$CHECK" ]; then
    python3 "$CHECK"
    [ "$?" -eq 20 ] && exit 0
fi


exec /usr/bin/victory-desktop "$@"
