mirror of
https://github.com/colonelpanichacks/flock-you.git
synced 2026-07-28 09:28:11 -07:00
dashboard: env-configurable port, plus ?demo=1 preview mode
flockyou.py: bind host and listen port both read from env (FLOCKYOU_HOST / FLOCKYOU_PORT, defaulting to 0.0.0.0:5000). Was a hardcoded :5000 before, which collides with other Flask projects on the same dev box — now you can run side-by-side instances or bind to localhost only. index.html: ?demo=1 query param seeds the dashboard with eight synthetic detections covering every visual state (live wildcard-probe, addr2, addr1 with/without GPS, replay/FLASH with/without GPS, replay/ RAM × 2) and reveals the device command toolbar so the polished layout is browseable without flashing real hardware. Purely a front-end mock — the command buttons still hit the real /api/flock/* endpoints, so clicking them in demo mode produces the actual "device not connected" error toast (that error path is itself part of the UI worth seeing). Self-contained: a single initDemoMode() function gated on the query param, called once at the end of DOMContentLoaded. api/README.md: both features documented under Quick start so they're discoverable without reading the source.
This commit is contained in:
+6
-3
@@ -1763,12 +1763,15 @@ if __name__ == '__main__':
|
||||
heartbeat_thread = threading.Thread(target=send_heartbeat, daemon=True)
|
||||
heartbeat_thread.start()
|
||||
|
||||
host = os.environ.get('FLOCKYOU_HOST', '0.0.0.0')
|
||||
port = int(os.environ.get('FLOCKYOU_PORT', '5000'))
|
||||
|
||||
print("Starting Flock You API server...")
|
||||
print("Server will be available at: http://localhost:5000")
|
||||
print(f"Server will be available at: http://localhost:{port}")
|
||||
print("Press Ctrl+C to stop the server")
|
||||
|
||||
|
||||
try:
|
||||
socketio.run(app, debug=False, host='0.0.0.0', port=5000, allow_unsafe_werkzeug=True)
|
||||
socketio.run(app, debug=False, host=host, port=port, allow_unsafe_werkzeug=True)
|
||||
except KeyboardInterrupt:
|
||||
print("\nShutting down server...")
|
||||
# Clean up connections
|
||||
|
||||
Reference in New Issue
Block a user