mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
Merge upstream/main, following its route renames
main renamed the three routes this branch governs:
/api/opensky -> /api/flights
/api/opensky-track -> /api/flights/track
/api/adsblol/trace -> /api/military/track
The merge took main's names in the route registrations cleanly, which left the
branch's own material pointing at routes that no longer exist — including
`openSkyTrackGovernor.test.mjs`, which looks its handlers up BY path, so it
failed with "handler is not a function" rather than with anything that named
the cause. Renamed in the test, in both doc comments and in the CHANGELOG and
CURRENT-STATE entries this branch adds. The historical CHANGELOG entry that
main also carries is left alone: it records what was true at that release.
Nothing else about the change moved. The limiter, its sizing, the cooldown
read and the serve-stale path are byte-identical to the branch tip; the only
other differences from it are the two append-only bookkeeping files.
node --test src/openSkyTrackGovernor.test.mjs \
src/tooling/liveProviders.test.mjs src/proxyErrorResponses.test.mjs
tests 34 pass 34 fail 0
npm run format:check Checked 1210 source files.
npm run check:boundaries clean
npm run layer-token:check 28 published, 0 new
This commit is contained in:
commit
0c1b017699
402 files changed
+47328
-3632
No files matched your search
@@ -4,14 +4,14 @@ import { makeRateLimiter, clientKey } from '../common/rate-limit.js';
|
||||
/**
|
||||
* Vite plugin: aircraft track-history backfill proxies (PRD WS-F F1/F2).
|
||||
*
|
||||
* /api/opensky-track?icao24=<hex6> — OpenSky GET /tracks/all (experimental;
|
||||
* /api/flights/track?icao24=<hex6> — OpenSky GET /tracks/all (experimental;
|
||||
* own credit bucket, 4 credits per call on the free tier). OAuth via the
|
||||
* shared coalesced token. 60s per-icao cache; 404/429 forwarded so the
|
||||
* client can fall back to its accumulated trail silently. Both routes are
|
||||
* rate-limited per IP, and the OpenSky one additionally stands down while
|
||||
* `/api/opensky` is in its 429 credit cooldown — the per-icao cache bounds
|
||||
* `/api/flights` is in its 429 credit cooldown — the per-icao cache bounds
|
||||
* memory, not spend, since a different `icao24` is simply a different key.
|
||||
* /api/adsblol/trace?hex=<hex> — adsb.lol tar1090 readsb trace
|
||||
* /api/military/track?hex=<hex> — adsb.lol tar1090 readsb trace
|
||||
* (undocumented but live; no browser CORS, hence this proxy). Up to ~24h
|
||||
* of real history per aircraft. Treat as best-effort; data is ODbL —
|
||||
* credit "adsb.lol (ODbL)" in the UI.
|
||||
@@ -65,7 +65,7 @@ export function trackBackfillProxies() {
|
||||
async function proxyJson(res, key, upstreamUrl, headers = {}, blockedMs = 0) {
|
||||
const cached = cache.get(key);
|
||||
const fresh = cached && Date.now() - cached.at < TRACK_CACHE_MS;
|
||||
// Serve-stale while the account is cooling, the way `/api/opensky` does:
|
||||
// Serve-stale while the account is cooling, the way `/api/flights` does:
|
||||
// a stale trail beats no trail, and replaying a cached body spends no
|
||||
// credits.
|
||||
if (cached && (fresh || blockedMs > 0)) {
|
||||
@@ -108,7 +108,7 @@ export function trackBackfillProxies() {
|
||||
}
|
||||
|
||||
function install(middlewares) {
|
||||
middlewares.use('/api/opensky-track', async (req, res) => {
|
||||
middlewares.use('/api/flights/track', async (req, res) => {
|
||||
try {
|
||||
if (!allow(clientKey(req))) {
|
||||
refuse(res, 10);
|
||||
@@ -126,7 +126,7 @@ export function trackBackfillProxies() {
|
||||
);
|
||||
return;
|
||||
}
|
||||
// This route spends the SAME daily credit budget as `/api/opensky`
|
||||
// This route spends the SAME daily credit budget as `/api/flights`
|
||||
// (4 credits per call), so it honors that proxy's 429 cooldown. While
|
||||
// the account is cooling, do not mint a token and do not call upstream.
|
||||
const coolingMs = openSkyCooldownRemainingMs();
|
||||
@@ -145,7 +145,7 @@ export function trackBackfillProxies() {
|
||||
}
|
||||
});
|
||||
|
||||
middlewares.use('/api/adsblol/trace', async (req, res) => {
|
||||
middlewares.use('/api/military/track', async (req, res) => {
|
||||
try {
|
||||
// adsb.lol is free and unmetered, so no credit governor applies here —
|
||||
// the limiter is for the operator's own IP reputation with a community
|
||||
|
||||
Reference in new issue
Block a user