mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-06-10 00:44:37 +02:00
recon: remove /api/traffic/flow handler (now served by navi-traffic, extraction #1)
The /api/traffic/flow/<z>/<x>/<y>.png handler is dead code in recon. As of extraction #1 of the recon<->Navi decoupling, this path is served by the standalone navi-traffic service. Live request flow is now: Caddy (CT 101, navi.echo6.co @authed_api, forward_auth) -> nginx :8440 (location ^~ /api/traffic/ -> proxy_cache traffic_cache) -> navi-traffic gunicorn :8421 (services/navi_traffic) Cutover verified live: authenticated browser fetch to https://navi.echo6.co/api/traffic/flow/... returns 200 image/png with X-Cache-Status MISS then HIT (120s cache), Server: gunicorn. navi-backend (github.com/zvx-echo6/navi-backend): - dae54f3 Initial scaffold: navi-backend + navi-traffic - 311cb8f nginx: use ^~ prefix on /api/traffic/ to beat .png regex catch-all Caddy cutover (@authed_api upstream 8420 -> nginx 8440) applied on Utility CT 101. Also drops the now-unused make_response flask import (no other uses in lib/api.py). os and http_requests remain (used elsewhere). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f7a501b4d7
commit
75664c7d02
1 changed files with 1 additions and 22 deletions
23
lib/api.py
23
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, make_response
|
||||
from flask import Flask, request, jsonify, redirect, render_template
|
||||
from qdrant_client import QdrantClient
|
||||
from qdrant_client.models import Filter, FieldCondition, MatchValue
|
||||
from werkzeug.utils import secure_filename
|
||||
|
|
@ -1208,27 +1208,6 @@ 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
|
||||
# Orbis Maps Traffic API (migrated from classic)
|
||||
url = f'https://api.tomtom.com/maps/orbis/traffic/tile/flow/{z}/{x}/{y}.png?key={key}&apiVersion=1&style=light'
|
||||
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/place/<osm_type>/<int:osm_id>')
|
||||
def api_place_detail(osm_type, osm_id):
|
||||
"""Proxy place details from local Nominatim or Overpass API."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue