Modo portatil: ejecutar FOSFENO en un portatil Linux
Anade 'bash install.sh --laptop' y el lanzador './fosfeno' para correr FOSFENO en portatiles Debian/Ubuntu/Mint sin Raspberry Pi: puerto 8080, sin arranque automatico ni cambios en el sistema. El servidor admite las variables FOSFENO_PORT y FOSFENO_NO_KIOSK. Nueva documentacion en docs/portatil.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
30a09fdee6
commit
3c1c631895
7 changed files with 250 additions and 53 deletions
77
fosfeno
Executable file
77
fosfeno
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
# ===========================================================================
|
||||
# FOSFENO :: arranque en modo portatil (Linux de escritorio)
|
||||
#
|
||||
# Lanza el servidor, abre el panel y las visuales, y lo cierra todo con Ctrl+C.
|
||||
# Antes hay que instalar una vez con: bash install.sh --laptop
|
||||
# ===========================================================================
|
||||
set -u
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PORT=8080
|
||||
export FOSFENO_PORT="$PORT"
|
||||
export FOSFENO_NO_KIOSK=1
|
||||
|
||||
if [ ! -x "$DIR/.venv/bin/python3" ]; then
|
||||
echo "FOSFENO no esta instalado todavia. Ejecuta primero:"
|
||||
echo " bash install.sh --laptop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER_PID=""
|
||||
STAGE_PID=""
|
||||
cleanup() {
|
||||
echo
|
||||
echo "Cerrando FOSFENO..."
|
||||
[ -n "$STAGE_PID" ] && kill "$STAGE_PID" 2>/dev/null
|
||||
[ -n "$SERVER_PID" ] && kill "$SERVER_PID" 2>/dev/null
|
||||
exit 0
|
||||
}
|
||||
trap cleanup INT TERM
|
||||
|
||||
echo "Arrancando FOSFENO..."
|
||||
"$DIR/.venv/bin/python3" "$DIR/backend/server.py" &
|
||||
SERVER_PID=$!
|
||||
|
||||
# Espera (hasta 20 s) a que el servidor responda
|
||||
for _ in $(seq 1 40); do
|
||||
curl -s "http://localhost:$PORT/" >/dev/null 2>&1 && break
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# Abre las visuales en una ventana propia de Chromium. Es una ventana normal:
|
||||
# arrastrala al proyector y pulsa F11 para ponerla a pantalla completa.
|
||||
BROWSER="$(command -v chromium-browser || command -v chromium \
|
||||
|| command -v google-chrome || true)"
|
||||
if [ -n "$BROWSER" ]; then
|
||||
"$BROWSER" --app="http://localhost:$PORT/stage" \
|
||||
--user-data-dir="/tmp/fosfeno-stage" \
|
||||
--use-fake-ui-for-media-stream \
|
||||
--autoplay-policy=no-user-gesture-required \
|
||||
>/dev/null 2>&1 &
|
||||
STAGE_PID=$!
|
||||
else
|
||||
echo "Aviso: no se encontro Chromium. Abre las visuales a mano en:"
|
||||
echo " http://localhost:$PORT/stage"
|
||||
fi
|
||||
|
||||
# Abre el panel de control en el navegador por defecto
|
||||
xdg-open "http://localhost:$PORT/" >/dev/null 2>&1 || true
|
||||
|
||||
cat <<EOF
|
||||
|
||||
FOSFENO en marcha (modo portatil).
|
||||
|
||||
Panel de control: http://localhost:$PORT/
|
||||
Visuales: ventana de Chromium aparte
|
||||
(arrastrala al proyector y pulsa F11)
|
||||
|
||||
Desde el movil, en la misma red WiFi:
|
||||
http://$(hostname).local:$PORT/
|
||||
|
||||
Pulsa Ctrl+C aqui para cerrar FOSFENO.
|
||||
|
||||
EOF
|
||||
|
||||
wait "$SERVER_PID"
|
||||
cleanup
|
||||
Loading…
Add table
Add a link
Reference in a new issue