Commit Graph
8 Commits
Author SHA1 Message Date
daikaginza fbd99dad7c Merge upstream/main 93ea088f4 2026-10-18 13:36:07 +07:00
Sameh Khamis 761953b0bf Correct the remaining permanent-cache comments
The adsbdb proxy keeps successful and 404 answers for 24 hours; two policy comments and the provider's doc comment still said forever.
2026-10-17 11:30:46 -07:00
daikaginza c20af07adb Merge remote-tracking branch 'upstream/main' into fix/adsbdb-cache-and-rate-limit
main now reads adsbdb bodies through readResponseJsonCapped. That capped
payload feeds this branch's bounded store via remember(), so both the size cap
and the entry cap apply.
2026-10-16 09:26:47 +07:00
daikaginza 03814d8c47 fix(adsbdb): rate-limit /api/adsbdb and cap its enrichment caches
Both keys this route accepts come from the caller — a callsign is 2-8 of
[A-Z0-9], a hex is six of [0-9a-f] — and every distinct key that reached
upstream was cached, 404s included, with nothing ever removing one. A caller
walking the keyspace could therefore drive unlimited live requests at the free
community API and grow `.gev-cache/adsbdb.json` without end.

Admit 360 requests/minute per client address, global backstop 3x, refusing the
rest with 429 and `Retry-After` before any cache, disk or upstream work. The
browser cannot exceed 300/min by construction: ENRICH_DISPATCH_GAP_MS is
200 ms, so the enrichment queue drips at most five lookups a second.

Hold each store to 20,000 entries, dropping least-recently-written first, and
discard entries past the existing 24-hour TTL when the file is read back. A
cache file above 16 MB is skipped rather than parsed. Sized from a real
session's own file: 397 aircraft entries (~100 B) and 3 route entries
(~231 B), so the ceiling is about fifty times an ordinary working set and
bounds the file at roughly 7 MB.

The two stores become Maps: `size` is O(1), so the ceiling can be enforced on
every write, and iteration is true insertion order — an all-digit callsign
like "1234" sorts ahead of everything else as an object key. The on-disk JSON
shape is unchanged.

Refs #261
2026-09-27 22:23:55 +07:00
Michael JohnstonandClaude Opus 5 5f8a275487 fix(providers): bound the remaining upstream body reads
Route the six proxied fetches that still buffered upstream bodies without
a limit through the shared capped readers in src/sources/httpBody.js:
FIRMS CSV, CelesTrak TLE groups, adsb.lol /v2/mil (both the OK and
relayed-status paths), TomTom flow tiles, OpenSky states/all and adsbdb
enrichment lookups. Each cap is a bound sized well above the measured
payload, not a budget.

readResponseBytesCapped gains the same optional abort signal as the text
reader, with the same cancel-on-abort plumbing and reader release, so the
TomTom tile path can share the route deadline instead of reading
arrayBuffer() unbounded. Where a route already had a deadline, the same
signal now covers the body read as well as the headers. Two polls had no
deadline at all: the adsb.lol military poll gains a 12-second one and the
OpenSky states/all exchange, including its Basic-auth retry, a 20-second
one; both miss into their existing STALE paths.

FIRMS map-key status, the OpenSky token exchange and CCTV media are left
as they are.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-26 14:40:08 -04:00
Jejugo a0f07b752f fix: register data providers for local preview
Adapt the preview middleware contribution from PR #324 to the extracted provider modules, including the existing OpenSky route.
2026-09-12 12:43:54 -07:00
Sameh Khamis f9a85528fe style: format extracted live provider modules 2026-09-11 19:06:10 -07:00
Sameh Khamis 0e221441b4 refactor: separate aircraft and vessel server providers 2026-09-11 19:06:09 -07:00