From a8de439ecefe6ee2edc3f5eadb0cf3b9e04bf80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Numbus?= Date: Sun, 17 May 2026 14:14:50 +0200 Subject: [PATCH] Trying to get python bridge to work. --- script/deploy.sh | 22 +++++++++++++--------- web/{ => logic}/interactive.py | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) rename web/{ => logic}/interactive.py (98%) diff --git a/script/deploy.sh b/script/deploy.sh index 5811124..cb4f252 100755 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -334,7 +334,9 @@ launch_gui() { echo -e "\n ➡️ You will now proceed to the configuration of your device through your browser" echo -e "\n 🚀 Launching Numbus Configurator..." - python3 "${BRIDGE_SCRIPT}" > /dev/null 2>&1 & + cd "${BRIDGE_SCRIPT_DIR}" + python3 "${BRIDGE_SCRIPT_FILE}" > /dev/null 2>&1 & + cd ../../ export BRIDGE_PID=$! xdg-open "http://localhost:${WEBSERVER_PORT}" 2>/dev/null || open "http://localhost:${WEBSERVER_PORT}" 2>/dev/null || true @@ -711,15 +713,16 @@ 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="config/live.yaml" +HW_DATA_FILE="config/hardware.yaml" +CONFIG_FILE="config/numbus.yaml" -BRIDGE_SCRIPT="../web/logic/interactive.py" +BRIDGE_SCRIPT_FILE="interactive.py" +BRIDGE_SCRIPT_DIR="web/logic" TARGET_USER="nixos" -TMP_EXTRA_PATH="../extra" +TMP_EXTRA_PATH="extra" if [[ ${DEBUG-0} -eq 1 ]]; then FILES_CP_FLAGS="vau" @@ -755,6 +758,7 @@ GUM_INPUT_TIMEOUT="3600" # --- PRE MAIN LOGIC ---> set -euo pipefail clear +cd ../ trap cleanup EXIT # --- PRE MAIN LOGIC ---< @@ -770,15 +774,15 @@ echo """ launch_gui hierarchy_preparation -until [[ -e ../web/signals/hw_detection_ready ]]; do +until [[ -e web/signals/hw_detection_ready ]]; do sleep 5 done LIVE_TARGET_IP="$(yq -r '.live_target_ip' ${LIVE_DATA_FILE})" LIVE_TARGET_PASSWORD="$(yq -r '.live_target_password' ${LIVE_DATA_FILE})" -until [[ -e ../web/signals/configuration_ready ]]; do +until [[ -e web/signals/configuration_ready ]]; do sleep 5 done -until [[ -e ../web/signals/deployment_ready ]]; do +until [[ -e web/signals/deployment_ready ]]; do sleep 5 done # --- MAIN LOGIC ---< \ No newline at end of file diff --git a/web/interactive.py b/web/logic/interactive.py similarity index 98% rename from web/interactive.py rename to web/logic/interactive.py index e4a7543..514cf44 100644 --- a/web/interactive.py +++ b/web/logic/interactive.py @@ -51,5 +51,5 @@ class BridgeHandler(http.server.SimpleHTTPRequestHandler): self.end_headers() with open(os.path.join(SIGNALS_DIR, ".deploy_signal"), "w") as f: f.write("1") -os.chdir(PAGES_DIR) +os.chdir(../) http.server.HTTPServer(('localhost', 8088), BridgeHandler).serve_forever() \ No newline at end of file