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
|
|
@ -13,6 +13,7 @@ Motores: projectm (nativo), butterchurn, hydra, shaders (GLSL) y mixer
|
|||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
|
|
@ -44,7 +45,10 @@ def load_json(path, default):
|
|||
|
||||
CFG = load_json(BASE / "config.json", {})
|
||||
HOST = CFG.get("server", {}).get("host", "0.0.0.0")
|
||||
PORT = int(CFG.get("server", {}).get("port", 80))
|
||||
# El puerto y el modo kiosko se pueden forzar por variable de entorno; asi el
|
||||
# modo portatil (script 'fosfeno') usa el puerto 8080 sin tocar config.json.
|
||||
PORT = int(os.environ.get("FOSFENO_PORT") or CFG.get("server", {}).get("port", 80))
|
||||
NO_KIOSK = bool(os.environ.get("FOSFENO_NO_KIOSK"))
|
||||
|
||||
app = Flask(__name__, static_folder=None)
|
||||
socketio = SocketIO(app, async_mode="threading", cors_allowed_origins="*")
|
||||
|
|
@ -180,7 +184,7 @@ def start_chromium():
|
|||
notify("error", "No se encontro Chromium. Las visuales web no pueden "
|
||||
"mostrarse. Ejecuta install.sh para instalarlo.")
|
||||
return
|
||||
url = kiosk.get("url", f"http://localhost:{PORT}/stage")
|
||||
url = f"http://localhost:{PORT}/stage"
|
||||
procs["chromium"] = subprocess.Popen([
|
||||
browser,
|
||||
"--kiosk", f"--app={url}",
|
||||
|
|
@ -442,7 +446,8 @@ def watchdog():
|
|||
time.sleep(10)
|
||||
if refresh_network():
|
||||
broadcast()
|
||||
if state["engine"] != "projectm" and not is_running(procs["chromium"]):
|
||||
if not NO_KIOSK and state["engine"] != "projectm" \
|
||||
and not is_running(procs["chromium"]):
|
||||
notify("warn", "El navegador de las visuales se cerro. "
|
||||
"Reabriendolo automaticamente.")
|
||||
start_chromium()
|
||||
|
|
@ -471,7 +476,9 @@ def main():
|
|||
check_install()
|
||||
setup_audio()
|
||||
refresh_network()
|
||||
threading.Timer(3.0, start_chromium).start()
|
||||
# En modo portatil el script 'fosfeno' abre el navegador; el servidor no.
|
||||
if not NO_KIOSK:
|
||||
threading.Timer(3.0, start_chromium).start()
|
||||
threading.Thread(target=watchdog, daemon=True).start()
|
||||
|
||||
net = state["network"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue