diff --git a/backend/.env b/backend/.env index bc44926..b270d86 100644 --- a/backend/.env +++ b/backend/.env @@ -6,7 +6,8 @@ SECRET_KEY="80473e17c5707e19252ef3736fba32805be21a9b3e914190" # --- PostgreSQL Database Connection --- # Replace with your actual database credentials. # Format: postgresql://:@:/ -DATABASE_URL="postgresql://swap_app_user:2004@localhost:5432/swap_station_db" +# DATABASE_URL="postgresql://swap_app_user:2004@localhost:5432/swap_station_db" +DATABASE_URL="postgresql://swap_app_user:Vec%40123@localhost:5432/swap_station_db" # --- MQTT Broker Connection --- MQTT_BROKER="mqtt-dev.upgrid.in" diff --git a/backend/__pycache__/models.cpython-313.pyc b/backend/__pycache__/models.cpython-313.pyc index fc4be5d..4825daa 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__/__init__.cpython-313.pyc b/backend/core/__pycache__/__init__.cpython-313.pyc index 1b8d744..45a9cca 100644 Binary files a/backend/core/__pycache__/__init__.cpython-313.pyc and b/backend/core/__pycache__/__init__.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 92291de..abf65da 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/core/__pycache__/protobuf_decoder.cpython-313.pyc b/backend/core/__pycache__/protobuf_decoder.cpython-313.pyc index 06b6075..1f52f62 100644 Binary files a/backend/core/__pycache__/protobuf_decoder.cpython-313.pyc and b/backend/core/__pycache__/protobuf_decoder.cpython-313.pyc differ diff --git a/backend/main.py b/backend/main.py index 5bbef7a..3fac265 100644 --- a/backend/main.py +++ b/backend/main.py @@ -39,7 +39,7 @@ app = Flask(__name__) # 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://192.168.1.10:5500","http://127.0.0.1:5500"]}}, supports_credentials=True, expose_headers='Content-Disposition') +CORS(app, resources={r"/api/*": {"origins": ["http://10.10.2.47:5501","http://127.0.0.1:5501"]}}, 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 @@ -573,7 +573,7 @@ def get_analytics_data(): hourly_swaps[log_hour] += 1 if session_id: swap_starts_map[session_id] = log.timestamp - elif event_type == 'EVENT_SWAP_ENDED': + elif event_type == 'EVENT_BATTERY_EXIT': completed_swaps += 1 daily_completed[log_date] = daily_completed.get(log_date, 0) + 1 if session_id and session_id in swap_starts_map: @@ -953,5 +953,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://192.168.1.10:5000") - socketio.run(app, host='192.168.1.10', port=5000) + print(f"Starting Flask-SocketIO server on http://10.10.2.47:5000") + socketio.run(app, host='10.10.2.47', port=5000) diff --git a/backend/proto/__pycache__/__init__.cpython-313.pyc b/backend/proto/__pycache__/__init__.cpython-313.pyc index 25d384d..2b269ac 100644 Binary files a/backend/proto/__pycache__/__init__.cpython-313.pyc and b/backend/proto/__pycache__/__init__.cpython-313.pyc differ diff --git a/backend/proto/__pycache__/vec_payload_chgSt_pb2.cpython-313.pyc b/backend/proto/__pycache__/vec_payload_chgSt_pb2.cpython-313.pyc index d80a5a2..ccff2e0 100644 Binary files a/backend/proto/__pycache__/vec_payload_chgSt_pb2.cpython-313.pyc and b/backend/proto/__pycache__/vec_payload_chgSt_pb2.cpython-313.pyc differ diff --git a/frontend/js/analytics.js b/frontend/js/analytics.js index d088766..94f8267 100644 --- a/frontend/js/analytics.js +++ b/frontend/js/analytics.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // --- DOM ELEMENT REFERENCES --- const stationNameEl = document.getElementById('station-name'); @@ -126,7 +126,7 @@ document.addEventListener('DOMContentLoaded', () => { type: 'bar', data: { labels: data.labels, - datasets: [{ label: 'Total Swaps', data: data.swap_data, backgroundColor: 'rgba(56, 189, 248, 0.6)' }] + datasets: [{ label: 'Total Swaps initiated', data: data.swap_data, backgroundColor: 'rgba(56, 189, 248, 0.6)' }] }, options: { responsive: true, diff --git a/frontend/js/auth.js b/frontend/js/auth.js index 22c5689..aab6210 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://192.168.1.10:5000/api/login', { + const response = await fetch('http://10.10.2.47:5000/api/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username, password }), diff --git a/frontend/js/common-header.js b/frontend/js/common-header.js index d9a4660..4a1cc5b 100644 --- a/frontend/js/common-header.js +++ b/frontend/js/common-header.js @@ -1,8 +1,8 @@ // frontend/js/common-header.js document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // --- STATE & SELECTED STATION --- let selectedStation = null; diff --git a/frontend/js/dashboard.js b/frontend/js/dashboard.js index 3bafa00..a99bc05 100644 --- a/frontend/js/dashboard.js +++ b/frontend/js/dashboard.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; // Added for API calls + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47: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 5cc61ca..98b4319 100644 --- a/frontend/js/logs.js +++ b/frontend/js/logs.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47: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 641ee7f..9433cd7 100644 --- a/frontend/js/station_selection.js +++ b/frontend/js/station_selection.js @@ -4,7 +4,7 @@ document.addEventListener('DOMContentLoaded', () => { const stationCountEl = document.getElementById('station-count'); // Make sure you have an element with this ID in your HTML // --- CONFIG & STATE --- - const API_BASE = 'http://192.168.1.10:5000/api'; + const API_BASE = 'http://10.10.2.47:5000/api'; let allStations = []; // Master list of stations from the API let pollingInterval = null; diff --git a/frontend/station_selection.html b/frontend/station_selection.html index a4f3036..685c493 100644 --- a/frontend/station_selection.html +++ b/frontend/station_selection.html @@ -225,7 +225,7 @@