From d0d3da116cb0ebab457c0cc129de142a2ab6eb1d Mon Sep 17 00:00:00 2001 From: type-two Date: Mon, 20 Jul 2026 20:18:13 +1000 Subject: [PATCH] =?UTF-8?q?polish:=20emoji=20favicon=20(kills=20the=20/fav?= =?UTF-8?q?icon.ico=20404)=20+=20adsb.lol=20420/429=20=E2=86=92=20clean=20?= =?UTF-8?q?empty=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - inline SVG 🌍 favicon so the browser never requests /favicon.ico - proxy/adsb: on adsb.lol rate-limit (420 'Enhance Your Calm' or 429) with no cached fallback, return 200 {"ac":[]} instead of the error — layer shows nothing until next poll, no scary browser console error; widened upstream spacing 1.0→1.3s to hit the limit less often Co-Authored-By: Claude Fable 5 --- index.html | 1 + serve.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 15c6fdc..1585303 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ GODSIGH ▸ World View + diff --git a/serve.py b/serve.py index b8f6b12..1823988 100644 --- a/serve.py +++ b/serve.py @@ -78,7 +78,7 @@ ADSB_PATH_RE = re.compile( r'|lat/-?\d{1,3}(\.\d+)?/lon/-?\d{1,3}(\.\d+)?/dist/\d{1,4}(\.\d+)?' r'|closest/-?\d{1,3}(\.\d+)?/-?\d{1,3}(\.\d+)?/\d{1,4}(\.\d+)?)$') ADSB_CACHE_SEC = 120 -ADSB_MIN_INTERVAL = 1.0 # min seconds between upstream adsb.lol calls (anti-burst; it 429s fast) +ADSB_MIN_INTERVAL = 1.3 # min seconds between upstream adsb.lol calls (anti-burst; it 429s fast) _adsb_cache = {} # path -> (body, ts) _adsb_lock = threading.Lock() _adsb_next = [0.0] # earliest wall-time the next upstream call may start @@ -353,6 +353,12 @@ class Handler(SimpleHTTPRequestHandler): except urllib.error.HTTPError as e: if hit is not None: return self._send(200, "application/json", hit[0], {"X-Godsigh-Cache": "stale"}) + # adsb.lol rate-limits with 429 or 420 ("Enhance Your Calm"). With no + # cache to fall back on, return a clean empty result (200) rather than + # surfacing the error — the layer just shows nothing until the next + # poll, and the browser console stays quiet. + if e.code in (420, 429): + return self._send(200, "application/json", b'{"ac":[]}', {"X-Godsigh-Cache": "ratelimited"}) return self._send_json(e.code, {"error": f"adsb.lol upstream {e.code}"}) except Exception as e: if hit is not None: