Let the app run under a panel page's document base

A panel page loads the app with <base> pointing at the app's server, so
addresses the app builds resolve against the document base instead of
the page location, and hash updates stay on the page's own address.
The dev server answers panel origins with CORS on the API routes too.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:37 -07:00
1 parent 63341b947e
commit d9ecd126c8
10 files changed
+96 -11

No files matched your search

+3
View File
@@ -29,6 +29,9 @@ export function createStandaloneLayerSources() {
military: createAdsbLolSource(),
vessels: createAisStreamSource({
apiUrl: import.meta.env?.VITE_AIS_LIVE_API_URL || '/api/ais-live',
// The app's server, also when a panel page loads the app under <base>.
origin: () =>
new URL(globalThis.document?.baseURI ?? 'http://localhost').origin,
}),
cctv: createCctvSource(),
radio: createRadioSource(),
+1 -1
View File
@@ -16,7 +16,7 @@ export function loadToolCatalog() {
tools: coreTools,
services: createToolServices({
fetchImpl: (...args) => globalThis.fetch(...args),
appUrl: globalThis.location.origin,
appUrl: new URL(globalThis.document.baseURI).origin,
}),
}),
'voice',
+1 -1
View File
@@ -8,7 +8,7 @@ export function createStandaloneTools(options) {
sceneDataPacks: {
sources: {
assets: createAssetDirectorySource({
baseUrl: new URL('/scene-assets/', window.location.href).href,
baseUrl: new URL('/scene-assets/', document.baseURI).href,
}),
},
},