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 upstream/main into fix/363-geocode-proxy

Said Turksever1fffdf760004
diff --cc CHANGELOG.md
index deed955ef,30d9e5c14..72019bd6b
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,7 -1,268 +1,277 @@@
# Changelog
+ - Snow flakes sway within a fixed range instead of drifting sideways faster the
+ longer the app runs; the Wind setting still scales the sway.
+
+ - The right rail ignores panels that other CSS hides, such as during an event
+ view, so they no longer force one-panel-at-a-time layout or collapse visible
+ panels. Panels the rail collapses itself are still restored.
+
+ - Coordinate searches refuse empty latitude or longitude components instead of navigating to an unintended location.
+
+ - Bing Aerial and Bing Labels request HTTPS tiles on HTTP localhost through
+ their ion-backed providers, retaining ion and per-tile attribution without
+ widening the Content Security Policy.
+
+ - Add New York City traffic cameras from the NYC DOT Traffic Management Center
+ as an opt-in CCTV pack. NYC DOT requires a data-sharing agreement for the
+ camera feed, so the pack is off unless `CCTV_NYC_ENABLED=1` is set by an
+ operator who holds one; otherwise no request reaches NYC DOT. NYC DOT's
+ requested disclaimer is in the Data attribution popover. The camera list is one keyless JSON request to
+ `webcams.nyctmc.org/api/cameras`; frames are stills synthesized from each
+ camera UUID on that same host, so a catalog field cannot steer the proxy
+ off-host. Offline cameras are dropped. Once enabled, the 250 cameras nearest
+ the five borough cores load and `CCTV_NYC_MAX_SOURCES` changes the cap. The catalog-wide ceiling is
+ unchanged; extra cameras share it round-robin with the other packs.
+
+ - Street Level counts unique tiles before ranking so overlapping dateline halves
+ in polar views do not waste slots in the 16-tile overview budget.
+
+ - Directions no longer shows a truncation notice for a route with exactly 200
+ turns, and a roundabout at the 200th turn keeps its exit distance.
+
+ - Weather records keep missing conditions unknown and refuse summaries without a measured temperature.
+
+ - Tool string length validation counts Unicode characters correctly, including characters outside the basic multilingual plane.
+
+ - Director timeline seeks cross the dateline along the short longitude arc.
+
+ - Map state updates stop delivering to subscribers removed during the same notification.
+
+ - Director assets cancelled during the final stream read are discarded with reader cleanup.
+
+ - Analyst queries preserve useful rows when an upstream timestamp is outside the supported date range.
+
+ - Fire detections with missing or impossible positions are skipped while genuine zero coordinates remain valid.
+
+ - Frequently reused terrain batches retain their cached heights ahead of unused cells.
+
+ - Recent Imagery’s exported `setBox` and `searchHls` reject missing, blank or
+ boolean programmatic box edges instead of interpreting them as zero coordinates.
+
+ - Treat explicitly current, complete empty vessel coverage as a successful update,
+ clearing obsolete contacts while retaining stale or incomplete snapshots.
+
+ - Custom Street Level provider switches survive share links and stored state
+ using URL-safe stable provider IDs and a shared boolean-switch codec; existing
+ Mapillary links keep their meaning. Explicit provider toggles reach durable
+ state without adopting unrelated live switch changes.
+
+ - Directions and Recent Imagery accept replaceable acquisition sources, including
+ route transport, imagery catalog, thumbnails, tile templates and attribution.
+ Explicitly removing either source leaves its layer unavailable; standalone
+ defaults preserve the existing providers.
+
+ - Catalog source availability no longer modifies layer objects; unavailable
+ tooltips use layer display names.
+
+ - Street Level with no providers uses the shared unavailable state and refuses
+ activation before initialization, while keeping its layer identity visible.
+
+ - Application source configuration accepts replacements and explicit removal.
+ Missing catalog feeds leave their layers unavailable without blocking startup
+ or making fallback requests; malformed supplied feeds remain configuration errors.
+
+ - Street Level providers are optional in application composition. Omitting a
+ Mapillary source no longer prevents startup; callers can inject a different
+ provider list or an empty list without changing layer identities or share links.
+
+ - Vector tile sources take their allowed tile origin from the configured
+ `tileJsonUrl`, so repointing only that URL at a mirror loads tiles from the
+ mirror or fails visibly instead of silently using OpenFreeMap. Thanks to
+ [daikaginza](https://github.com/daikaginza) (#935).
+
+ - MCP setup examples use the app's default port, `4173`. Thanks to
+ [Huanyi Xie](https://github.com/xiehuanyi) (#934) and
+ [shirunjies8-png](https://github.com/shirunjies8-png) (#959) for the same fix.
+
+ - Voice revisits numbered analyst records through current layer snapshots and
+ preserves resolved pin coordinates. Requested analyst lists and rankings can
+ speak returned items alongside the exact count and coverage caveats. Failed
+ actions settle the voice card without reviving cancelled turns. Coverage
+ benchmarks reject invalid calls before accepting semantic matches.
+
+ - Street Level is included in the voice layer manifest for visibility toggles;
+ imagery is not exposed as countable analyst records.
+
+ - Voice debug logs omit complete tool-result bodies and serialized function
+ outputs by default, including location queries and generated spoken replies.
+ `GEV_VOICE_LOG_CONTENT=1` retains them for explicit content debugging.
+
+ - Unqualified Alps searches use the bundled European range for navigation
+ and annotations instead of a same-named peak returned by a geocoder.
+ Coordinates, supplied presets and geographically qualified place names
+ keep their precedence; annotation proximity and containment guards remain.
+ - Contacts analyst follow-ups retain the snapshot's distance ranking rather
+ than switching to the camera. Requested radii and explicit scopes remain
+ authoritative, and a request for a list still requires an analyst query.
+ Analyst speech names stale or degraded feeds and withholds authoritative
+ counts when unavailable. The existing NOTES disclosure preserves complete,
+ deduplicated coverage and source caveats, including crowded results.
+ - The voice card shows analyst counts ("At least 250,000 aircraft …") with
+ their scope, feed window and caveats, and marks partial answers. Analyst
+ speech uses the same deterministic headline, preserves lower bounds and says
+ when an answer is partial. Follow-ups retain unanswered-layer coverage, and
+ keep the original scope label when they narrow a remembered result.
+ Contacts-window answers read one immutable panel snapshot, mark a 20,000-row
+ layer cap as a lower bound, and commit that displayed cohort only after
+ cancellation checks pass. Concurrent analyst calls from one model response
+ remain independent; a stopped or replaced user turn still cancels them.
+ - Voice answers are shorter and fill slow work instead of going silent. Slow
+ or multi-step requests may open with one short spoken plan; instant ones
+ just happen. Tool results carry a code-built `say` line and a `display`
+ card: sources and notes stay on screen, a caveat is spoken only when it
+ changes the answer, and "at least" and partial answers are always said. A card above the mic shows captions, the plan's steps and the
+ result. When a tool that reports steps (layers, place lookups, outlines,
+ nearest-aircraft) is still running after 1.5 s its current step is spoken
+ once; others say "still working" once after 8 s. A soft
+ tick plays in push-to-talk. Holding Space while the assistant talks cuts it
+ off. Each turn writes latency and speech figures to the debug log
+ (`node scripts/voice-turn-spans.mjs`). Captions of what you say are
+ counted in the voice cost meter; the debug log leaves out what was said
+ unless `GEV_VOICE_LOG_CONTENT=1`.
+ - Point and ask: hold Space with the cursor on an aircraft, ship or spot on
+ the map and say "what's that", "track that one" or "how many flights
+ around here". A reticle marks the point and the voice card shows what
+ "this" meant. In open mic it works when you have just moved the cursor
+ there. "The second one" picks from the last numbered list. Asking about
+ "the last one" resolves to the last of the five rows actually shown, and
+ referent-only tracking calls are accepted while empty targets are rejected.
+ Asking about
+ bare ground up close gives the assistant a small crop of the map around the
+ point. A slow render gets one bounded second frame request, while hidden,
+ stale, moved-camera, invalid and oversized captures still fail closed.
+
## [Unreleased]
+ - Flights and Military Flights highlight emergency transponder broadcasts in
+ fleet billboards, 3D models and Cockpit contacts. Colors update when a status
+ starts or clears. Emergency squawks outrank ADS-B priority statuses; GEV
+ reports minimum fuel and lifeguard without red tint. Cockpit names the code
+ or ADS-B status, and analyst/voice results retain broadcast provenance and
+ the latest known contact time. One omitted ADS-B status poll during a source
+ switch may retain the previous status if the squawk is unchanged; an explicit
+ clear takes effect immediately. Broadcasts are not confirmed incidents.
+ Contributed by [Leo Pechnicki](https://github.com/leopechnicki) (#856).
+
+ - Street Level: KartaView is the third provider, keyless. Light its chip
+ (purple; off by default, one provider at a time) and zoom in below about
+ 6 km: the lines are the streets KartaView has photos of (z13–14 tiles from
+ `api.kartaview.org`). A click on a line opens the photo nearest the click
+ without moving the camera, flat or 360° (a small WebGL panorama: drag to
+ look, wheel to zoom), with cones along its drive and ‹ › / ← → to step
+ through it. The caption links to the full-size photo (KartaView's photo
+ pages fail for signed-out visitors), and the globe credits "© KartaView
+ contributors, CC BY-SA 4.0". Share links carry it in the provider
+ switches (`0.m.0_0.r.google-0*kartaview-1`). Archived photos (KartaView
+ answers 409) are skipped by the click and by ‹ ›. Shift+← →, ↑ ↓, + − and
+ pinch look around a 360° photo. The open photo's marker is a purple view
+ cone pointing along the drive (KartaView's own compass headings are often
+ 0 or far off). The IMAGERY (ALL / 360° / FLAT) and SINCE filters apply to
+ KartaView as to Mapillary: its lines are filtered by KartaView's own
+ server (its filtered PNG tiles, as a mask over the JSON lines), and the
+ photo a click opens, and the cones, by each photo's projection and upload
+ date. KartaView's SINCE is the upload date (all its server can filter by);
+ a note under the slider says so while KartaView is lit (`sinceBasis:
+ 'upload'` in the provider contract).
+ Mapillary's line coverage and sequence cones are now shared by both
+ (`lineCoverage.js`, `sequenceCones.js`).
+
+ - Street Level: Google Street View is the second provider. On the Google 3D
+ map (Google's terms keep it off other maps), light its chip (off by
+ default: every panorama is billed to the Google Maps key, which needs the
+ Maps JavaScript API) and click a street, or press OPEN STREET VIEW, to
+ open Google's own panorama in
+ the panel, with its arrows, the address and month in the caption, a link
+ to Google Maps and FOLLOW. Share links carry it in the provider switches
+ (`r.google-1`). One provider is lit at a time (lighting one switches the
+ other off), Mapillary by default since it is free. Street View's panoramas
+ are all 360°, so the IMAGERY and SINCE filters and the legend apply to
+ Mapillary only and hide while GOOGLE STREET VIEW is lit; its globe marker
+ is a Google-blue view cone.
+
+ - Add an experimental ChatGPT/Codex OAuth option for cloud voice in Provider
+ Settings. API-key voice remains the default. Local sign-in can start from
+ the auth button and reports completion, failure, timeout, or expired
+ credentials. OAuth credentials stay on the server; local routes require
+ loopback access and same-site requests. OAuth sessions retain usage data
+ and show unknown cost; caption transcriptions are counted rather than
+ priced into the API-key cap. The auth button keeps keyboard focus after a
+ mode change, and pending sign-in does not discard text in the key fields.
+ Thanks to [Shayan Khan](https://github.com/devv-shayan) for #621 and
+ [TheSmokeDev](https://github.com/TheSmokeDev) for the credential handling
+ from #653.
+
+ - Stdio servers from one install share a panel key so a page read from one
+ process can make requests through another. Concurrent malformed-key repairs
+ now select one winner; unavailable storage or a busy repair retains the
+ logged per-process fallback. Thanks to [Jibran Tahir](https://github.com/jibraaan)
+ for #958, [MarvinNL046](https://github.com/MarvinNL046) for the report and
+ proposed diagnosis in #927, and [kvnloo](https://github.com/kvnloo) for identifying
+ the repair race. Windows/Claude Desktop Cowork confirmation remains outstanding.
+
+ - Street Level: a street-level imagery layer modelled on the iD editor's photo
+ overlay, with Mapillary as its first provider (free client token, CC BY-SA 4.0
+ imagery). One right-rail panel holds a chip per provider, shared 360°/flat and
+ captured-since filters, and an embedded viewer with EXPAND, FIT/FILL and
+ FOLLOW (Google 3D only). Coverage lines and image cones are drawn from orbit
+ down to a single street; on Google 3D they sit on the bare earth, refined
+ against the rendered mesh near the camera, so trees and buildings hide them.
+ Share links carry the provider switches, the filters and the panel's collapsed
+ state. A server proxy caches Mapillary coverage tiles (24 h, 1 GiB on disk),
+ refuses cross-site requests, rate-limits per IP and backs off when Mapillary
+ rejects the token or rate-limits.
+
+ - The CCTV and Street Level panels are portable: drag the header to float the
+ panel, resize it from any edge or corner, and double-click the header to dock
+ it again. The position persists across reloads.
+
+ - Add Norway's road cameras from Statens vegvesen as a CCTV pack. The camera
+ list is one keyless GeoJSON request to the agency's OGC API view of its
+ DATEX 3.1 CCTV table, so no DATEX account is needed. Every working camera
+ loads (~850; faulty ones are dropped) under one "Norway" category, and the
+ ~135 working cameras that publish HLS play as live video through the existing in-memory
+ relay with the still as fallback. Frames and manifests are pinned to each
+ camera's own path on the agency hosts. `CCTV_VEGVESEN_ENABLED=0` disables
+ the pack, `CCTV_VEGVESEN_MAX_SOURCES` caps it (keeping cameras nearest the
+ largest cities) and `CCTV_VEGVESEN_VIDEO=0` keeps stills only. Attributed
+ under NLOD 2.0.
+
+ - Import your own GeoJSON, KML, KMZ and GPX files from DISPLAY or by dropping
+ them onto the app. Show, hide, fly to or remove each file for the session.
+ GeoJSON/GPX draw on the ground; KML retains its styles and explicit heights.
+ Large repeated-style exports use shared local pins, while recorded track
+ vertices and segment gaps stay intact. Imports respect newer camera gestures,
+ leave the shared clock alone, and report malformed or oversized files.
+ File bytes stay on the device; rendered overlays may appear in shared map
+ screenshots. Thanks to [Chase Mills](https://github.com/kapturner) (#925).
+
+ - GNSS Integrity (Events, voice-addressable, share token `3`) draws navigation
+ accuracy scores from a keyless regional adsb.lol sample; aircraft-level analyst
+ queries are unavailable for these aggregate cells. Cells do not intercept
+ map clicks. Pan/zoom refreshes automatically; feed failures retain the display
+ and explain the next retry. Aircraft-reported quality includes MLAT-positioned
+ contacts after GPS loss, excludes TIS-B/MLAT-derived quality, and locates GPS-loss
+ evidence at the last good GNSS position when available. Scores discount one
+ bad aircraft per cell and retain 30 minutes of visited-view evidence; they
+ do not confirm jamming. See [method and limits](DATA_SOURCES.md#gnss-integrity).
+ Contributed by [Leo Pechnicki](https://github.com/leopechnicki) (#855).
+
+ - Live HLS cameras play on a page opened over plain HTTP from another machine
+ (`HOST=0.0.0.0`). The client lease id came from `crypto.randomUUID`, which
+ browsers only expose in secure contexts, so starting a live feed threw
+ before playback. The id now falls back to a v4 UUID built from
+ `crypto.getRandomValues`, which the server's lease check accepts.
+
++- Move Google geocoding behind the local server. Forward and reverse lookups now
++ go through `/api/google/geocode` and `/api/google/reverse-geocode` with the
++ server key, joining Places and Street View. Google's Geocoding web service
++ refuses referrer-restricted keys, so the previous browser call left
++ `SECURITY.md`'s advice and working search mutually exclusive: the bundled
++ browser key had to be unrestricted for search to work at all. That key now
++ needs only the Map Tiles API and the Maps JavaScript API (Street View). Keyless sessions and the Photon/Nominatim
++ fallback order are unchanged.
++
## [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,
diff --cc SECURITY.md
index aae22d50f,664a3e6d5..bf88cafb7
--- a/SECURITY.md
+++ b/SECURITY.md
@@@ -18,20 -18,22 +18,22 @@@ The golden rule: **secret-bearing API k
| Key | Where it lives | How the browser uses it |
|-----|----------------|--------------------------|
| `OPENAI_API_KEY` | Server only | Browser fetches a short-lived **ephemeral** Realtime session token from `/api/realtime/token`; the real key never ships |
+ | ChatGPT sign-in through Codex (optional, experimental) | Codex's own `auth.json` (`CODEX_HOME`, default `~/.codex`); GEV reads it server-side and never writes or refreshes it | Only after **USE CHATGPT OAUTH** is selected in Provider Settings: the server mints the same ephemeral Realtime token with the ChatGPT access token, for loopback clients only |
| `AISSTREAM_API_KEY` | Server only | Server holds the AISStream websocket; browser polls the same-origin `/api/vessels` cache |
| OpenSky OAuth (`OPENSKY_CLIENT_ID/SECRET`) | Server only | Server mints + refreshes the token behind `/api/flights` |
-| `GOOGLE_MAPS_SERVER_API_KEY` (optional, #33) | Server only | Server calls Places (`/api/google/nearby-places`, `/api/google/text-search`) and the Street View fallback with this key; falls back to `GOOGLE_MAPS_API_KEY` when unset |
+| `GOOGLE_MAPS_SERVER_API_KEY` (optional, #33) | Server only | Server calls Places (`/api/google/nearby-places`, `/api/google/text-search`), Geocoding (`/api/google/geocode`, `/api/google/reverse-geocode`) and the Street View fallback with this key; falls back to `GOOGLE_MAPS_API_KEY` when unset |
- ### Two deliberately client-side keys — restrict them
+ ### Three deliberately client-side keys — restrict them
These are designed to be used directly in the browser (like a Mapbox public token). They are injected into the client bundle via Vite's `define`, so they **will** be visible in browser devtools. Scope and restrict them rather than trying to hide them:
- 1. **Google Maps API key** — loads Photorealistic 3D Tiles directly. **Restrict it** (HTTP referrer + API restriction to the required Google APIs) in the Google Cloud Console. An unrestricted key in a public deployment can be abused and billed to you. Restrict it to the **Map Tiles API only**: a referrer restriction applies to the Maps JavaScript API and the client SDKs, not to the web services, so a key carrying Geocoding under one is refused with `API keys with referer restrictions cannot be used with this API`. Search does not need it — geocoding goes through the server proxies above (#363).
-1. **Google Maps API key** — loads Photorealistic 3D Tiles directly and powers GEV place search and Street View (Maps JavaScript API; add it to the key's API restrictions). **Restrict it** (HTTP referrer + API restriction to the required Google APIs) in the Google Cloud Console. An unrestricted key in a public deployment can be abused and billed to you.
++1. **Google Maps API key** — loads Photorealistic 3D Tiles directly and powers Street View (Maps JavaScript API; add it to the key's API restrictions). **Restrict it** (HTTP referrer + API restriction to the required Google APIs) in the Google Cloud Console. An unrestricted key in a public deployment can be abused and billed to you. Restrict it to the **Map Tiles API and Maps JavaScript API only**: a referrer restriction applies to the Maps JavaScript API and the client SDKs, not to the web services, so a key carrying Geocoding under one is refused with `API keys with referer restrictions cannot be used with this API`. Search does not need it — geocoding goes through the server proxies above (#363).
2. **Cesium ion token** (`CESIUM_ION_TOKEN`, optional — for ion-hosted Google Photorealistic 3D Tiles, Bing world imagery, and world terrain) — used as `Cesium.Ion.defaultAccessToken` client-side. Use a public **`assets:read`** token with **URL restrictions** for any hosted deployment. The Community plan has eligibility and usage limits; a public token is not a secret, but it can still consume the account's quota.
+ 3. **Mapillary client token** (`MAPILLARY_CLIENT_TOKEN`, optional, Street Level) — used by the MapillaryJS viewer and Graph API lookups in the browser, and by the server's coverage-tile proxy. Mapillary client tokens are meant for browser use.
- > The explicit browser `define` block in `build/vite.js` controls exactly what reaches the client: only these two keys. Everything else stays server-side.
+ > The explicit browser `define` block in `build/vite.js` controls exactly what reaches the client: only these three keys. Everything else stays server-side.
- **Places, Geocoding and Street View never needed to be on that list** (#33, #363): they're called from the server-side proxies in the table above, which use `GOOGLE_MAPS_SERVER_API_KEY` when it's set. Splitting it from the browser-exposed key lets each key's Google Cloud restriction actually match what it does — the browser key referrer-restricted to Map Tiles, the server key IP-restricted (never a referrer, since it never leaves your server) to Places + Geocoding + Street View Static — instead of one key that has to be either over-permissioned or broken for one of its jobs. A single shared `GOOGLE_MAPS_API_KEY` still works if you don't split them, but then it cannot carry a referrer restriction at all: the web services refuse one, and search would be the half that breaks.
-**Places and Street View never needed to be on that list** (#33): they're called from the server-side proxies in the table above, which use `GOOGLE_MAPS_SERVER_API_KEY` when it's set. Splitting it from the browser-exposed key lets each key's Google Cloud restriction actually match what it does — the browser key referrer-restricted to the APIs the client loads, the server key IP-restricted (never a referrer, since it never leaves your server) to Places + Street View Static — instead of one key that has to be either over-permissioned or broken for one of its two jobs. A single shared `GOOGLE_MAPS_API_KEY` still works if you don't split them; it just has to cover every API both sides use.
++**Places, Geocoding and the Street View Static fallback never needed to be on that list** (#33, #363): they're called from the server-side proxies in the table above, which use `GOOGLE_MAPS_SERVER_API_KEY` when it's set. Splitting it from the browser-exposed key lets each key's Google Cloud restriction actually match what it does — the browser key referrer-restricted to Map Tiles + Maps JavaScript API, the server key IP-restricted (never a referrer, since it never leaves your server) to Places + Geocoding + Street View Static — instead of one key that has to be either over-permissioned or broken for one of its jobs. A single shared `GOOGLE_MAPS_API_KEY` still works if you don't split them, but then it cannot carry a referrer restriction at all: the web services refuse one, and search would be the half that breaks.
Never commit real keys. `.env` is gitignored; only `.env.example` (placeholder names) is tracked. On macOS `dev-fresh.sh` can read keys from the Keychain; plain Vite uses env vars or a local `.env`, and Pinokio uses its ignored app `ENVIRONMENT` file.
diff --cc docs/CURRENT-STATE.md
index 7cab5b563,4b5b0743c..c12f81684
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@@ -3964,24 -4426,7 +4426,24 @@@ Providers normalize coordinates, canoni
bounds. Camera framing, nearby landmark recovery and footprint selection remain
in their consumers, including the Capitol identity/containment safeguards.
Radio keeps localized country names in labels rather than station filters.
-Reverse geocoding and nearby/text-search endpoints retain their existing behavior.
+Nearby/text-search endpoints retain their existing behavior.
+
+**Google geocoding is a server route, not a browser call** (#363). Forward and
+reverse lookups go to `/api/google/geocode` and `/api/google/reverse-geocode`,
+which carry `GOOGLE_MAPS_SERVER_API_KEY` (falling back to `GOOGLE_MAPS_API_KEY`)
+and share the Places routes' opt-in `GEV_RATELIMIT_GOOGLE_PER_MIN` throttle.
+Google's Geocoding **web service** refuses referrer-restricted keys, so the
+previous browser call forced the bundled browser key — visible in devtools by
- design — to be left unrestricted; it now needs the Map Tiles API only. Both
- routes answer in Google's own `status`/`results` shape rather than the Places
- routes' `places: []` contract, because the browser adapters normalize that shape
- directly. The browser key still gates the provider client-side, so a keyless
++design — to be left unrestricted; it now needs only the Map Tiles API and the
++Maps JavaScript API (Street View). Both routes answer in Google's own
++`status`/`results` shape rather than the Places routes' `places: []` contract,
++because the browser adapters normalize that shape directly. The browser key still gates the provider client-side, so a keyless
+session spends no request to learn it has no Google: the route's own keyless
+answer reads as an unanswered provider, which would stop the chain caching the
+negative Photon or Nominatim then produces. Its query is capped at 200
+characters, its reverse coordinates are validated against WGS84 bounds before
+the request is paid for, and a malformed viewport bias is dropped rather than
+refused, since a bias only ranks results.
Only valid answers and definitive misses enter bounded caches; malformed replies,
HTTP refusals and outages remain retryable. Searches share a 12-second total
diff --cc server/providers/places/google-key.js
index a5c54b302,353bc9e24..ff5fe6356
--- a/server/providers/places/google-key.js
+++ b/server/providers/places/google-key.js
@@@ -14,33 -14,12 +14,34 @@@ export function keylessGooglePlacesResp
}
/**
- * Google API key for the SERVER-SIDE calls (Places nearby/text search, the
- * CCTV Street View fallback). These never reach the browser, so this key can
- * be restricted by server IP and scoped to Places API + Street View Static
- * API — while GOOGLE_MAPS_API_KEY stays referrer-restricted to Map Tiles +
- * Geocoding for the browser (#33). Splitting them is opt-in: unset, this
- * falls back to the shared browser key and nothing changes.
+ * Geocoding speaks Google's own response shape rather than the `places: []`
+ * contract its two siblings use, because the browser adapters read `status`
+ * and `results` directly. The keyless capability reads the same way: a status
+ * that is not `OK` and no results, which the adapters already treat as "this
+ * provider did not answer" and pass to the next geocoder in the chain.
+ */
+export function keylessGoogleGeocodeResponse(apiKey) {
+ if (String(apiKey ?? '').trim()) return null;
+ return {
+ statusCode: 200,
+ payload: {
+ configured: false,
+ status: 'REQUEST_DENIED',
+ results: [],
+ error: null,
+ },
+ };
+}
+
+/**
+ * Google API key for the SERVER-SIDE calls (Places nearby/text search,
+ * geocoding, the CCTV Street View fallback). These never reach the browser, so
+ * this key can be restricted by server IP and scoped to Places API + Geocoding
+ * API + Street View Static API — while GOOGLE_MAPS_API_KEY stays
- * referrer-restricted to Map Tiles for the browser (#33, #363). Splitting them
- * is opt-in: unset, this falls back to the shared browser key, which then has
- * to carry every API both sides use and cannot take a referrer restriction.
++ * referrer-restricted to Map Tiles + Maps JavaScript API for the browser
++ * (#33, #363). Splitting them is opt-in: unset, this falls back to the shared
++ * browser key, which then has to carry every API both sides use and cannot
++ * take a referrer restriction.
*/
export function googleServerApiKey() {
return resolveGoogleServerKey(process.env);