diff --git a/dashboard/landing.html b/dashboard/landing.html index 005a821..195f7db 100644 --- a/dashboard/landing.html +++ b/dashboard/landing.html @@ -500,11 +500,13 @@ .catch(function(){}); diff --git a/dashboard/server.py b/dashboard/server.py index 7c67e98..0ad460f 100644 --- a/dashboard/server.py +++ b/dashboard/server.py @@ -183,6 +183,32 @@ def search_vehicles(brand=None, model=None, year=None, engine_name=None, with_pa def index(): return send_from_directory('.', 'landing.html') +# ── POS Proxy — forward /pos/* to POS server on port 5001 ── +@app.route('/pos/', defaults={'path': ''}) +@app.route('/pos/', methods=['GET', 'POST', 'PUT', 'DELETE']) +def pos_proxy(path): + import requests as req + target = f'http://127.0.0.1:5001/pos/{path}' + # Forward the request + try: + headers = {k: v for k, v in request.headers if k.lower() not in ('host', 'content-length')} + resp = req.request( + method=request.method, + url=target, + headers=headers, + params=request.args, + data=request.get_data(), + timeout=30 + ) + # Build response + from flask import Response + excluded = {'content-encoding', 'transfer-encoding', 'connection'} + resp_headers = [(k, v) for k, v in resp.raw.headers.items() if k.lower() not in excluded] + return Response(resp.content, status=resp.status_code, headers=resp_headers) + except Exception as e: + return jsonify({'error': f'POS server unavailable: {str(e)}'}), 502 + + @app.route('/catalog') def public_catalog(): return send_from_directory('.', 'catalog-public.html')