CoolFace
Apppublic

THEZYZSTUDIO/Pcmodcomputer

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
start.sh70 linesDownload Raw Back to root
1#!/bin/bash2# ══════════════════════════════════════════════════3# THE Z AI — Computer Mode Startup (FIXED v4)4# ══════════════════════════════════════════════════5 6echo "🖥️  Starting Z Computer Mode Server v4..."7 8# ── 1. Start Virtual Display ─────────────────────9pkill Xvfb 2>/dev/null || true10sleep 0.511Xvfb :1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &12XVFB_PID=$!13echo "✅ Xvfb started (PID: $XVFB_PID)"14sleep 215 16# ── 2. Export DISPLAY ─────────────────────────────17export DISPLAY=:118export XAUTHORITY=/root/.Xauthority19 20# إنشاء ملف xauthority بطريقة آمنة21touch $XAUTHORITY22MCOOKIE_VAL=$(mcookie 2>/dev/null || cat /proc/sys/kernel/random/uuid | tr -d '-' | head -c 32)23xauth add :1 . $MCOOKIE_VAL 2>/dev/null || true24echo "✅ DISPLAY=$DISPLAY"25 26# ── 3. Dark background ────────────────────────────27xsetroot -solid "#0d0d0d" 2>/dev/null || true28 29# ── 4. Start Fluxbox WM ───────────────────────────30pkill fluxbox 2>/dev/null || true31fluxbox &32FLUX_PID=$!33echo "✅ Fluxbox started (PID: $FLUX_PID)"34sleep 235 36# ── 5. Verify display works ───────────────────────37echo "🔍 Testing display..."38if xdotool getdisplaygeometry 2>/dev/null; then39    echo "✅ Display working!"40else41    echo "⚠️  xdotool test failed — continuing anyway"42fi43 44# ── 6. Test screenshot ────────────────────────────45scrot -q 80 /tmp/test_shot.png 2>/dev/null && \46    echo "✅ Screenshot test: OK" || \47    echo "⚠️  scrot test failed"48 49# ── 7. Detect browser (firefox-esr أولاً) ─────────50if command -v firefox-esr &>/dev/null; then51    echo "✅ Browser: firefox-esr"52    BROWSER="firefox-esr"53elif command -v firefox &>/dev/null; then54    echo "✅ Browser: firefox"55    BROWSER="firefox"56elif command -v chromium-browser &>/dev/null; then57    echo "✅ Browser: chromium-browser"58    BROWSER="chromium-browser"59else60    echo "⚠️  No browser found"61    BROWSER=""62fi63 64# Export browser name so app.py can use it65export DEFAULT_BROWSER="$BROWSER"66 67echo "🚀 Starting Python API on port ${PORT:-7860}..."68cd /app69exec python3 app.py70