diff --git a/backend/__pycache__/models.cpython-313.pyc b/backend/__pycache__/models.cpython-313.pyc index 84f70fd..1993280 100644 Binary files a/backend/__pycache__/models.cpython-313.pyc and b/backend/__pycache__/models.cpython-313.pyc differ diff --git a/backend/core/__pycache__/mqtt_client.cpython-313.pyc b/backend/core/__pycache__/mqtt_client.cpython-313.pyc index 6305caf..f4bbe5b 100644 Binary files a/backend/core/__pycache__/mqtt_client.cpython-313.pyc and b/backend/core/__pycache__/mqtt_client.cpython-313.pyc differ diff --git a/backend/main.py b/backend/main.py index e5d87fa..3a38e8a 100644 --- a/backend/main.py +++ b/backend/main.py @@ -36,9 +36,11 @@ app = Flask(__name__) # CORS(app, resources={r"/api/*": {"origins": "http://127.0.0.1:5500"}}, supports_credentials=True) -CORS(app, resources={r"/api/*": {"origins": "http://127.0.0.1:5500"}}, supports_credentials=True, expose_headers='Content-Disposition') +# CORS(app, resources={r"/api/*": {"origins": "http://127.0.0.1:5500"}}, supports_credentials=True, expose_headers='Content-Disposition') -# CORS(app, resources={r"/api/*": {"origins": "http://localhost:5173"}}) +CORS(app, resources={r"/api/*": {"origins": ["http://192.168.1.8:5500","http://127.0.0.1:5500"]}}, supports_credentials=True, expose_headers='Content-Disposition') + +# CORS(app, resources={r"/api/*": {"origins": "http://localhost:5173"}}) , "http://127.0.0.1:5500" # This tells Flask: "For any route starting with /api/, allow requests # from the frontend running on http://localhost:5173". @@ -482,5 +484,5 @@ if __name__ == '__main__': mqtt_thread = threading.Thread(target=start_mqtt_clients, daemon=True) mqtt_thread.start() - print(f"Starting Flask-SocketIO server on http://localhost:5000") - socketio.run(app, host='0.0.0.0', port=5000) + print(f"Starting Flask-SocketIO server on http://192.168.1.8:5000") + socketio.run(app, host='192.168.1.8', port=5000) diff --git a/frontend/js/auth.js b/frontend/js/auth.js index e3f1071..9fbbc64 100644 --- a/frontend/js/auth.js +++ b/frontend/js/auth.js @@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', () => { const password = document.getElementById('password').value; try { - const response = await fetch('http://localhost:5000/api/login', { + const response = await fetch('http://192.168.1.8:5000/api/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username, password }), diff --git a/frontend/js/dashboard.js b/frontend/js/dashboard.js index 2c184a5..0d744b2 100644 --- a/frontend/js/dashboard.js +++ b/frontend/js/dashboard.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://localhost:5000"; - const API_BASE = "http://localhost:5000/api"; // Added for API calls + const SOCKET_URL = "http://192.168.1.8:5000"; + const API_BASE = "http://192.168.1.8:5000/api"; // Added for API calls // --- DOM ELEMENT REFERENCES --- const grid = document.getElementById('chambersGrid'); diff --git a/frontend/js/logs.js b/frontend/js/logs.js index ec64195..8d3512f 100644 --- a/frontend/js/logs.js +++ b/frontend/js/logs.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://localhost:5000"; - const API_BASE = "http://localhost:5000/api"; + const SOCKET_URL = "http://192.168.1.8:5000"; + const API_BASE = "http://192.168.1.8:5000/api"; // --- DOM ELEMENT REFERENCES --- const stationNameEl = document.getElementById('station-name'); diff --git a/frontend/js/station_selection.js b/frontend/js/station_selection.js index cf8c7f8..fff3eb6 100644 --- a/frontend/js/station_selection.js +++ b/frontend/js/station_selection.js @@ -86,7 +86,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- DATA FETCHING & STATUS POLLING --- const loadAndPollStations = async () => { try { - const response = await fetch('http://localhost:5000/api/stations'); + const response = await fetch('http://192.168.1.8:5000/api/stations'); if (!response.ok) throw new Error('Failed to fetch stations'); const stations = await response.json(); diff --git a/frontend/station_selection.html b/frontend/station_selection.html index cf3ced9..f44abf8 100644 --- a/frontend/station_selection.html +++ b/frontend/station_selection.html @@ -195,7 +195,7 @@