mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
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:
1 parent
63341b947e
commit
d9ecd126c8
10 files changed
+96
-11
No files matched your search
@@ -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(),
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user