mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
A sweep for the same pattern found more answers presented as current and complete: launches and satellite orbits served from a stale proxy cache, a regional aircraft fallback read as worldwide, license plate cameras trimmed or partly loaded, and a radio directory of popular stations read as every station. The launch and satellite sources now report the proxies' stale markers, and each answer says what it covers.
29 lines
905 B
JavaScript
29 lines
905 B
JavaScript
const GROUPS = new Set([
|
|
'stations',
|
|
'visual',
|
|
'gps-ops',
|
|
'glo-ops',
|
|
'galileo',
|
|
'geo',
|
|
'starlink',
|
|
]);
|
|
|
|
/** Read catalog text from the existing group endpoint using a supplied transport. */
|
|
export function createSatelliteSource({
|
|
fetchImpl = (...args) => globalThis.fetch(...args),
|
|
} = {}) {
|
|
return {
|
|
async readGroup(group, { signal } = {}) {
|
|
if (!GROUPS.has(group)) throw new TypeError('Unknown satellite group');
|
|
signal?.throwIfAborted();
|
|
const response = await fetchImpl(`/api/celestrak/${group}`, { signal });
|
|
const text = response.ok ? await response.text() : '';
|
|
signal?.throwIfAborted();
|
|
// The proxy serves its last copy, marked STALE-ERROR, when CelesTrak
|
|
// is down.
|
|
const stale = response.headers?.get?.('x-tle-cache') === 'STALE-ERROR';
|
|
return { ok: response.ok, status: response.status, text, stale };
|
|
},
|
|
};
|
|
}
|