Research page: NUXT_PUBLIC_DX_MAPS_BASE loads the dx-maps tree from a maps CDN
Set, the gallery script and its tree-base come from that URL (e.g. https://maps-dev.nuxtbase.app/cdn/dx-maps). Unset, the page uses this site's own /dx-maps/ copy exactly as before. Both modes proven on the dev server: 0 console errors, the gallery tabs draw, and every dx-maps request goes to the chosen host.
This commit is contained in:
parent
bdf1061a28
commit
d4daff02b9
4 changed files with 23 additions and 5 deletions
|
|
@ -37,6 +37,10 @@ MOBILE_APP_ANDROID_PACKAGE=life.doxa.pray
|
|||
# Mapbox (used by the prayer map on /pray)
|
||||
NUXT_PUBLIC_MAPBOX_TOKEN=your-mapbox-public-token
|
||||
|
||||
# Research page: load the dx-maps tree from a maps CDN instead of this site's public/dx-maps copy.
|
||||
# Unset = the local copy. The CDN must send Access-Control-Allow-Origin for the tree.
|
||||
# NUXT_PUBLIC_DX_MAPS_BASE=https://maps-dev.nuxtbase.app/cdn/dx-maps
|
||||
|
||||
# Cloudflare Turnstile
|
||||
NUXT_TURNSTILE_SITE_KEY=your-turnstile-site-key
|
||||
NUXT_TURNSTILE_SECRET_KEY=your-turnstile-secret-key
|
||||
|
|
|
|||
|
|
@ -52,6 +52,14 @@ or `.env` is needed for this page. Without `DATABASE_URL`, the dev server only l
|
|||
`regions-dashboard`, `upg-100`, and so on).
|
||||
- Share and embed links in the maps point at this site's own `/dx-maps/` pages.
|
||||
|
||||
## Maps from a CDN instead of the local copy
|
||||
|
||||
Set `NUXT_PUBLIC_DX_MAPS_BASE` to a dx-maps tree URL, for example
|
||||
`NUXT_PUBLIC_DX_MAPS_BASE=https://maps-dev.nuxtbase.app/cdn/dx-maps`. The Research page then loads the
|
||||
gallery script and every map from there. That host must send `Access-Control-Allow-Origin` for the tree.
|
||||
Unset (the default), the page uses this site's own `public/dx-maps/` copy, as above. The home, pray and adopt
|
||||
maps still load from the local copy.
|
||||
|
||||
## Updating the maps
|
||||
|
||||
Replace `public/dx-maps/` with a newer build of the tree, from the doxa-maps repo's
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ const researchProfileConfig = computed(() => JSON.stringify({
|
|||
}))
|
||||
if (SHOW_LEGACY_RESEARCH) useTextHighlight()
|
||||
|
||||
const GALLERY_SCRIPT = '/dx-maps/doxa-maps-spa/doxa-maps-spa.js'
|
||||
// The dx-maps tree: NUXT_PUBLIC_DX_MAPS_BASE when set (a maps CDN), otherwise this site's own
|
||||
// /dx-maps/ copy. The script and every embed URL come from the same tree.
|
||||
const DX_MAPS_BASE = ((runtimeConfig.public as { dxMapsBase?: string }).dxMapsBase || '').replace(/\/+$/, '')
|
||||
const GALLERY_SCRIPT = `${DX_MAPS_BASE || '/dx-maps'}/doxa-maps-spa/doxa-maps-spa.js`
|
||||
|
||||
useHead({
|
||||
title: () => t('Research'),
|
||||
|
|
@ -63,10 +66,10 @@ onMounted(() => {
|
|||
}
|
||||
|
||||
gallery = document.createElement('doxa-maps-spa')
|
||||
// Every embed URL is built at RUNTIME from the origin serving this page: the gallery reads its
|
||||
// manifest and every child map from here, so the same build works on any host (laptop, staging,
|
||||
// production) with nothing hardcoded.
|
||||
gallery.setAttribute('tree-base', `${window.location.origin}/dx-maps`)
|
||||
// Every embed URL is built at RUNTIME: from NUXT_PUBLIC_DX_MAPS_BASE when set, otherwise from the
|
||||
// origin serving this page, so the same build works on any host (laptop, staging, production) with
|
||||
// nothing hardcoded.
|
||||
gallery.setAttribute('tree-base', DX_MAPS_BASE || `${window.location.origin}/dx-maps`)
|
||||
// The site's language drives the gallery's (and every map's); it follows the language switcher.
|
||||
gallery.setAttribute('language', locale.value)
|
||||
// With a Mapbox token configured, the maps use it. Without one (a fresh laptop), they use the
|
||||
|
|
|
|||
|
|
@ -286,6 +286,9 @@ export default defineNuxtConfig({
|
|||
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || '',
|
||||
prayBaseUrl: process.env.NUXT_PUBLIC_PRAY_BASE_URL || 'https://pray.doxa.life',
|
||||
mapboxToken: process.env.NUXT_PUBLIC_MAPBOX_TOKEN || '',
|
||||
// Where the Research page loads the dx-maps tree from (e.g. https://maps-dev.nuxtbase.app/cdn/dx-maps).
|
||||
// Unset: this site's own /dx-maps/ copy (public/dx-maps). A foreign host must send CORS for the tree.
|
||||
dxMapsBase: process.env.NUXT_PUBLIC_DX_MAPS_BASE || '',
|
||||
statinatorUrl: process.env.NUXT_PUBLIC_STATINATOR_URL || 'https://statinator.doxa.life',
|
||||
statinatorProjectId: process.env.NUXT_PUBLIC_STATINATOR_PROJECT_ID || 'doxa',
|
||||
statinatorEnabled: process.env.NUXT_PUBLIC_STATINATOR_ENABLED === 'true',
|
||||
|
|
|
|||
Loading…
Reference in a new issue