mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Add layer and map credits through the renderer's credits port
The street-level provider credits, the map source credit, the shared inline OpenStreetMap and OpenMapTiles credits and the ALPR provider credit go through the renderer's credits port instead of Cesium's credit display. Their markup has one link each and is read as the port's plain data; the ALPR credit is built as plain data, which the port escapes. src/maps/credits.js and src/layers/streetLevel/credits.js no longer reach Cesium and leave the allow-list. findCredits finds the port as findCamera finds the camera: a Cesium viewer of a caller's own, with no renderer bound, gets a credits port over its own credit display, so the public entries keep their attribution. A port built that way is released, not disposed, when a renderer binds later, and a credit let go after its viewer is destroyed leaves the display alone. The per-layer data credits and the transit and event credits stay on Cesium's display: their markup carries several links each, which the contract's credit cannot hold.
This commit is contained in:
1 parent
979e2213b9
commit
765a0db094
26 files changed
+418
-142
No files matched your search
@@ -8,7 +8,7 @@ import {
|
||||
createOverpassAlprSource,
|
||||
buildOverpassQuery,
|
||||
} from './source.js';
|
||||
import { validateAlprSnapshot, alprCreditMarkup } from './model.js';
|
||||
import { validateAlprSnapshot, alprCredit } from './model.js';
|
||||
const box = { south: 30, west: -98, north: 30.1, east: -97.9 };
|
||||
test('the source rejects invalid and unbounded queries before fetching', async () => {
|
||||
let calls = 0;
|
||||
@@ -130,19 +130,28 @@ test('source snapshots reject malformed coordinates and duplicate identities', (
|
||||
);
|
||||
});
|
||||
|
||||
test('provider attribution escapes markup and rejects executable links', () => {
|
||||
assert.equal(alprCreditMarkup(null), null);
|
||||
test('provider attribution is plain text with a public HTTPS link only', () => {
|
||||
assert.equal(alprCredit(null), null);
|
||||
assert.throws(
|
||||
() => alprCreditMarkup({ text: 'test', href: 'javascript:alert(1)' }),
|
||||
() => alprCredit({ text: 'test', href: 'javascript:alert(1)' }),
|
||||
/HTTPS/,
|
||||
);
|
||||
const html = alprCreditMarkup({
|
||||
text: '<img onerror=alert(1)>',
|
||||
href: 'https://example.org/?a=1&b=2',
|
||||
});
|
||||
assert.ok(html.includes('<img onerror=alert(1)>'));
|
||||
assert.ok(html.includes('?a=1&b=2'));
|
||||
assert.ok(!html.includes('<img'));
|
||||
assert.throws(
|
||||
() => alprCredit({ text: 'test', href: 'https://user:[email protected]/' }),
|
||||
/HTTPS/,
|
||||
);
|
||||
assert.deepEqual(
|
||||
alprCredit({
|
||||
text: '<img onerror=alert(1)>',
|
||||
href: 'https://example.org/?a=1&b=2',
|
||||
}),
|
||||
{
|
||||
text: 'ALPR: <img onerror=alert(1)>',
|
||||
href: 'https://example.org/?a=1&b=2',
|
||||
inline: true,
|
||||
},
|
||||
'left as text: the credits port escapes it',
|
||||
);
|
||||
});
|
||||
|
||||
test('wide detail view returns zoom guidance before any fetch and can retry a smaller view', async () => {
|
||||
|
||||
Reference in new issue
Block a user