mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Merge main into prereq-10-osm-overlays
This commit is contained in:
commit
c35eba1704
17 files changed
+161
-28
No files matched your search
@@ -54,14 +54,22 @@ async function call(handlers, url, init = {}) {
|
||||
Object.assign(req, {
|
||||
method: init.method || 'GET',
|
||||
url: parsed.pathname.slice(mount.length) + parsed.search || '/',
|
||||
headers: {},
|
||||
headers: init.headers || {},
|
||||
socket: { remoteAddress: '127.0.0.1' },
|
||||
});
|
||||
let status, headers, body;
|
||||
let status, body;
|
||||
let headers = {};
|
||||
await handlers.get(mount)(req, {
|
||||
// The cross-site gate answers through statusCode/setHeader, not writeHead.
|
||||
set statusCode(s) {
|
||||
status = s;
|
||||
},
|
||||
setHeader(name, value) {
|
||||
headers[name] = value;
|
||||
},
|
||||
writeHead(s, h) {
|
||||
status = s;
|
||||
headers = h;
|
||||
headers = { ...headers, ...h };
|
||||
},
|
||||
end(b) {
|
||||
body = b;
|
||||
@@ -166,6 +174,36 @@ test('zero egress: every Overpass consumer reaches real default handlers, and re
|
||||
);
|
||||
});
|
||||
|
||||
test('the installations proxy refuses cross-site and forwarded requests before any Overpass work', async (t) => {
|
||||
env(t);
|
||||
t.mock.method(globalThis, 'fetch', () =>
|
||||
assert.fail('unexpected upstream fetch'),
|
||||
);
|
||||
const handlers = routes(militaryInstallationsProxy());
|
||||
const url =
|
||||
'/api/military-installations?south=48.8&west=2.2&north=48.9&east=2.4';
|
||||
for (const headers of [
|
||||
{ 'sec-fetch-site': 'cross-site' },
|
||||
{ 'sec-fetch-site': 'same-site' },
|
||||
{ origin: 'https://foreign.example' },
|
||||
{ origin: 'null' },
|
||||
{ 'sec-fetch-site': 'same-origin', 'x-forwarded-for': '203.0.113.9' },
|
||||
]) {
|
||||
const response = await call(handlers, url, { headers });
|
||||
assert.equal(response.status, 403, JSON.stringify(headers));
|
||||
assert.equal(response.headers.get('cache-control'), 'no-store');
|
||||
}
|
||||
for (const headers of [
|
||||
{},
|
||||
{ origin: 'http://localhost:4173', 'sec-fetch-site': 'same-origin' },
|
||||
]) {
|
||||
const response = await call(handlers, url, {
|
||||
headers: { host: 'localhost:4173', ...headers },
|
||||
});
|
||||
assert.notEqual(response.status, 403, JSON.stringify(headers));
|
||||
}
|
||||
});
|
||||
|
||||
test('an unconfigured server is probed once and never sent a feature query', async (t) => {
|
||||
env(t);
|
||||
t.mock.method(globalThis, 'fetch', () =>
|
||||
|
||||
@@ -495,6 +495,36 @@ body:not(.ui-clean-view):not(.recording-mode):has(
|
||||
#command-dock .gev-voice-error-tray {
|
||||
width: min(24rem, calc(100vw - 1.5rem));
|
||||
}
|
||||
|
||||
/* The wings shrink to --dock-side-compact at this width, open or closed (an
|
||||
open tray pops out above the dock), which is too narrow for the text
|
||||
labels; they would spill over the voice control and take its taps. The
|
||||
wings show only their icon; the toggles keep their aria-label. Cyber sets
|
||||
a wider --dock-side-compact that fits its labels, so it keeps them. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#command-dock
|
||||
:is(#location-bar, #control-panel)
|
||||
.panel-title,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#command-dock
|
||||
:is(#location-bar, #control-panel)
|
||||
.location-toolbar-label {
|
||||
font-size: 0;
|
||||
letter-spacing: 0;
|
||||
/* The empty text is still a flex item; drop the gap it would claim. */
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#command-dock
|
||||
:is(#location-bar, #control-panel)
|
||||
.panel-title::after,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#command-dock
|
||||
:is(#location-bar, #control-panel)
|
||||
.location-toolbar-label::after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 620px) {
|
||||
@@ -503,13 +533,6 @@ body:not(.ui-clean-view):not(.recording-mode):has(
|
||||
--dock-voice-width: 8.75rem;
|
||||
}
|
||||
|
||||
#command-dock .panel-title,
|
||||
#command-dock .location-toolbar-label {
|
||||
max-width: 2.3rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#left-panel-stack {
|
||||
bottom: calc(50vh + 8px);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user