From 128a689a5699efcc4ceaf0fd24868368b2b4eced Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Wed, 14 Oct 2026 11:44:25 +0100 Subject: [PATCH] fix(cctv): make the NYC DOT pack opt-in and carry DOT's disclaimer NYC DOT asks developers who use its camera feed to sign a data-sharing agreement, and this project does not hold one that covers downstream installs. The pack now loads only when CCTV_NYC_ENABLED=1; unset, empty or any other value makes no request to webcams.nyctmc.org (tested). The NYC credit carries NYC DOT's requested application disclaimer verbatim, and DATA_SOURCES, README, CHANGELOG, CURRENT-STATE and .env.example describe the prerequisite. Co-Authored-By: Claude Opus 5.5 --- .env.example | 2 +- CHANGELOG.md | 10 +++--- DATA_SOURCES.md | 4 +-- README.md | 2 +- docs/CURRENT-STATE.md | 15 ++++---- server/providers/cctv/catalog.js | 9 +++-- src/data/cctvNyc.test.mjs | 62 +++++++++++++++++--------------- src/data/dataCredits.js | 12 +++++-- src/data/dataCredits.test.mjs | 10 +++++- 9 files changed, 79 insertions(+), 47 deletions(-) diff --git a/.env.example b/.env.example index 0b9a0037a..be746e3e4 100644 --- a/.env.example +++ b/.env.example @@ -215,7 +215,7 @@ AISSTREAM_API_KEY= # CCTV_VEGVESEN_MAX_SOURCES=900 # cap cameras loaded from Statens vegvesen (default loads all ~850 live; max 1000) # CCTV_VEGVESEN_VIDEO=1 # set 0 to show stills instead of live HLS for Statens vegvesen video cameras # CCTV_VEGVESEN_URL= # override the Statens vegvesen catalog URL -# CCTV_NYC_ENABLED=1 # set 0 to disable the NYC DOT Traffic Management Center cameras +# CCTV_NYC_ENABLED= # off by default; set 1 only if you hold a NYC DOT data-sharing agreement (tmcdot@dot.nyc.gov) for the camera feed # CCTV_NYC_MAX_SOURCES=250 # cap cameras loaded from the NYC TMC catalog (nearest borough cores first) # CCTV_NYC_CAMERAS_URL= # override the NYC TMC catalog URL # CCTV_MAX_SOURCES=4000 # catalog-wide ceiling, shared round-robin across packs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b12ee132..8053a997e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,14 @@ # Changelog - Add New York City traffic cameras from the NYC DOT Traffic Management Center - as a CCTV pack. The camera list is one keyless JSON request to + 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. By default the 250 cameras nearest - the five borough cores load. `CCTV_NYC_ENABLED=0` turns the pack off and - `CCTV_NYC_MAX_SOURCES` changes the cap. The catalog-wide ceiling is + 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. - Treat explicitly current, complete empty vessel coverage as a successful update, diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index dbb07f0bf..0e2595237 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -56,7 +56,7 @@ How to read this: | **DriveBC** (Government of British Columbia) | CCTV camera catalog + frames, British Columbia highways | [Open Government Licence – British Columbia](https://www2.gov.bc.ca/gov/content/data/open-data/open-government-licence-bc) — attribution REQUIRED | "DriveBC. Contains information licensed under the Open Government Licence – British Columbia" | | **Open Calgary** (`data.calgary.ca`) | CCTV camera catalog + frames, Calgary | [Open Government Licence – City of Calgary](https://data.calgary.ca/stories/s/Open-Calgary-Terms-of-Use/u45n-7awa) — attribution REQUIRED | "Contains information licensed under the Open Government Licence – City of Calgary" | | **Statens vegvesen** (catalog `ogckart-sn1.atlas.vegvesen.no`, frames `kamera.atlas.vegvesen.no`, HLS `kamera.vegvesen.no`) | CCTV camera catalog + frames + live HLS video, Norway road cameras | [NLOD 2.0](https://data.norge.no/nlod/en/2.0) — attribution REQUIRED | "Contains data under the Norwegian licence for Open Government data (NLOD) distributed by Statens vegvesen" | -| **NYC DOT Traffic Management Center** (`webcams.nyctmc.org`) | CCTV camera catalog + frames, New York City five boroughs | Public NYC DOT traffic camera stills | "NYC DOT Traffic Management Center" (courtesy) | +| **NYC DOT Traffic Management Center** (`webcams.nyctmc.org`) | CCTV camera catalog + frames, New York City five boroughs | NYC DOT requires developers to sign a [data-sharing agreement](https://www.nyc.gov/html/dot/html/about/datafeeds.shtml) for the camera feed. **Off by default**; enable only under your own agreement | "NYC DOT Traffic Management Center" + NYC DOT's required application disclaimer (in the Data attribution popover) | | **GBFS (Lyft / BCycle)** | Bikeshare availability | Per-feed (attribution-only) | Credit the operator (e.g. Austin BCycle) + its `license_url` | | **MBTA / MassDOT** (cdn.mbta.com) | Transit layer live vehicles and up to 15 minutes of recently observed positions, Greater Boston | MBTA / MassDOT open realtime vehicle data, used for the live view and up to fifteen minutes of recently observed positions; published for developer use and not against their use. | Attribution to MBTA / MassDOT (courtesy text) | | **CapMetro** (data.texas.gov) | Transit layer live vehicles, Austin TX | CapMetro open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to CapMetro (courtesy text) | @@ -92,7 +92,7 @@ The optional Local ADS-B layer and the broadcast-FM receiver use radio you recei - **Live Traffic NSW cameras.** The camera list is the keyless public `data.livetraffic.com/cameras/traffic-cam.json` feed (Transport for NSW open data, CC BY 4.0); frames are stills on `webcams.transport.nsw.gov.au`, and only that host is registered. That image host answers non-browser clients with an HTML placeholder, so the proxy identifies as a browser for that one host and as itself everywhere else. Frames are fetched at request time and never stored or redistributed. Disable with `CCTV_NSW_ENABLED=0`. - **Open Calgary traffic cameras.** Keyless. The camera list is the public Socrata dataset `k7p9-kppz` on `data.calgary.ca`; frames are stills on the city's own `trafficcam.calgary.ca` host, and only that host is registered. Most rows publish an `http://` frame URL and the host redirects those to HTTPS, so URLs are upgraded and pinned to that origin before registration. Frames are fetched at request time and never stored or redistributed. The dataset publishes no camera facing: the `quadrant` field and the quadrant suffix on each camera name are Calgary's address grid, not a bearing, so headings use the shared id-hash fallback at low confidence and are corrected with the in-app calibration gizmo. The licence requires the attribution statement above. Disable with `CCTV_CALGARY_ENABLED=0`. - **Statens vegvesen road cameras.** Keyless. The camera list is one GeoJSON request to the OGC API Features view of the official DATEX 3.1 CCTV site table (`ogckart-sn1.atlas.vegvesen.no/ogc/features/v1/collections/datex_3_1:CctvSimple/items`), so no DATEX account is needed; frames are stills on `kamera.atlas.vegvesen.no/api/images/`, and only that exact path per camera is registered. Cameras the feed reports as faulty are dropped. About 135 working cameras also publish live HLS (`kamera.vegvesen.no/public//manifest.m3u8`, MPEG-TS); those play as live video through the bounded in-memory HLS relay, with the still as the snapshot fallback, and only that exact manifest path per camera is registered. `CCTV_VEGVESEN_VIDEO=0` keeps every camera on stills. `orientationDescription` names the place a camera faces, not a bearing, so it goes into the label and headings use the id-hash fallback at low confidence. By default every live camera loads (~850); `CCTV_VEGVESEN_MAX_SOURCES` (8–1000) lowers the cap, keeping the cameras nearest Oslo, Bergen, Stavanger, Trondheim, Kristiansand, Bodø and Tromsø and `CCTV_VEGVESEN_ENABLED=0` turns the pack off. Frames are fetched at request time and never stored or redistributed. The NLOD attribution is registered in the Data attribution popover. -- **NYC DOT Traffic Management Center cameras.** Keyless. The camera list is the public `webcams.nyctmc.org/api/cameras` catalog (~980 cameras across the five boroughs); frames are stills at `webcams.nyctmc.org/api/cameras//image`, synthesized from a validated UUID rather than taken from the payload, and only that host is registered. Cameras the feed reports as offline are dropped. The catalog publishes no camera facing, so headings use the shared id-hash fallback at low confidence and are corrected with the in-app calibration gizmo. By default the 250 cameras nearest the borough cores load; `CCTV_NYC_MAX_SOURCES` (8–400) changes the cap and `CCTV_NYC_ENABLED=0` turns the pack off. Frames are fetched at request time and never stored or redistributed. +- **NYC DOT Traffic Management Center cameras.** Off by default. NYC DOT's [developer data feeds page](https://www.nyc.gov/html/dot/html/about/datafeeds.shtml) asks developers who want the camera feed to contact `tmcdot@dot.nyc.gov` and sign a data-sharing agreement. This project does not hold one that covers downstream installations, so the pack loads only when an operator who holds their own agreement sets `CCTV_NYC_ENABLED=1`; with the flag unset, empty or any other value, the server makes no request to NYC DOT. The endpoint needs no key. The camera list is the public `webcams.nyctmc.org/api/cameras` catalog (~980 cameras across the five boroughs); frames are stills at `webcams.nyctmc.org/api/cameras//image`, synthesized from a validated UUID rather than taken from the payload, and only that host is registered. Cameras the feed reports as offline are dropped. The catalog publishes no camera facing, so headings use the shared id-hash fallback at low confidence and are corrected with the in-app calibration gizmo. Once enabled, the 250 cameras nearest the borough cores load; `CCTV_NYC_MAX_SOURCES` (8–400) changes the cap. Frames are fetched at request time and never stored or redistributed. NYC DOT asks every application that uses its data to carry its disclaimer; it is registered verbatim in the Data attribution popover. - **Camera frame content.** Public camera frames can contain people, vehicles and license plates, and the camera layer does nothing with them beyond putting them on the map. A successful upstream response is relayed as the provider served it: nothing in the camera pipeline blurs, redacts, enhances or restores it, and nothing there runs face, plate or object detection or otherwise recognises or classifies what is in the picture. (The ALPR layer described below maps where plate-reader cameras are, from locations contributors tagged in OpenStreetMap; it reads nothing from any camera frame.) When an upstream has no frame for a camera, what you see instead is a Google Street View still or the app's own placeholder card; the panel's source badge names which of them you are looking at, and a refresh that fails after a frame has arrived leaves the last good picture on screen rather than replacing it. The browser resamples each frame for display: onto a fixed 1920x1080 surface for the camera's projection plane in the scene, and onto a 192x108 canvas for the small ambient card. That scaling is the only change made to the picture, and the only pixels the camera layer reads back are a 64x36 downscale hashed to tell whether the picture has changed. Live streams are piped through; the still path reads the image into memory to pass it on — TxDOT wraps its JPEG in a JSON envelope, which is decoded there — and no frame is written to disk (the disk cache, `.gev-cache/`, holds feed JSON for other layers and never camera imagery). Outside that pipeline, the voice assistant is the one feature that sends imagery anywhere: when it answers a question about what is in view it may attach a downscaled screenshot of the rendered scene — including any camera plane on screen — to the request it sends to the voice model. Frames are fetched only from server-registered camera URLs — a client cannot hand the proxy a URL (see [SECURITY.md](SECURITY.md)). What the app does stays inside the line README draws: no named-person search, no face recognition, no tracking individuals. - **Transit (GTFS-Realtime).** The proxy requests only registered operator feeds, validates redirects, bounds responses, and uses conditional requests, short snapshot caching and failure backoff. All seven registered regions are live-enabled; each can be disabled independently. Vehicles use delayed playback between reports, with report age and waiting states shown separately. Session-local selected trails are available for every feed. MBTA additionally retains up to 15 minutes of recently observed positions in the running proxy, so available history can survive a browser reload; server restart clears it. History reads never fetch upstream, and other feeds have no proxy retention. Nothing is archived to disk or collected in the background. Operator text credits are included as a courtesy and do not imply endorsement. Heights are aligned to work with Google 3D tiles; subway markers are shown at street level because these feeds do not supply depth. - **Radio Browser.** `/api/radio/stations` discovers official API mirrors, makes bounded and coalesced healthy/geolocated HTTPS-station queries, caches the normalized public-domain directory for 45 minutes, and may serve the last good catalog for up to seven days during an outage. Refreshes must meet minimum accepted-query and station coverage before replacing a warm catalog; schema-valid responses whose rows all fail the product's health policy do not count as successful queries. A usable partial cold catalog is explicitly `DEGRADED`, and malformed or empty successful payloads are rejected atomically. Every directory and click-count request rejects redirects, validates all resolved addresses as globally routable (including reserved/documentation IPv4 and special/non-global IPv6 exclusions), and pins the TLS connection to a validated address. Only MP3/AAC non-HLS directory rows with public HTTPS stream targets are returned; favicons are intentionally omitted. Pressing play connects one browser audio element directly to the selected broadcaster and calls the directory's click counter through known-ID-only `POST /api/radio/click/:uuid`. GEV never proxies, caches, records, bundles, or redistributes audio. Radio Browser supplies station-level tags, not dependable current-song or upcoming-program metadata, so Radio filtering never claims either. Direct playback exposes the listener's IP address to the broadcaster, whose own stream terms apply. diff --git a/README.md b/README.md index 38f7a4913..70c4edf28 100644 --- a/README.md +++ b/README.md @@ -300,7 +300,7 @@ Twenty layers and map sources. **Seventeen have a keyless path.** Some offer add | 🛰️ **Satellites** | 838-object catalog, color-coded by class with a live legend — the **DENSE** chip drops in the whole Starlink shell | CelesTrak | 🟢 | | 🌍 **Earthquakes** | Global seismic activity, last 24h | USGS | 🟢 | | 🚗 **Traffic** | Simulated vehicles on OSM roads. With TomTom, live flow speeds drive the simulation and congestion colors below ~8 km; individual vehicle positions are not live observations | TomTom + OSM | 🟢 simulation · 🟡 live flow speeds | -| 📹 **CCTV Mesh** | ~4,100 public cameras projected _into_ the 3D space — Austin · Texas (TxDOT) · California (Caltrans) · London (TfL) · Ontario (511) · Finland (Fintraffic) · British Columbia (DriveBC) · Estonia (Tallinn, Tarktee) · Delaware (DelDOT live video) · New South Wales (Live Traffic NSW) · Calgary · Norway (Statens vegvesen) · New York City (NYC DOT TMC). Positions are published; poses are estimated priors **you calibrate by dragging a gizmo on the camera itself** | City APIs | 🟢 | +| 📹 **CCTV Mesh** | ~3,900 public cameras projected _into_ the 3D space — Austin · Texas (TxDOT) · California (Caltrans) · London (TfL) · Ontario (511) · Finland (Fintraffic) · British Columbia (DriveBC) · Estonia (Tallinn, Tarktee) · Delaware (DelDOT live video) · New South Wales (Live Traffic NSW) · Calgary · Norway (Statens vegvesen), plus opt-in New York City (NYC DOT TMC, needs your own NYC DOT agreement). Positions are published; poses are estimated priors **you calibrate by dragging a gizmo on the camera itself** | City APIs | 🟢 | | 📷 **Mapped ALPR Cameras** | License-plate-reader camera locations tagged by OpenStreetMap contributors, loaded one city-sized view at a time, with **SHOW NEAREST**. Locations and tags only: no plate data, no video | OpenStreetMap (incl. DeFlock mapping) | 🟢 | | 📷 **Street Level** | Street-level photos behind one panel, one chip per provider: coverage on the streets, image cones, an embedded viewer and **FOLLOW**. Mapillary first; Panoramax, KartaView and Google Street View planned | Mapillary | 🟡 Mapillary client token | | 📻 **Radio** | Geolocated world radio with an **analog tuner** — drag the needle across up to 750 stations and the globe flies to each broadcaster | Radio Browser / broadcasters | 🟢 | diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 38bfe3a20..7711e1e9e 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -916,17 +916,20 @@ tuning; a delayed Enable result cannot reveal or refocus removed controls. ## NYC DOT TMC CCTV source pack -The CCTV catalog adds New York City traffic cameras from the NYC DOT Traffic -Management Center alongside the other live packs. The server reads the keyless +The CCTV catalog can add New York City traffic cameras from the NYC DOT +Traffic Management Center. NYC DOT requires developers to sign a data-sharing +agreement for the camera feed, so this is the one opt-in pack: it loads only +when `CCTV_NYC_ENABLED=1`, and with the flag unset the server makes no NYC +request. NYC DOT's requested disclaimer is in the Data attribution popover. +When enabled, the server reads the keyless camera list at `https://webcams.nyctmc.org/api/cameras` and keeps cameras the feed marks online. Frame URLs are built from each camera UUID under `https://webcams.nyctmc.org/api/cameras//image`; they are never taken from the payload. There is no heading in the feed, so gizmos use the shared id-hash fallback at low confidence. -By default the 250 cameras nearest the five borough cores load. -`CCTV_NYC_MAX_SOURCES` sets the pack cap (8–400) and `CCTV_NYC_ENABLED=0` -turns the pack off. The catalog-wide ceiling stays at 4,000 and is shared +Once enabled, the 250 cameras nearest the five borough cores load. +`CCTV_NYC_MAX_SOURCES` sets the pack cap (8–400). The catalog-wide ceiling stays at 4,000 and is shared round-robin, so adding this pack does not silently drop another region. ## DriveBC CCTV source pack @@ -3073,7 +3076,7 @@ its criteria cannot be silently ignored. | Satellites | CelesTrak | `src/data/satellites.js` | `/api/celestrak` | 120s | | Space Missions (30d) | Launch Library 2 + CelesTrak | `src/data/rocketLaunches.js` | `/api/launches` + `/api/celestrak/active` | 5 min | | Traffic | Selectable TomTom / OpenStreetMap / Hybrid roads; optional TomTom flow (BYOK) | `src/data/traffic.js` | browser-direct OpenFreeMap tiles; `/api/tomtom` for flow | viewport-driven; capped tile cache | -| CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Statens vegvesen (NO, stills + live HLS) + NYC DOT TMC + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | +| CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Statens vegvesen (NO, stills + live HLS) + NYC DOT TMC (opt-in) + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | | Radio | Radio Browser (public-domain station directory) | `src/data/radio.js` | `/api/radio/stations`, `/api/radio/click/:uuid` | 45 min directory refresh | | Transit 🚌 | Operator GTFS-Realtime VehiclePositions (7 keyless regions, `src/data/transitFeeds.js`) | `src/layers/transit/` via `src/app/layers/transit.js` | `/api/transit` | 15s (poll + delayed playback) | | Bikeshare 🚲 | GBFS (Lyft + BCycle) | `src/data/bikeshare.js` | `/api/gbfs` | 60s | diff --git a/server/providers/cctv/catalog.js b/server/providers/cctv/catalog.js index 0939a71da..99e627310 100644 --- a/server/providers/cctv/catalog.js +++ b/server/providers/cctv/catalog.js @@ -24,13 +24,16 @@ import { /** Env kill switch: unset or anything but "0" means enabled. */ const envEnabled = (name) => String(process.env[name] || '1').trim() !== '0'; +/** Env opt-in: only "1" enables. For packs whose feed access needs an + * operator agreement, so an unset flag never reaches the upstream. */ +const envOptIn = (name) => String(process.env[name] || '').trim() === '1'; /** * Live open-data packs, in merge order. Adding a region is one entry here * plus its loader in sources.js; the catalog cap is shared across entries * round-robin (cap.js), so a new pack never silently evicts an older one. * Each pack fails independently (allSettled) and is gated by its own env - * kill switch. + * kill switch, or by an opt-in flag where access needs an agreement. */ const LIVE_PACKS = [ { name: 'austin', enabled: () => true, load: loadAustinSourcesFromOpenData }, @@ -100,8 +103,10 @@ const LIVE_PACKS = [ load: loadVegvesenSourcesFromOpenData, }, { + // NYC DOT requires a data-sharing agreement for this feed, so the pack is + // off unless the operator opts in (see DATA_SOURCES.md). name: 'nyc', - enabled: () => envEnabled('CCTV_NYC_ENABLED'), + enabled: () => envOptIn('CCTV_NYC_ENABLED'), load: loadNycSourcesFromOpenData, }, ]; diff --git a/src/data/cctvNyc.test.mjs b/src/data/cctvNyc.test.mjs index d67ffa002..e96755f5a 100644 --- a/src/data/cctvNyc.test.mjs +++ b/src/data/cctvNyc.test.mjs @@ -321,53 +321,59 @@ const runCatalogWithMockedUpstreams = async (t) => { return { requested, sources }; }; -test('the NYC lane is wired into the catalog and its loader runs', async (t) => { +/** Run one catalog refresh with CCTV_NYC_ENABLED set to `flag` (undefined + * leaves it unset), restoring the environment afterwards. */ +const runCatalogWithNycFlag = async (t, flag) => { const saved = { ...process.env }; try { delete process.env.CCTV_SOURCES_FILE; delete process.env.CCTV_SOURCES_JSON; - delete process.env.CCTV_NYC_ENABLED; - const { requested, sources } = await runCatalogWithMockedUpstreams(t); - assert.ok( - requested.includes(NYC_CAMERAS_URL), - 'the catalog refresh invokes the NYC loader', - ); - assert.deepEqual( - sources.filter((s) => s.cityId === 'nyc').map((s) => s.id), - [`nyc-${MIDTOWN_ID}`, `nyc-${BROOKLYN_ID}`], - 'NYC cameras reach the served catalog through the registered lane', - ); + if (flag === undefined) delete process.env.CCTV_NYC_ENABLED; + else process.env.CCTV_NYC_ENABLED = flag; + return await runCatalogWithMockedUpstreams(t); } finally { for (const key of Object.keys(process.env)) { if (!(key in saved)) delete process.env[key]; } Object.assign(process.env, saved); } +}; + +test('CCTV_NYC_ENABLED=1 wires the NYC lane into the catalog', async (t) => { + const { requested, sources } = await runCatalogWithNycFlag(t, '1'); + assert.ok( + requested.includes(NYC_CAMERAS_URL), + 'the catalog refresh invokes the NYC loader', + ); + assert.deepEqual( + sources.filter((s) => s.cityId === 'nyc').map((s) => s.id), + [`nyc-${MIDTOWN_ID}`, `nyc-${BROOKLYN_ID}`], + 'NYC cameras reach the served catalog through the registered lane', + ); }); -test('CCTV_NYC_ENABLED=0 keeps the lane from being loaded at all', async (t) => { - const saved = { ...process.env }; - try { - delete process.env.CCTV_SOURCES_FILE; - delete process.env.CCTV_SOURCES_JSON; - process.env.CCTV_NYC_ENABLED = '0'; - const { requested, sources } = await runCatalogWithMockedUpstreams(t); +// NYC DOT requires a data-sharing agreement for this feed, so an install that +// has not opted in must never contact it. +for (const [label, flag] of [ + ['an unset CCTV_NYC_ENABLED', undefined], + ['an empty CCTV_NYC_ENABLED', ''], + ['CCTV_NYC_ENABLED=0', '0'], + ['CCTV_NYC_ENABLED=true', 'true'], +]) { + test(`${label} makes no NYC request`, async (t) => { + const { requested, sources } = await runCatalogWithNycFlag(t, flag); + assert.ok(requested.length > 0, 'the other packs still refreshed'); assert.equal( - requested.includes(NYC_CAMERAS_URL), + requested.some((href) => href.includes('nyctmc.org')), false, - 'the disabled lane never reaches its upstream', + 'the lane never reaches its upstream', ); assert.deepEqual( sources.filter((s) => s.cityId === 'nyc'), [], ); - } finally { - for (const key of Object.keys(process.env)) { - if (!(key in saved)) delete process.env[key]; - } - Object.assign(process.env, saved); - } -}); + }); +} test('the shipped catalog ceiling is not raised to make room for this pack', () => { assert.equal(DEFAULT_CCTV_MAX_SOURCES, 4000); diff --git a/src/data/dataCredits.js b/src/data/dataCredits.js index 891cd21e2..e68caddb4 100644 --- a/src/data/dataCredits.js +++ b/src/data/dataCredits.js @@ -91,6 +91,13 @@ export function hideOsmCredit(viewer, owner) { return true; } +/** NYC DOT asks every application that uses its data to carry this + * disclaimer verbatim (nyc.gov/html/dot/html/about/datafeeds.shtml). */ +export const NYC_DOT_DISCLAIMER = + 'This application may contain and/or utilize information which was originally compiled by the New York City Department of Transportation (NYC DOT) for governmental purposes; the information may subsequently been modified by entity/entities other than NYC DOT. ' + + 'NYC DOT and the City of New York make no representation as to the accuracy or usefulness of the information provided by this application or the information's suitability for any purpose and disclaim any liability for omissions or errors that may be contained therein. ' + + 'The public is advised to observe posted signage for compliance with applicable laws and regulations.'; + export const DATA_CREDITS = [ // ── Live sources ──────────────────────────────────────────────── { @@ -250,8 +257,9 @@ export const DATA_CREDITS = [ { key: 'nyc-cctv', html: - 'CCTV cameras & frames (New York City): ' + - 'NYC DOT Traffic Management Center', + 'CCTV cameras & frames (New York City, when enabled): ' + + 'NYC DOT Traffic Management Center. ' + + NYC_DOT_DISCLAIMER, }, { key: 'gbfs', diff --git a/src/data/dataCredits.test.mjs b/src/data/dataCredits.test.mjs index 46de48972..30a19b8fe 100644 --- a/src/data/dataCredits.test.mjs +++ b/src/data/dataCredits.test.mjs @@ -1,6 +1,6 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; -import { DATA_CREDITS } from './dataCredits.js'; +import { DATA_CREDITS, NYC_DOT_DISCLAIMER } from './dataCredits.js'; test('every credit carries a unique key and some markup to render', () => { const keys = DATA_CREDITS.map((entry) => entry.key); @@ -120,3 +120,11 @@ test('tile attribution follows source changes and viewers have independent owner assert.equal(a.credits.size, 0); assert.equal(b.credits.size, 1); }); + +test('the NYC camera credit carries NYC DOT’s requested disclaimer', () => { + const credit = DATA_CREDITS.find((entry) => entry.key === 'nyc-cctv'); + assert.ok(credit, 'NYC DOT camera frames must be credited'); + assert.ok(credit.html.includes(NYC_DOT_DISCLAIMER)); + assert.match(credit.html, /make no representation as to the accuracy/); + assert.match(credit.html, /observe posted signage/); +});