diff --git a/script/deploy.sh b/script/deploy.sh index fdda9f8..3cd97ad 100755 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -336,11 +336,14 @@ launch_gui() { python3 "${BRIDGE_SCRIPT}" > /dev/null 2>&1 & export BRIDGE_PID=$! - xdg-open "http://localhost:${WEBSERVER_PORT}" 2>/dev/null || open "http://localhost:${WEBSERVER_PORT}" 2>/dev/null || true + + local START_URL="http://localhost:${WEBSERVER_PORT}/pages/index.html" + + xdg-open "${START_URL}" 2>/dev/null || open "${START_URL}" 2>/dev/null || true sleep 5 - echo -e "\n ➡️ If it doesn't automatically, open your browser at: $(gum style --foreground 212 "http://localhost:${WEBSERVER_PORT}")" + echo -e "\n ➡️ If it doesn't automatically, open your browser at: $(gum style --foreground 212 "${START_URL}")" } # --- MAIN WEB FUNCTIONS ---< @@ -711,9 +714,9 @@ securely on a hidden sheet of paper or add it to your password manager (locally # --- DEFAULT VARIABLES ---> WEBSERVER_PORT=${WEBSERVER_PORT:-8088} -LIVE_DATA_FILE="config/live.yaml" -HW_DATA_FILE="config/hardware.yaml" -CONFIG_FILE="config/numbus.yaml" +LIVE_DATA_FILE="web/config/live.yaml" +HW_DATA_FILE="web/config/hardware.yaml" +CONFIG_FILE="web/config/numbus.yaml" BRIDGE_SCRIPT="web/logic/interactive.py" diff --git a/web/logic/interactive.py b/web/logic/interactive.py index 61956cb..89881a3 100644 --- a/web/logic/interactive.py +++ b/web/logic/interactive.py @@ -9,10 +9,10 @@ os.makedirs(SECRET_PATH, exist_ok=True) LOGS_DIR = "logs/" PAGES_DIR = "pages/" CONFIG_DIR = "config/" -SIGNALS_DIR = "signal/" +SIGNALS_DIR = "signals/" ### <-- Variables -os.chdir(web/) +os.chdir('web') class BridgeHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): @@ -39,18 +39,22 @@ class BridgeHandler(http.server.SimpleHTTPRequestHandler): if self.path == '/discovery': # Store secrets in memory-backed filesystem - with open(os.path.join(SECRET_PATH, "live.yaml"), "wb") as f: + # We write to CONFIG_DIR so deploy.sh can find it easily + os.makedirs(CONFIG_DIR, exist_ok=True) + with open(os.path.join(CONFIG_DIR, "live.yaml"), "wb") as f: f.write(post_data) self.send_response(200) self.end_headers() - # Signal Bash that discovery data is ready - with open(os.path.join(SIGNALS_DIR, ".discovery_ready"), "w") as f: f.write("1") + # Signal Bash that discovery data is ready and we can proceed to hardware detection + os.makedirs(SIGNALS_DIR, exist_ok=True) + with open(os.path.join(SIGNALS_DIR, "hw_detection_ready"), "w") as f: f.write("1") + with open(os.path.join(SIGNALS_DIR, "configuration_ready"), "w") as f: f.write("1") elif self.path == '/deploy': with open(os.path.join(CONFIG_DIR, "numbus.yaml"), "wb") as f: f.write(post_data) self.send_response(200) self.end_headers() - with open(os.path.join(SIGNALS_DIR, ".deploy_signal"), "w") as f: f.write("1") + with open(os.path.join(SIGNALS_DIR, "deployment_ready"), "w") as f: f.write("1") http.server.HTTPServer(('localhost', 8088), BridgeHandler).serve_forever() \ No newline at end of file