Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

Merge current upstream and resolve PR 581 conflicts

Michael Johnston44a2083d7bf5
diff --cc CHANGELOG.md
index d52bd0718,39cf9b524..563ac4319
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,6 -1,107 +1,111 @@@
# Changelog
- - Bound the remaining upstream body reads (FIRMS, CelesTrak, adsb.lol, TomTom, OpenSky, adsbdb) with streaming size caps and shared deadlines; the adsb.lol military and OpenSky `states/all` polls gain deadlines of their own.
+ ## [Unreleased]
+
++- Bound the remaining upstream body reads (FIRMS, CelesTrak, adsb.lol,
++ TomTom, OpenSky, adsbdb) with streaming size caps and shared deadlines; the
++ adsb.lol military poll gains a deadline of its own.
++
+ ## [0.2.1] — 2026-10-02 — God's Eye View through Your Agent (with security fixes and other features)
+
+ - Ship each bundled data pack once. The region, marine, admin-boundary,
+ county, military-name and neighborhood packs were emitted twice by the
+ production build, as the JSON the browser fetches and as an unused
+ JavaScript copy; `dist/` drops from 54 MB to 42 MB. Under Node the loader
+ reads the JSON file directly (reporting that Node 24.14 or newer is needed
+ on a runtime too old to do so), and a test keeps app code from importing a
+ pack as a module.
+
+ - Apply the Host check before the app's own routes. Vite installs its Host
+ check after the middleware that plugins add, so the provider and `/api`
+ routes used to answer any Host, including a DNS-rebinding name, in every
+ mode. A first-running middleware now applies the same allowed hosts on the
+ dev and preview servers.
+
+ - Refuse cross-site browser requests to the cost-bearing and log endpoints
+ (`/api/realtime/token`, `/api/openai/hud-summary`,
+ `/api/google/nearby-places`, `/api/google/text-search`,
+ `/api/realtime/debug-log`): a foreign or opaque
+ Origin, a cross-site `Sec-Fetch-Site`, or proxy forwarding headers get 403,
+ while loopback tools and LAN use keep working. The dev and preview servers
+ send one shared Content-Security-Policy (James Sumpter, #242).
+
+ - The voice debug log records the server's own time: a record can no longer
+ supply its `loggedAt`. The dev and preview servers also send
+ `X-Content-Type-Options: nosniff` (findings by Sunil, #710).
+
+ - Keep the Host-header check when binding to all interfaces. `HOST=0.0.0.0`
+ used to accept any Host; the dev and preview servers now accept IP
+ addresses, `localhost` and the LAN hostnames listed in `GEV_ALLOWED_HOSTS`
+ (suffix and wildcard entries are ignored), which also keeps DNS-rebinding
+ names out in LAN mode. The `.local` suffix is no longer accepted by default;
+ list such a name explicitly (Puspo Aditya, #97, fixes #21).
+
+ - Throttle the cost-bearing proxies by default instead of on request. The
+ OpenAI endpoints (`/api/realtime/token`, `/api/openai/hud-summary`) now allow
+ 30 requests per minute per client IP and the Google Places endpoints
+ (`/api/google/nearby-places`, `/api/google/text-search`) 120 — the caps the
+ Pinokio build already ships, so the packaged app is unaffected and only an
+ unconfigured server changes, from unlimited to what the product already runs
+ with. `GEV_RATELIMIT_OPENAI_PER_MIN` and `GEV_RATELIMIT_GOOGLE_PER_MIN` still
+ override the caps, and exactly `0` disables them; a value that cannot be read
+ as a number now falls back to the default rather than to unlimited, so a typo
+ cannot silently disarm the guard (daikaginza, #683).
+
+ - Tighten the local MCP server and embed mode. The panel's `panel_request`
+ needs the key in its MCP server's panel page, and refuses Provider
+ Settings, credential and model endpoints, `/mcp` and development server
+ routes in any letter case, encoding or dot suffix; panels on one server share six
+ requests in flight, and further requests wait their turn. `/mcp` applies Provider Settings' proxy and sharing checks,
+ requires a Host on the port it reached and an Origin from that host, and
+ times out request bodies after 30 seconds; stdio honors
+ `notifications/cancelled`. Embed mode is no longer framable unless
+ `GEV_EMBED_FRAME_ANCESTORS` allows the framing page, and view answers go
+ only to the origin that sent the view. SECURITY.md describes the MCP surface
+ and the panel's browser keys.
+
+ - Cockpit now enters on the existing matching map style while keeping one fixed,
+ duplicate-free carousel over `Normal / CRT / NVG / FLIR / Anime / Noir / Snow`.
+ Normal remains a real unfiltered option; Cockpit-only choices still restore
+ the captured map style through both Exit Cockpit and Reset.
+ - Cyber's compact right-rail and Cockpit utility buttons now center their glyphs
+ vertically and share the same inset and edge alignment.
+ - Keep Cyber Voice help/error popups and Location/Visual Presets pins clear of
+ their decorative frames. Leave space above attribution for its full logo row.
+ - Add an intentionally future-facing, opt-in panel surface contract for new
+ panels to inherit compatible Normal, Cyber and Cockpit styling. Its first
+ production adopter will land separately after this change.
+ - Restore the user's previous visual preset when they explicitly switch from
+ Cyber to another HUD layout, without overriding scene or shared-link state.
+ - Move the aligned Cyber side-panel rails upward on desktop so the left stack
+ clears the lower coordinate card; keep Cockpit's independent visor layout.
+
+ ## [0.2.0] — 2026-10-02 — God's Eye View through Your Agent
+
+ - Show God's Eye View inside AI conversations. Answers that can be shown
+ include a view (camera, layers, style, map, marks, something to follow),
+ and `show_in_gods_eye_view` displays it as the live globe in clients that
+ support MCP Apps, such as Claude Desktop and the Codex and ChatGPT desktop
+ apps, and as a link everywhere else. The panel loads the app's panel build
+ (`npm run build:panel`) and its data through the MCP server, so a local
+ server needs no HTTPS or tunnel. `?embed=1` shows the globe alone for pages
+ that frame the app.
+
+ - Add tools for language-model clients and a local MCP server, served over
+ stdio by `npm run mcp` and over HTTP at `/mcp` on the development and preview
+ servers for local requests only. `npm run mcp`
+ serves earthquake, active-fire, launch, aircraft, ship, satellite, camera, radio,
+ place, routing, bike-share, transit, traffic, weather, cyclone, fire-perimeter,
+ terrain, installation and map-feature queries, plus a situation brief, over
+ stdio to clients such as Claude Code, reading
+ from a running app. Tools are defined
+ once in `gods-eye-view/tools`, reuse the layers' source factories, and are
+ exposed through the protocol adapter in `gods-eye-view/tools/mcp`. The
+ catalog also covers weather maps, wind, recent imagery, submarine cables,
+ license plate reader cameras, datacenters and dams, the Bhote Koshi flood,
+ military awareness and links that open the app over an area with layers on.
+ Voice offers the same queries next to its app actions.
+
- Public Overpass instances are no longer used by default. Street Traffic
roads come from TomTom flow tiles, OpenFreeMap vector tiles, or both, chosen
on the layer row (TomTom / OSM / Hybrid) or with `?trafficRoads=`. With a
diff --cc docs/CURRENT-STATE.md
index 29ea05f23,f7530d789..78135e7a9
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@@ -895,26 -962,6 +962,25 @@@ feed address is read from the path, an
streaming. The 12-second deadline includes reading the body, and rejected or
stalled downloads are cancelled. Development and preview use the same handler.
+## Upstream body bounds
+
+FIRMS CSV, CelesTrak TLE groups, adsb.lol military responses, TomTom flow
+tiles, OpenSky states/all and adsbdb lookups now read their bodies through the
+shared streaming readers in `src/sources/httpBody.js`, so a declared or observed body
+over the cap is refused with `RESPONSE_TOO_LARGE` and cancelled rather than
+buffered. `readResponseBytesCapped` accepts the same optional abort signal as
+the text reader and cancels a body still streaming when it fires; TomTom flow
+tiles use it alongside GTFS-Realtime. Caps are bounds, not budgets, sized well
+above measured payloads: FIRMS 64 MiB per satellite source, CelesTrak 16 MiB
+per group, OpenSky `states/all` 8 MiB, adsb.lol `/v2/mil` 8 MiB, TomTom tiles
+8 MiB and adsbdb lookups 1 MiB. Where a route already had a deadline (FIRMS
- 60 s, CelesTrak 20 s, TomTom 15 s, adsbdb 8 s) that deadline now covers the
- body read as well as the headers. Two polls that had no deadline gain one: the
- adsb.lol military poll waits at most 12 seconds, and the OpenSky `states/all`
- exchange, including its Basic-auth retry, at most 20. A rejected or timed-out
- body is an upstream miss and follows each route's existing error and
- cached-data paths. FIRMS map-key status, the OpenSky token exchange and CCTV
++60 s, CelesTrak 20 s, TomTom 15 s, adsbdb 8 s, and each 10 s OpenSky
++`states/all` attempt) that deadline now covers the body read as well as the
++headers. The adsb.lol military poll, which had no deadline, now waits at most
++12 seconds. A rejected or timed-out body is an upstream miss and follows each
++route's existing error and cached-data paths. FIRMS map-key status, the OpenSky token exchange and CCTV
+media keep their current handling.
+
## Remaining local service modules
Overpass query validation, geometry simplification, disk caching and upstream
diff --cc server/providers/aircraft/opensky.js
index f1ded6401,db4920668..4da586fff
--- a/server/providers/aircraft/opensky.js
+++ b/server/providers/aircraft/opensky.js
@@@ -26,6 -25,36 +26,41 @@@ let _openskyCacheMeta = null
let _openskyCacheSourceEpochMs = null;
/** TTL for the OpenSky response cache (ms). */
const OPENSKY_CACHE_MS = 9000;
+ /** Per-attempt limit for the global snapshot; it normally arrives in ~1.5 s. */
+ const OPENSKY_ATTEMPT_TIMEOUT_MS = 10_000;
+ const OPENSKY_STATES_URL =
+ 'https://opensky-network.org/api/states/all?extended=1';
++/** states/all?extended=1 measures ~0.8 MB anonymously; bounded, not budgeted. */
++const OPENSKY_STATES_MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
+
+ /**
+ * Fetch and read the global snapshot, giving each attempt
+ * OPENSKY_ATTEMPT_TIMEOUT_MS and retrying once when an attempt times out or
+ * the connection fails. A second failure throws, which the proxy answers
+ * from its stale cache or the regional fallback.
+ * @param {Record<string, string>} headers Request headers.
+ * @returns {Promise<{upstream: Response, body: string}>}
+ */
+ async function fetchOpenSkyStates(headers) {
+ for (let attempt = 1; ; attempt++) {
+ try {
- const upstream = await fetch(OPENSKY_STATES_URL, {
- headers,
- signal: AbortSignal.timeout(OPENSKY_ATTEMPT_TIMEOUT_MS),
- });
- return { upstream, body: await upstream.text() };
++ const signal = AbortSignal.timeout(OPENSKY_ATTEMPT_TIMEOUT_MS);
++ const upstream = await fetch(OPENSKY_STATES_URL, { headers, signal });
++ const body = await readResponseTextCapped(
++ upstream,
++ OPENSKY_STATES_MAX_RESPONSE_BYTES,
++ signal,
++ );
++ return { upstream, body };
+ } catch (error) {
+ if (attempt >= 2) throw error;
+ console.warn(
+ '[OpenSky] global snapshot attempt failed, retrying:',
+ error?.message || error,
+ );
+ }
+ }
+ }
// --- OpenSky credit governor (field-test fix 2026-07-06) -------------------
// The global /states/all this proxy fetches costs 4 CREDITS per call against
// OpenSky's ~4000/day authenticated budget — a day with the app open burned