mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge origin/main into german/navara
Conflict resolutions:
- src/main.js: upstream's PHOTON_URL place-search setting is read once at
module level and passed as geospatial: { endpoints: { photon } } by
createApplication(), so every engine start of the switch flow gets it; the
old single top-level createStandaloneApplication() call stays removed.
- src/layers/bikeshare/render/cesium/rendering.js: upstream's
publishedCapacity fix applied with this branch's
resolveCapacity(model, capacity, status) signature. The same fix is ported
to src/layers/bikeshare/render/navara.js (record.publishedCapacity, status
polls resolve from it), with a Navara regression test; upstream's
proxyRoute test imports the moved render/cesium/rendering.js.
- src/layers/traffic/flow.js: upstream's nextTask() yield and current()
check kept before the scene is taken from this branch's
_trafficScene?.() ?? _viewer?.scene with its missing-scene return.
- scripts/package-boundaries.json, scripts/format-scope.json: union of both
sides' file lists.
- src/voice/actionSchemas.test.mjs: both history comments kept, payload hash
recomputed for the merged schemas (Sentinel-2 map stack enum plus the
shorter layer alias hint).
- src/hudAltitudeDatum.test.mjs: this branch's engine-based IntelHUD
construction with upstream's placeLabels summary context.
This commit is contained in:
commit
1a1eef0e5c
494 files changed
+28358
-1361
No files matched your search
@@ -0,0 +1,99 @@
|
||||
import { radioLayer } from '../data/radio.js';
|
||||
|
||||
export function radioStationRow(overrides = {}) {
|
||||
return {
|
||||
id: '00000000-0000-4000-8000-000000000001',
|
||||
name: 'Station',
|
||||
lat: 30,
|
||||
lon: -97,
|
||||
streamUrl: 'https://radio.example.com/station.mp3',
|
||||
homepage: null,
|
||||
tags: ['news'],
|
||||
languages: ['English'],
|
||||
state: 'Texas',
|
||||
country: 'United States',
|
||||
countryCode: 'US',
|
||||
metadataTrust: 'untrusted-community',
|
||||
codec: 'MP3',
|
||||
bitrate: 128,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Run `body` against an enabled `radioLayer` that serves `stations`.
|
||||
* Streams listed in `failingUrls` (mutable) reject play(); `body` receives the
|
||||
* played URLs and the catalog, whose rows and generation the next update() serves.
|
||||
*/
|
||||
export async function withRadioLayer({ stations, failingUrls = [] }, body) {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalAudio = globalThis.Audio;
|
||||
const playUrls = [];
|
||||
const catalog = { rows: stations, generation: 1 };
|
||||
globalThis.Audio = class FakeAudio {
|
||||
constructor() {
|
||||
this.volume = 0.8;
|
||||
this.src = '';
|
||||
}
|
||||
|
||||
addEventListener() {}
|
||||
pause() {}
|
||||
play() {
|
||||
playUrls.push(this.src);
|
||||
if (failingUrls.includes(this.src)) {
|
||||
return Promise.reject(
|
||||
new DOMException('unavailable', 'NotSupportedError'),
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
removeAttribute() {
|
||||
this.src = '';
|
||||
}
|
||||
load() {}
|
||||
};
|
||||
globalThis.fetch = async (url) =>
|
||||
String(url).startsWith('/api/radio/click/')
|
||||
? { ok: true }
|
||||
: new Response(
|
||||
JSON.stringify({
|
||||
stations: catalog.rows,
|
||||
stale: false,
|
||||
degraded: false,
|
||||
acceptedGeneration: catalog.generation,
|
||||
catalogInstance: 'qa-instance-a',
|
||||
updatedAt: new Date().toISOString(),
|
||||
}),
|
||||
{ status: 200, headers: { 'Content-Type': 'application/json' } },
|
||||
);
|
||||
const viewer = {
|
||||
camera: { positionWC: { x: 7_000_000, y: 0, z: 0 } },
|
||||
scene: {
|
||||
canvas: {
|
||||
disableRootEvents: true,
|
||||
onwheel: null,
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
},
|
||||
},
|
||||
dataSources: { add() {}, remove() {} },
|
||||
entities: {
|
||||
add(entity) {
|
||||
return entity;
|
||||
},
|
||||
remove() {},
|
||||
},
|
||||
};
|
||||
radioLayer.destroy();
|
||||
try {
|
||||
radioLayer.init(viewer);
|
||||
radioLayer.enable();
|
||||
await radioLayer.update();
|
||||
await body({ playUrls, catalog });
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
if (originalAudio === undefined) delete globalThis.Audio;
|
||||
else globalThis.Audio = originalAudio;
|
||||
radioLayer.destroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// hud.js imports `mgrs`, whose named exports Node's ESM loader cannot read:
|
||||
// import this module before hud.js to swap it for a stub.
|
||||
import { registerHooks } from 'node:module';
|
||||
|
||||
const MGRS_STUB_URL = 'gev-test-stub:mgrs';
|
||||
registerHooks({
|
||||
resolve(specifier, context, next) {
|
||||
if (specifier === 'mgrs') return { url: MGRS_STUB_URL, shortCircuit: true };
|
||||
return next(specifier, context);
|
||||
},
|
||||
load(url, context, next) {
|
||||
if (url === MGRS_STUB_URL) {
|
||||
return {
|
||||
format: 'module',
|
||||
shortCircuit: true,
|
||||
source:
|
||||
'export function forward() { return "10SEG55776339"; }\nexport default { forward };\n',
|
||||
};
|
||||
}
|
||||
return next(url, context);
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user