diff --git a/docs/v2x-cesium-preview.md b/docs/v2x-cesium-preview.md index b7df994..f08c6e7 100644 --- a/docs/v2x-cesium-preview.md +++ b/docs/v2x-cesium-preview.md @@ -24,6 +24,8 @@ Add a non-sensitive `v2xPreview` object to the area configuration: `apiBaseUrl` and `wsBaseUrl` should normally be relative, same-origin paths. The deployment server proxies them to the V2X REST and WebSocket services. Do not commit a private upstream address, an account, a token, or an AMap key. +`crossCode` is deployment configuration for the selected intersection. It is +never shown or editable in the browser login panel. The browser sends `POST {apiBaseUrl}/facilities/api/sys/login` with `userName` and an MD5-hashed password, matching the source V2X dashboard. It holds the diff --git a/scripts/lib/v2x-cesium-overlay.js b/scripts/lib/v2x-cesium-overlay.js index 95bad9a..63cd2d2 100644 --- a/scripts/lib/v2x-cesium-overlay.js +++ b/scripts/lib/v2x-cesium-overlay.js @@ -21,7 +21,7 @@ metrics: null, vehicleSource: "waiting", }; - const ui = buildUi(state, settings); + const ui = buildUi(state); function setStatus(message) { state.status = message; @@ -99,12 +99,11 @@ } async function loadLiveData() { - const crossCode = ui.crossCode.value.trim(); + const crossCode = state.crossCode; if (!crossCode) { - setStatus("Enter a V2X intersection code."); + setStatus("V2X intersection code is not configured."); return; } - state.crossCode = crossCode; clearEntities(); state.vehicleSource = "waiting"; setStatus("Loading live V2X intersection data..."); @@ -195,12 +194,12 @@ return { state, load: loadLiveData, signOut, dispose: () => { disconnect(); clearEntities(); state.vehicleSource = "waiting"; ui.root.remove(); } }; } - function buildUi(state, settings) { + function buildUi(state) { const root = document.createElement("aside"); root.id = "v2xPanel"; root.innerHTML = `
Live V2X DataNative: WGS84/ENU | V2X: GCJ-02
- + `; document.body.appendChild(root); return { @@ -209,7 +208,6 @@ live: root.querySelector("#v2xLiveControls"), userName: root.querySelector("[name=userName]"), password: root.querySelector("[name=password]"), - crossCode: root.querySelector("[name=crossCode]"), reload: root.querySelector("[data-action=reload]"), signOut: root.querySelector("[data-action=signout]"), status: root.querySelector("#v2xStatus"), @@ -329,7 +327,6 @@ resolved.searchParams.set("authorization", token); return resolved.href; } - function escapeAttribute(value) { return String(value).replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<"); } function transformLat(x, y) { let value = -100 + 2 * x + 3 * y + .2 * y * y + .1 * x * y + .2 * Math.sqrt(Math.abs(x)); value += (20 * Math.sin(6 * x * PI) + 20 * Math.sin(2 * x * PI)) * 2 / 3; value += (20 * Math.sin(y * PI) + 40 * Math.sin(y / 3 * PI)) * 2 / 3; value += (160 * Math.sin(y / 12 * PI) + 320 * Math.sin(y * PI / 30)) * 2 / 3; return value; } function transformLon(x, y) { let value = 300 + x + 2 * y + .1 * x * x + .1 * x * y + .1 * Math.sqrt(Math.abs(x)); value += (20 * Math.sin(6 * x * PI) + 20 * Math.sin(2 * x * PI)) * 2 / 3; value += (20 * Math.sin(x * PI) + 40 * Math.sin(x / 3 * PI)) * 2 / 3; value += (150 * Math.sin(x / 12 * PI) + 300 * Math.sin(x / 30 * PI)) * 2 / 3; return value; } diff --git a/scripts/test-preview-assets.js b/scripts/test-preview-assets.js index c4c3145..e88ae63 100644 --- a/scripts/test-preview-assets.js +++ b/scripts/test-preview-assets.js @@ -281,6 +281,8 @@ assert.match(v2xRuntime, /GCJ-02 -> WGS84 once/); assert.match(v2xRuntime, /\/network\/ws\/network\/signal/); assert.match(v2xRuntime, /\/network\/ws\/network\/obuPosition/); assert.match(v2xRuntime, /\/network\/ws\/network\/targetPosition/); +assert.doesNotMatch(v2xRuntime, /Intersection code