From 5b118d63b3d0cd3ae88d0bcff571213a39eab822 Mon Sep 17 00:00:00 2001 From: derlole <122916573+derlole@users.noreply.github.com> Date: Wed, 7 May 2025 11:26:27 +0000 Subject: [PATCH] fix: correct IP assignment and enhance socketio initialization --- routes/esp_routes.py | 2 +- server.py | 2 +- static/socketio.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/esp_routes.py b/routes/esp_routes.py index b8ec713..77daa06 100644 --- a/routes/esp_routes.py +++ b/routes/esp_routes.py @@ -24,7 +24,7 @@ def esp_online(): sender_ip = request.headers.get('X-Forwarded-For', request.remote_addr) esp_ip = data.get("ip", "unknown") - esp_conn_infos["ip_local"] = esp_ip + esp_conn_infos["ip_local"] = esp_ip[0] esp_conn_infos["ip_global"] = sender_ip esp_conn_infos["last_seen"] = datetime.now() esp_conn_infos["connection_valid"] = True diff --git a/server.py b/server.py index 71a7bad..81008f8 100644 --- a/server.py +++ b/server.py @@ -19,7 +19,7 @@ MQTT_TOPIC_SEND = "coffee/command" app = Flask(__name__, static_url_path='/unsecure/static') app.config['SECRET_KEY'] = 'super-secret-key' -socketio.init_app(app) +socketio.init_app(app, cors_allowed_origins="*", async_mode='threading') # Blueprints registrieren diff --git a/static/socketio.js b/static/socketio.js index 010bec1..33cff4d 100644 --- a/static/socketio.js +++ b/static/socketio.js @@ -28,4 +28,4 @@ socket.on('static_data', (data) => { gebId("infoMain").classList.add("blink-orange"); gebId("machine-status-butt").classList.add("deniePress"); } -}); \ No newline at end of file +});