A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.
JavaScript 3d-globecesiumflight-trackinggeospatialgeospatial-intelligencegisosintphotogrammetrysatellite-trackingspatial-intelligencewebglworldview
Merge remote-tracking branch 'origin/main' into fix/1273
Said Turksever98af799cb4cd
diff --cc docs/CURRENT-STATE.mdindex d4e5a0d42,b8af5c646..48e44c016--- a/docs/CURRENT-STATE.md+++ b/docs/CURRENT-STATE.md@@@ -9,8 -9,11 +9,13 @@@ broader suffix variants. Follow-ups retlookups preserve the previous analyst cohort and boundary source. Navigationsearch keeps a successful geocode, with no search or view-based region recovery.+The standalone military source no longer requests the unavailable, undocumented ADSB.lol trace endpoint. Tracking retains its locally accumulated trail, and custom sources may still supply optional getTrack history. The old HTTP route validates the identifier then reports 503 history_unavailable without any upstream request, rather than forwarding a misleading 403. This does not restore historical coverage or download bulk daily archives.++ Terrain height requests accept at most 64 points, matching the browser service's+ existing batch size and one bounded upstream chunk. Larger requests return HTTP+ 413 before disk-cache loading or upstream work; malformed coordinates remain 400.+ The browser continues to split larger workloads into sequential 64-point requests.+Shared distance checks use `src/geoDistance.js` with `{ lat, lon }` points andthe IUGG mean spherical Earth radius, 6371.0088 km. `greatCircleKm` iscanonical; `greatCircleMeters` is its exact metre conversion. Missing,diff --cc src/tooling/liveProviders.test.mjsindex 488c2d40c,60b2c9f25..6b880d186--- a/src/tooling/liveProviders.test.mjs+++ b/src/tooling/liveProviders.test.mjs@@@ -584,20 -584,123 +584,141 @@@ test('track backfill proxy returns 502assert.equal(callCount, 1);});+test('retired military history refuses without upstream I/O while validating identifiers', async (t) => {+ t.mock.method(globalThis, 'fetch', async () => {+ assert.fail('retired history must not contact the upstream');+ });+ const route = install(providers.trackBackfillProxies());+ for (const hex of ['abc123', 'abc456']) {+ const response = await route('/api/military/track', '?hex=' + hex);+ assert.equal(response.statusCode, 503);+ assert.equal(JSON.parse(response.body).code, 'history_unavailable');+ assert.equal(response.headers['retry-after'], '1800');+ assert.equal(response.headers['cache-control'], 'no-store');+ }+ assert.equal(+ (await route('/api/military/track', '?hex=invalid')).statusCode,+ 400,+ );+});+++ test('global aircraft snapshots coalesce cold and expired callers and clear rejected flights', async (t) => {+ environment(t, { OPENSKY_AUTH_MODE: 'anon' });+ t.mock.method(console, 'warn', () => {});+ t.mock.method(console, 'error', () => {});+ let now = Date.now();+ t.mock.method(Date, 'now', () => now);+ for (const kind of ['opensky', 'military']) {+ const module =+ kind === 'opensky'+ ? await import(+ `../../server/providers/aircraft/opensky.js?coalesce=${Math.random()}`+ )+ : await import('../../server/providers/aircraft/adsb-lol.js');+ const request = install(+ kind === 'opensky' ? module.openSkyProxy() : module.adsbLolProxy(),+ );+ const route = kind === 'opensky' ? '/api/flights' : '/api/military';+ let calls = 0;+ let release;+ let blocked;+ let fail = false;+ t.mock.method(globalThis, 'fetch', async () => {+ calls++;+ await blocked;+ if (fail) throw new Error('fixture connection failed');+ return Response.json(+ { time: now / 1000, states: [], ac: [] },+ { headers: { 'x-rate-limit-remaining': '5000' } },+ );+ });+ for (const phase of ['cold', 'expired', 'failed', 'recovered']) {+ now += 13000;+ fail = phase === 'failed';+ blocked = new Promise((resolve) => {+ release = resolve;+ });+ const before = calls;+ const pending = Array.from({ length: 5 }, () => request(route));+ await new Promise(setImmediate);+ assert.equal(calls - before, 1, `${kind} ${phase}: one refresh starts`);+ release();+ const responses = await Promise.all(pending);+ assert.equal(calls - before, fail && kind === 'opensky' ? 2 : 1);+ assert.ok(responses.every((res) => res.statusCode === 200));+ assert.ok(responses.every((res) => res.body === responses[0].body));+ }+ }+ });++ test('OpenSky 5xx retains dated last-good data, cancels error bodies and cools down before recovery', async (t) => {+ environment(t, { OPENSKY_AUTH_MODE: 'anon' });+ let now = Date.now();+ t.mock.method(Date, 'now', () => now);+ for (const status of [502, 503, 504]) {+ const module = await import(+ `../../server/providers/aircraft/opensky.js?server-error=${status}`+ );+ const request = install(module.openSkyProxy());+ let fail = false;+ let calls = 0;+ let cancelled = false;+ t.mock.method(globalThis, 'fetch', async () => {+ calls++;+ if (fail)+ return new Response(+ new ReadableStream({+ cancel() {+ cancelled = true;+ },+ }),+ { status },+ );+ return Response.json(+ { time: now / 1000, states: [] },+ { headers: { 'x-rate-limit-remaining': '5000' } },+ );+ });+ const good = await request('/api/flights');+ now += 10000;+ fail = true;+ const stale = await request('/api/flights');+ assert.equal(stale.statusCode, 200);+ assert.equal(stale.body, good.body);+ assert.equal(stale.headers['x-opensky-cache'], 'STALE');+ assert.equal(+ stale.headers['x-opensky-auth-reason'],+ `upstream_http_${status}_serving_stale`,+ );+ assert.equal(stale.headers['x-opensky-stale-seconds'], '10');+ assert.equal(cancelled, true);+ const cooling = await request('/api/flights');+ assert.equal(cooling.body, good.body);+ assert.equal(+ cooling.headers['x-opensky-auth-reason'],+ `upstream_http_${status}_serving_stale`,+ );+ assert.equal(calls, 2);+ now += 16000;+ fail = false;+ assert.equal(+ (await request('/api/flights')).headers['x-opensky-cache'],+ 'MISS',+ );+ assert.equal(calls, 3);+ }+ const coldModule =+ await import('../../server/providers/aircraft/opensky.js?cold-server-error');+ let calls = 0;+ t.mock.method(globalThis, 'fetch', async () => {+ calls++;+ return new Response('<html>failure</html>', { status: 503 });+ });+ const cold = install(coldModule.openSkyProxy());+ for (let i = 0; i < 2; i++) {+ const response = await cold('/api/flights');+ assert.equal(response.statusCode, 503);+ assert.match(JSON.parse(response.body).error, /OpenSky/);+ }+ assert.equal(calls, 1);+ });