mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
Add TomTom traffic proxy and update profiles for hillshade/traffic layers
- Add /api/traffic/flow proxy route to hide TomTom API key from frontend - Add tileset_hillshade and traffic config blocks to all three profiles - Flip has_hillshade and has_traffic_overlay flags in home and regional profiles - Minimal profile has config blocks but flags remain false (dormant) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e6b81db520
commit
64605b38bb
4 changed files with 51 additions and 4 deletions
22
lib/api.py
22
lib/api.py
|
|
@ -17,7 +17,7 @@ import shutil
|
|||
import tempfile
|
||||
|
||||
import requests as http_requests
|
||||
from flask import Flask, request, jsonify, redirect, render_template
|
||||
from flask import Flask, request, jsonify, redirect, render_template, make_response
|
||||
from qdrant_client import QdrantClient
|
||||
from qdrant_client.models import Filter, FieldCondition, MatchValue
|
||||
from werkzeug.utils import secure_filename
|
||||
|
|
@ -1166,6 +1166,26 @@ def api_knowledge_stats():
|
|||
return jsonify(_cache['knowledge_stats'])
|
||||
|
||||
|
||||
|
||||
@app.route('/api/traffic/flow/<int:z>/<int:x>/<int:y>.png')
|
||||
def api_traffic_flow(z, x, y):
|
||||
"""Proxy TomTom traffic flow tiles to hide API key from frontend."""
|
||||
key = os.environ.get('TOMTOM_API_KEY')
|
||||
if not key:
|
||||
return 'Traffic service not configured', 503
|
||||
url = f'https://api.tomtom.com/traffic/map/4/tile/flow/relative/{z}/{x}/{y}.png?key={key}'
|
||||
try:
|
||||
resp = http_requests.get(url, timeout=10)
|
||||
if resp.status_code != 200:
|
||||
return 'Upstream error', 502
|
||||
r = make_response(resp.content)
|
||||
r.headers['Content-Type'] = 'image/png'
|
||||
r.headers['Cache-Control'] = 'public, max-age=120'
|
||||
return r
|
||||
except Exception:
|
||||
return 'Upstream timeout', 504
|
||||
|
||||
|
||||
@app.route('/api/config')
|
||||
def api_config():
|
||||
"""Return deployment profile config for frontend consumption."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue