diff --git a/.env.example b/.env.example index a9819f100b..a3e2b48167 100644 --- a/.env.example +++ b/.env.example @@ -37,6 +37,8 @@ GOOGLE_MAPS_API_KEY= GOOGLE_MAPS_SERVER_API_KEY= # Per-IP rate limit for the Google Places cost endpoints # (/api/google/nearby-places + /api/google/text-search), in requests per minute. +# The CCTV Street View fallback counts in its own window with the same cap; +# over it, a frame gets the placeholder image instead of a 429. # DEFAULTS TO 120, the value the Pinokio build already ships. Raise or lower it # with a positive integer; 60 is a sensible tightening whenever HOST is not # localhost. Set it to exactly 0 to run unthrottled. An unreadable value (a diff --git a/SECURITY.md b/SECURITY.md index e67186d648..4f55f80cdd 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -68,7 +68,7 @@ browser-key fallback for existing single-key setups. The data proxies under `server/providers/` are written so the browser cannot turn the server into an open relay: -- **No arbitrary-URL fetching.** The CCTV frame proxy fetches only server-registered camera/frame URLs — clients cannot pass an upstream URL to fetch (SSRF mitigation). Other proxies target fixed upstream hosts. +- **No arbitrary-URL fetching.** The CCTV frame proxy fetches only server-registered camera/frame URLs — clients cannot pass an upstream URL to fetch (SSRF mitigation). The key-bearing Street View fallback likewise answers only for a registered camera, at its catalog position; a request sets only the heading, field of view and pitch, never the location. Other proxies target fixed upstream hosts. - **Live HLS is bounded and origin-pinned.** Registered HTTP(S) HLS sources use a Node puller that rejects redirects and off-origin playlist references, bounds playlists to 256 KiB and segment bodies to 8 MiB while streaming, and aborts timed-out or released sessions. At most two sessions retain 12 segments/24 MiB each, plus bounded download buffers. Stores are memory-only and idle sessions expire after 15 seconds. RTMP/ffmpeg execution is not enabled. Locally configured source URLs remain an operator trust boundary. - **Radio is not an audio relay.** `/api/radio/stations` contacts only allowlisted Radio Browser HTTPS hosts and paths, rejects redirects, rejects any hostname with a loopback/private/link-local/metadata/non-public A or AAAA result, and pins each TLS connection to a validated address. It returns normalized public HTTPS stream URLs; `/api/radio/click/:uuid` applies the same destination policy and accepts only station IDs from the current bounded catalog. The browser then connects directly to the broadcaster after an explicit playback action, so the broadcaster sees the listener's IP address. GEV never proxies, caches, records, or redistributes audio. - **Québec 511 video plays in the browser, opt-in and after Play.** With `CCTV_QUEBEC_VIDEO_ENABLED=1`, `/api/cctv/sources` lists, for each MTQ camera, one URL built server-side from its numeric id on `https://www.quebec511.info/Carte/Fenetres/camera.ashx`; the overlay accepts no other host, path or format. The browser loads that clip only after the viewer presses Play for the selected camera, so Québec 511 sees the viewer's IP address, and the panel says so before Play. Selecting a camera by click, auto-hop, a scene or voice never loads it, and switching cameras stops playback. GEV never proxies, caches or reads the video's pixels. With the flag unset (the default) the browser makes no request to Québec 511. @@ -98,7 +98,7 @@ The dev server is a **key broker**: every server-side key above is spendable by - **Local-only by default.** `./scripts/dev-fresh.sh` (and the Vite config itself) bind to `localhost`, so only your machine can reach the server — and only local names are accepted (`allowedHosts` stays restricted, which also blunts DNS-rebinding tricks). Binding to all interfaces keeps that restriction: IP addresses and `localhost` work, and LAN hostnames must be listed in `GEV_ALLOWED_HOSTS` (for example `GEV_ALLOWED_HOSTS=globe.lan`); suffix and wildcard entries are ignored. - **LAN exposure is an explicit opt-in**: `HOST=0.0.0.0 ./scripts/dev-fresh.sh`. The launcher prints a prominent warning plus your LAN URL. Understand what opting in means: **every device on that network can drive the proxies and spend your OpenAI / Google / OpenSky / AISStream / TomTom / FIRMS quota** for as long as the server runs. Do this only on networks you trust. -- **App-level throttles (on by default):** `GEV_RATELIMIT_OPENAI_PER_MIN` (default `30`) and `GEV_RATELIMIT_GOOGLE_PER_MIN` (default `120`) — the values the Pinokio build already ships — cap the cost-bearing endpoints per client IP per minute (over-limit requests receive a sanitized `429`). Typed chat keeps its own per-IP window, set by `GEV_RATELIMIT_OPENAI_CHAT_PER_MIN` and `GEV_RATELIMIT_GEMINI_CHAT_PER_MIN`; left unset, each takes its provider's resolved cap (`GEV_RATELIMIT_OPENAI_PER_MIN`, or `GEV_RATELIMIT_GEMINI_PER_MIN`, default `30`), so lowering a provider throttle lowers chat too, while an explicit chat value, including `0`, wins. Both defaults sit well above what the app itself generates; set either to exactly `0` to run unthrottled. They are **per-IP, process-local, in-memory guards** — they reset on restart, a caller with several addresses gets a bucket per address, and they are **not billing caps**. +- **App-level throttles (on by default):** `GEV_RATELIMIT_OPENAI_PER_MIN` (default `30`) and `GEV_RATELIMIT_GOOGLE_PER_MIN` (default `120`) — the values the Pinokio build already ships — cap the cost-bearing endpoints per client IP per minute (over-limit requests receive a sanitized `429`). The CCTV Street View fallback has its own per-IP window on `GEV_RATELIMIT_GOOGLE_PER_MIN`, separate from the Places and Geocoding one; over it, a frame gets the placeholder instead of a `429`. Typed chat keeps its own per-IP window, set by `GEV_RATELIMIT_OPENAI_CHAT_PER_MIN` and `GEV_RATELIMIT_GEMINI_CHAT_PER_MIN`; left unset, each takes its provider's resolved cap (`GEV_RATELIMIT_OPENAI_PER_MIN`, or `GEV_RATELIMIT_GEMINI_PER_MIN`, default `30`), so lowering a provider throttle lowers chat too, while an explicit chat value, including `0`, wins. Both defaults sit well above what the app itself generates; set either to exactly `0` to run unthrottled. They are **per-IP, process-local, in-memory guards** — they reset on restart, a caller with several addresses gets a bucket per address, and they are **not billing caps**. - **Docker trusts one address, and only because the port is on loopback.** Docker delivers the host's own browser to the container from the container network's gateway, never from `127.0.0.1`, so a loopback-only Provider diff --git a/changelog.d/1549-cockpit-phone-utility-row.md b/changelog.d/1549-cockpit-phone-utility-row.md new file mode 100644 index 0000000000..e3e59d6ea6 --- /dev/null +++ b/changelog.d/1549-cockpit-phone-utility-row.md @@ -0,0 +1,9 @@ +- Keep the phone Cockpit's Display and Radio launchers off the flight + instruments. In the phone layout (720 px wide and below), the collapsed row + of the flight and bridge views now sits centred on the Reset/Exit axis + above the reticle, clear of the destination cue, instead of right-anchored + over the ground speed and altitude readouts. On short landscape phones it + stays on screen and tappable below the vision controls, though it may cover + the top of the readouts. Very short or narrow split-screen windows keep + the old place above Reset/Exit. The first-visit Stories announcement waits until + Cockpit closes (Denis Groshev, @ZloyS, #1549). diff --git a/changelog.d/1602-cctv-streetview-fallback-catalog.md b/changelog.d/1602-cctv-streetview-fallback-catalog.md new file mode 100644 index 0000000000..7180cd9c39 --- /dev/null +++ b/changelog.d/1602-cctv-streetview-fallback-catalog.md @@ -0,0 +1,5 @@ +- The CCTV Street View fallback answers only for cameras the server lists, at + their catalog position; a request sets only the view. Bundled seed cameras + get the placeholder. A per-IP limit on `GEV_RATELIMIT_GOOGLE_PER_MIN` + (default 120) keeps the Google key from serving as an unmetered Street View + service (asturksever, #1602). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 826183c127..7e86dc45a6 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -2025,7 +2025,13 @@ and follows redirects only on the camera's origin. Catalog image URLs, and redirects on those hosts, are pinned by parsed URL to the agency's image directory. Every `/api/cctv` route refuses cross-site browser requests but accepts forwarding headers, so cameras work behind a reverse proxy; a forwarded -request skips the key-bearing Street View fallback and gets the placeholder. +request skips the key-bearing Street View fallback and gets the placeholder. The +fallback answers only for cameras the server lists, at their catalog position, +so position calibration never reaches it. Heading, field of view (clamped to +20–120°) and pitch (clamped to −40–20°) come from the request, else from the +catalog pose. A bundled seed camera, shown when the server catalog is empty, +gets the placeholder. The fallback counts in its own per-IP Google window (see +the cost-bearing proxies below). The CCTV layer draws only the cameras on or near the screen. Zoomed out, a ground cell with two or more cameras shows one marker at their mean position. A @@ -3579,6 +3585,9 @@ unaffected. `GEV_RATELIMIT_OPENAI_PER_MIN` and `GEV_RATELIMIT_GOOGLE_PER_MIN` ov those; exactly `0` disables the limiter, while a value that cannot be read as a number falls back to the default rather than to unlimited. Over-limit requests receive a sanitized `429` with `Retry-After: 5` and never reach the provider. +The CCTV Street View fallback counts in a separate window with the Google cap. +An IPv6 /64 counts as one client. Over the cap, a frame gets the placeholder +image instead of a `429`. Typed chat (`/api/openai/chat`, `/api/gemini/chat`) counts in its own window, set by `GEV_RATELIMIT_OPENAI_CHAT_PER_MIN` and `GEV_RATELIMIT_GEMINI_CHAT_PER_MIN`. Left unset, each takes its provider's resolved cap — `GEV_RATELIMIT_OPENAI_PER_MIN` @@ -5162,9 +5171,20 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > stacking. Narrow mobile Cockpit > viewports suppress the legacy layer stack, peripheral HUD, and secondary > Context/briefing panes so the flight instruments and primary controls remain -> unobstructed. Outside Cockpit, Radio starts collapsed while off and lives -> only in its section inside Context; the detailed panel's normal accordion -> control owns its disclosure and its Enable/Disable action owns power. +> unobstructed. In the phone layout (720 px wide and below) the flight and +> bridge views put the collapsed Display and Radio launchers in one row +> centred on the Reset/Exit axis, above the reticle and clear of the +> destination cue: below the roll arc in portrait, over the arc's lower tick +> ends in landscape. On short landscape screens the row stays +> on screen and tappable below the vision controls but may cover the top of +> the speed and altitude readouts. Windows under 240 px tall, and those under +> 390 px wide and 450 px tall, keep the row above Reset/Exit at the right. +> Satellite and provider views keep the row +> above Reset/Exit at the right, where their own layouts expect it. The +> first-visit Stories announcement waits, unread, until Cockpit closes. +> Outside Cockpit, Radio starts collapsed while off and lives only in its +> section inside Context; the detailed panel's normal accordion control +> owns its disclosure and its Enable/Disable action owns power. > Radio volume in the full and Cockpit surfaces, plus Space Mission > replay speed, use Display / Sharpen's muted 3px rail, circular cyan thumb, > glow, and mono value treatment. Their larger transparent hit areas, keyboard diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index de208048ea..d14cc34ecc 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -583,7 +583,9 @@ "src/data/cctvFootprint.js", "src/sources/cctvTypes.js", "src/sources/httpBody.js", - "src/i18n/marker.js" + "src/i18n/marker.js", + "server/providers/common/rate-limit.js", + "src/sources/rateLimit.js" ], "external": [] }, diff --git a/scripts/qa-cockpit-utility.mjs b/scripts/qa-cockpit-utility.mjs index 3ca0e81773..157592d398 100644 --- a/scripts/qa-cockpit-utility.mjs +++ b/scripts/qa-cockpit-utility.mjs @@ -2050,6 +2050,151 @@ try { JSON.stringify(narrowViewActions), ); + // A fresh profile has not seen the Stories announcement: Cockpit keeps + // it unread and off the phone row until it closes. + const storiesPopupDisplay = () => { + const popup = document.getElementById('hPop'); + return popup ? getComputedStyle(popup).display : null; + }; + const storiesPopupInCockpit = await page.evaluate(storiesPopupDisplay); + check('the unread Stories announcement waits while Cockpit is open', + storiesPopupInCockpit === 'none', String(storiesPopupInCockpit)); + + // Windows too short for the centred row keep it above Reset/Exit. + for (const [width, height] of [[360, 370], [320, 360], [568, 188], [667, 190]]) { + await page.setViewport({ width, height, deviceScaleFactor: 1 }); + const glyphHits = await page.evaluate(async () => { + const manager = window.__godsEyeView.styleManager; + manager._setCockpitDisclosure('display', false); + manager._setCockpitDisclosure('radio', false); + await new Promise(requestAnimationFrame); + await new Promise(requestAnimationFrame); + return [...document.querySelectorAll( + '#cockpit-utility-controls .cockpit-utility-glyph', + )].map((glyph) => { + const box = glyph.getBoundingClientRect(); + const target = document.elementFromPoint( + box.left + box.width / 2, + box.top + box.height / 2, + ); + return target && glyph.contains(target) ? 'ok' : target?.closest('[id]')?.id || null; + }); + }); + check( + `${width}×${height} Cockpit Display/Radio glyph centres reach their own launchers`, + glyphHits.length === 2 && glyphHits.every((hit) => hit === 'ok'), + JSON.stringify(glyphHits), + ); + } + + // The phone row's place in each room: centred on Reset/Exit, on screen, + // tappable, and clear of what that room has space to clear. + for (const [width, height, room] of [ + [360, 740, 'portrait'], + [720, 360, 'landscape'], + [667, 240, 'short'], + [390, 844, 'portrait'], + ]) { + await page.setViewport({ width, height, deviceScaleFactor: 1 }); + const phoneRow = await page.evaluate(async () => { + const manager = window.__godsEyeView.styleManager; + manager._setCockpitDisclosure('display', false); + manager._setCockpitDisclosure('radio', false); + await new Promise(requestAnimationFrame); + manager.cockpitView.syncSignalLayout(); + await new Promise(requestAnimationFrame); + const rect = (element) => element?.getBoundingClientRect().toJSON() || null; + const hud = (selector) => document.querySelector(`#cockpit-hud ${selector}`); + const route = document.getElementById('cockpit-route-direction'); + // A live flight may have no route, which hides the DEST cue. Show it while + // measuring so the clearance check always has a cue to clear. + const wasHidden = route.hidden; + try { + route.hidden = false; + const controls = [...document.querySelectorAll( + '#cockpit-utility-controls .cockpit-utility-control', + )]; + const launchers = controls.map(rect); + const rowLeft = Math.min(...launchers.map((launcher) => launcher.left)); + const rowRight = Math.max(...launchers.map((launcher) => launcher.right)); + // Taps beside the row reach what is under it. + const besideHits = []; + if (launchers.length) { + const middle = launchers[0].top + launchers[0].height / 2; + for (const x of [rowLeft - 8, rowRight + 8]) { + const target = document.elementFromPoint(x, middle); + besideHits.push(Boolean(target?.closest('#cockpit-utility-controls'))); + } + } + return { + launchers, + rowLeft, + rowRight, + besideHits, + hits: controls.map((control) => { + const glyph = control.querySelector('.cockpit-utility-glyph'); + const box = glyph?.getBoundingClientRect(); + const target = box && document.elementFromPoint( + box.left + box.width / 2, + box.top + box.height / 2, + ); + return Boolean(target && glyph.contains(target)); + }), + speed: rect(hud('.cockpit-speed')), + altitude: rect(hud('.cockpit-altitude')), + route: rect(route), + chevron: rect(route.querySelector('.cockpit-route-chevron')), + reticle: rect(hud('.cockpit-reticle')), + rollArc: rect(hud('.cockpit-roll-arc')), + vision: rect(hud('.cockpit-vision-controls')), + switcher: rect(document.getElementById('view-switcher')), + viewport: { width: innerWidth, height: innerHeight }, + }; + } finally { + route.hidden = wasHidden; + } + }); + const obstacles = { + portrait: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'rollArc', 'vision'], + // The row covers the roll arc's lower tick ends; ticks and labels stay readable. + landscape: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'vision'], + // No free band between the instruments: only the vision controls. + short: ['vision'], + }[room]; + const overlaps = (a, b) => Boolean(a && b) + && a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; + const { rowLeft, rowRight } = phoneRow; + const switcherCentre = (phoneRow.switcher?.left + phoneRow.switcher?.right) / 2; + const [first, second] = phoneRow.launchers; + check( + `${width}×${height} Cockpit Display/Radio row is centred in one line, on screen, tappable and clear of ${obstacles.join(', ')}`, + phoneRow.launchers.length === 2 + && phoneRow.launchers.every((launcher) => launcher.width > 0) + && phoneRow.speed?.width > 0 + && phoneRow.altitude?.width > 0 + && (room === 'short' || (phoneRow.route?.width > 0 && phoneRow.chevron?.width > 0)) + && phoneRow.hits.every(Boolean) + && phoneRow.besideHits.every((inside) => !inside) + && Math.abs((first?.top + first?.bottom) / 2 - (second?.top + second?.bottom) / 2) <= 1 + && phoneRow.launchers.every((launcher) => obstacles.every( + (name) => !overlaps(launcher, phoneRow[name]), + )) + && Math.abs((rowLeft + rowRight) / 2 - switcherCentre) <= 2 + && rowLeft >= 0 + && rowRight <= phoneRow.viewport.width + && phoneRow.launchers.every((launcher) => ( + launcher.top >= 0 && launcher.bottom <= phoneRow.viewport.height + )), + JSON.stringify(phoneRow), + ); + } + + // A Stories tap that Cockpit refuses leaves the announcement unread. + await page.evaluate(() => document.getElementById('hStories').click()); + await page.waitForFunction( + () => document.querySelector('#toast.visible')?.textContent === 'Exit cockpit to open Stories', + ); + const resetResult = await page.evaluate(() => { // Both the UI and compatibility facade delegate to this navigation owner. const manager = window.__godsEyeView.styleManager._locationNavigation; @@ -2121,6 +2266,9 @@ try { && resetState.visionRestored, JSON.stringify(resetState), ); + const storiesPopupAfterReset = await page.evaluate(storiesPopupDisplay); + check('the Stories announcement returns once Cockpit closes', + storiesPopupAfterReset !== null && storiesPopupAfterReset !== 'none', String(storiesPopupAfterReset)); check('runtime console remains clean', consoleErrors.length === 0 && localHttpErrors.length === 0, [...localHttpErrors, ...consoleErrors].slice(0, 6).join(' | ')); } finally { diff --git a/server/providers/cctv.js b/server/providers/cctv.js index 5b5222a058..63dc511cb3 100644 --- a/server/providers/cctv.js +++ b/server/providers/cctv.js @@ -21,8 +21,13 @@ import { PROXY_SIGNALS } from '../../src/localRequestGate.mjs'; import { createHlsPuller } from './cctv/stream.js'; import { isMlitRiverAdjustmentImage } from './cctv/worldCameras.js'; import { ottawaAuthorizedFrameUrl } from './cctv/ottawa.js'; -import { googleServerApiKey } from './places/google-key.js'; +import { + GOOGLE_DEFAULT_PER_MIN, + googleServerApiKey, +} from './places/google-key.js'; +import { clientNetworkKey, makeCostRateLimiter } from './common/rate-limit.js'; export { CCTV_FRAME_FETCH_TIMEOUT_MS, fetchCctvImageFromUpstream }; + /** * Vite plugin: CCTV camera proxy with source registry, frame/media serving, * fallback chain (upstream -> Street View -> synthetic SVG), and health tracking. @@ -198,17 +203,31 @@ export function cctvProxy({ sourceRoot = process.cwd() } = {}) { }; }; + let streetViewBudget; // undefined = not built yet; null = the explicit 0 opt-out + /** * Fetch a Google Street View static image as a fallback frame. Server-side * call, never reaches the browser — prefers GOOGLE_MAPS_SERVER_API_KEY * (#33: a key scoped to Street View Static/Places, restricted by server IP * rather than HTTP referrer) and falls back to the browser-exposed * GOOGLE_MAPS_API_KEY for setups that haven't split the two yet. + * Each IP (or IPv6 /64) has its own GEV_RATELIMIT_GOOGLE_PER_MIN window, + * separate from Places. Setting it to 0 disables the limit. */ - const streetViewFallback = async ({ lat, lon, heading, fov, pitch }) => { + const streetViewFallback = async ( + client, + { lat, lon, heading, fov, pitch }, + ) => { const streetViewKey = googleServerApiKey(); if (!streetViewKey || !Number.isFinite(lat) || !Number.isFinite(lon)) return null; + // Built on first use, after the standalone env has loaded. + if (streetViewBudget === undefined) + streetViewBudget = makeCostRateLimiter( + process.env.GEV_RATELIMIT_GOOGLE_PER_MIN, + GOOGLE_DEFAULT_PER_MIN, + ); + if (streetViewBudget && !streetViewBudget(client)) return null; try { const sv = new URL('https://maps.googleapis.com/maps/api/streetview'); sv.searchParams.set('size', '960x540'); @@ -264,6 +283,8 @@ export function cctvProxy({ sourceRoot = process.cwd() } = {}) { // keyless gate keeps the routes reachable behind a reverse proxy; the // key-bearing Street View fallback below has its own check. if (admitSameSiteKeyless(req, res)) return; + // Read before any await: a socket the client has closed has no address. + const client = clientNetworkKey(req); const sources = await getCctvSources(); const sourceById = new Map( sources.map((source) => [source.id, source]), @@ -635,8 +656,7 @@ export function cctvProxy({ sourceRoot = process.cwd() } = {}) { const source = sourceById.get(cameraId); const label = url.searchParams.get('label') || source?.name || cameraId; const city = url.searchParams.get('city') || source?.city || ''; - const lat = Number(url.searchParams.get('lat') || source?.lat); - const lon = Number(url.searchParams.get('lon') || source?.lon); + // The query sets only the view, the pose the browser draws. const heading = Number( url.searchParams.get('heading') || source?.headingDeg, ); @@ -731,18 +751,21 @@ export function cctvProxy({ sourceRoot = process.cwd() } = {}) { // request (whose client this server cannot see) gets the placeholder, // as if no key were configured. Any forwarding header counts, even an // empty one. + // It also answers only for catalog cameras, at the catalog position; + // the query never sets the location. const forwarded = PROXY_SIGNALS.some( (name) => req.headers?.[name] !== undefined, ); - const sv = forwarded - ? null - : await streetViewFallback({ - lat, - lon, - heading, - fov, - pitch, - }); + const sv = + forwarded || !source + ? null + : await streetViewFallback(client, { + lat: source.lat, + lon: source.lon, + heading, + fov, + pitch, + }); if (sv?.ok) { setHealth(cameraId, { status: 'degraded', diff --git a/server/providers/places/google-key.js b/server/providers/places/google-key.js index ff5fe6356e..c8b5c4c9c0 100644 --- a/server/providers/places/google-key.js +++ b/server/providers/places/google-key.js @@ -1,5 +1,13 @@ import { resolveGoogleServerKey } from '../../../scripts/google-server-key.mjs'; +/** + * Default GEV_RATELIMIT_GOOGLE_PER_MIN for the Places and Geocoding window + * and the separate CCTV Street View window, in requests per minute per IP. + * The Pinokio build sets the same default in pinokio/_ENVIRONMENT. + * `.env.example` suggests 60 for hosts other than localhost. + */ +export const GOOGLE_DEFAULT_PER_MIN = 120; + /** * Optional Google place context is an empty capability when no key is present, * not a server outage. Returning 200 keeps a deliberately keyless session out diff --git a/server/providers/places/google.js b/server/providers/places/google.js index d81d8eef1d..93a8ba3f8e 100644 --- a/server/providers/places/google.js +++ b/server/providers/places/google.js @@ -1,4 +1,5 @@ import { + GOOGLE_DEFAULT_PER_MIN, googleServerApiKey, keylessGooglePlacesResponse, keylessGoogleGeocodeResponse, @@ -15,17 +16,7 @@ import { // undefined = not built yet; null = the explicit 0 opt-out; fn = active limiter let _googleRateLimiter; -/** - * Requests/min/IP applied when GEV_RATELIMIT_GOOGLE_PER_MIN is unset. This is - * the value the Pinokio build already ships (pinokio/_ENVIRONMENT), so the - * packaged app keeps behaving exactly as it does today and only an - * unconfigured server changes — from unlimited to what the product already - * runs with. Places calls are user-driven (a search, a nearby lookup, an - * installation probe) rather than polled, so this sits far above what the app - * generates and bites only a caller enumerating the endpoint. `.env.example` - * suggests a tighter 60 when the host is not localhost; that still applies. - */ -export const GOOGLE_DEFAULT_PER_MIN = 120; +export { GOOGLE_DEFAULT_PER_MIN }; /** Google cost endpoints (nearby-places, text-search, geocoding). Null only when set to 0. */ function googleRateLimiter() { diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index f8232a2f47..616bfd2c18 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -1157,6 +1157,15 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' mobileCockpit[1], /body\.cockpit-mode \.cockpit-utility-controls[\s\S]*?bottom:\s*152px;/, ); + assert.match( + mobileCockpit[1], + /body\.cockpit-mode\.mobile-shell[^{]*?\.cockpit-utility-controls \{[^}]*?top:[^;]*?var\(--cockpit-visor-top\)/, + ); + assert.match( + mobileCockpit[1], + /@media \(min-width: 390px\) and \(min-height: 240px\),\s*\(min-height: 450px\) \{\s*body\.cockpit-mode\.mobile-shell/, + ); + assert.match(css, /\.cockpit-visor-shell \{[^}]*?inset:\s*var\(--cockpit-visor-top\)/); assert.match( mobileCockpit[1], /body\.cockpit-mode \.cockpit-utility-control\.is-expanded[\s\S]*?top:\s*96px;/, @@ -1175,6 +1184,15 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' ); }); +test('the unread Stories announcement waits until Cockpit closes', () => { + assert.match(css, /body\.cockpit-mode #gev-stories #hPop \{\s*display:\s*none;\s*\}/); + const storiesView = fs.readFileSync(path.join(ROOT, 'src', 'ui', 'views', 'StoriesView.vue'), 'utf8'); + assert.match( + storiesView, + /async function openExplore\(\) \{[^}]*?if \(await store\.controller\.open\(\)\) markPopSeen\(\);/, + ); +}); + test('cockpit route direction uses self-contained vector artwork, not a font ligature', () => { const match = html.match(/