From 0c852d257274a66fd916cd8e57b945a8774c0787 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Sun, 27 Sep 2026 05:23:01 +0000 Subject: [PATCH] Gospel x Internet takes the host's token the way the production maps do profile-config tk, then the token ProfileLoader provides (a tokenUrl token-service answer or the page's shared token), then window.MAP_TOKEN. It read only the first and last, so a host using tokenUrl got no Mapbox token on either of the board's maps. --- .../gospel-internet/src/boardEngine.js | 6 ++-- .../gospel-internet/src/components/GiMap.vue | 5 +-- .../gospel-internet/src/components/GiTree.vue | 5 +-- public/dx-maps/doxa-maps-spa/manifest.json | 4 +-- .../gospel-internet/board/board/index.html | 2 +- .../dx-maps/gospel-internet/board/index.html | 2 +- .../board/india-china/index.html | 2 +- .../board/language-tree/index.html | 2 +- .../board/platforms/index.html | 2 +- .../board/project-700/index.html | 2 +- .../gospel-internet/board/zero/index.html | 2 +- .../gospel-internet/gospel-internet.js | 32 +++++++++---------- public/dx-maps/manifest.json | 4 +-- 13 files changed, 37 insertions(+), 33 deletions(-) diff --git a/plugin-designs/gospel-internet/src/boardEngine.js b/plugin-designs/gospel-internet/src/boardEngine.js index daec30b69..6f5376f1b 100644 --- a/plugin-designs/gospel-internet/src/boardEngine.js +++ b/plugin-designs/gospel-internet/src/boardEngine.js @@ -25,7 +25,7 @@ export function readerLang(profileConfig) { /** * @returns {Promise<{ map, provider } | { error: string, provider }>} resolves once the style has loaded */ -export async function createBoardMap(el, profileConfig, { center = [60, 20], zoom = 1.4, whiteboard = false, boundaries = true, background = '#f3f3f1' } = {}) { +export async function createBoardMap(el, profileConfig, { center = [60, 20], zoom = 1.4, whiteboard = false, boundaries = true, background = '#f3f3f1', token = '' } = {}) { const provider = resolveMapProvider(profileConfig) try { await ensureEngineScript(provider) } catch (_) { /* reported below */ } const gl = engineGlobal(provider) @@ -34,7 +34,9 @@ export async function createBoardMap(el, profileConfig, { center = [60, 20], zoo const css = engineStylesheetUrl(provider) if (css) await ensureEngineCSS(el, css) const lang = readerLang(profileConfig) - const tk = profileConfig?.tk || (typeof window !== 'undefined' && window.MAP_TOKEN) || '' + // The host's token by the same ladder the production maps use: profile-config tk, then the token + // ProfileLoader provides (a tokenUrl token-service answer, or the page's shared token), then the page global. + const tk = profileConfig?.tk || token || (typeof window !== 'undefined' && window.MAP_TOKEN) || '' const map = new gl.Map({ container: el, style: resolveNamedStyle('paper', provider).style || 'mapbox://styles/mapbox/light-v11', diff --git a/plugin-designs/gospel-internet/src/components/GiMap.vue b/plugin-designs/gospel-internet/src/components/GiMap.vue index 2a323fae0..89cae9105 100644 --- a/plugin-designs/gospel-internet/src/components/GiMap.vue +++ b/plugin-designs/gospel-internet/src/components/GiMap.vue @@ -20,7 +20,7 @@ * HONESTY: a pin marks where a people is found within a country, not a town (the legend says so, and * how many share a point); the band is the COUNTRY's figure; a state's NFHS-5 figure is the state's. */ -import { ref, shallowRef, computed, watch, onMounted, onBeforeUnmount, markRaw } from 'vue' +import { ref, shallowRef, computed, watch, onMounted, onBeforeUnmount, markRaw, inject } from 'vue' import { resolveAssetsBase } from '@map/utils/embedBase.js' import { useShadowStyles } from '@map/composables/useShadowStyles.js' import MapToolbar from '@map/components/map-controls/MapToolbar.vue' @@ -35,6 +35,7 @@ import { ACCESS_DETAILS, BANDS, DETAIL_FILL, DETAIL_RIM, BAND_COLOR, label } fro const T = useGiT() const board = useBoardState() const { bus } = board +const injectedToken = inject('mapboxToken', null) // tokenUrl / shared page token, via ProfileLoader const mapEl = ref(null) const mapRef = shallowRef(null) @@ -275,7 +276,7 @@ onMounted(async () => { }).catch(() => { adm1Table = null }) try { if (!mapEl.value) return - const made = await createBoardMap(mapEl.value, board.profileConfig.value) + const made = await createBoardMap(mapEl.value, board.profileConfig.value, { token: injectedToken?.value || '' }) if (made.error) { err.value = T('messages.engineMissing', `The ${made.error} map engine did not load.`, { engine: made.error }); return } const map = made.map if (unmounted) { try { map.remove() } catch (_) {} return } diff --git a/plugin-designs/gospel-internet/src/components/GiTree.vue b/plugin-designs/gospel-internet/src/components/GiTree.vue index d7de3a113..997e7a05f 100644 --- a/plugin-designs/gospel-internet/src/components/GiTree.vue +++ b/plugin-designs/gospel-internet/src/components/GiTree.vue @@ -19,7 +19,7 @@ * the bus's one predicate); a hovered grid row points at its language's node (hover never moves the * camera); a committed selection frames its languages once, and jumps under reduced motion. */ -import { ref, shallowRef, computed, watch, onMounted, onBeforeUnmount, markRaw } from 'vue' +import { ref, shallowRef, computed, watch, onMounted, onBeforeUnmount, markRaw, inject } from 'vue' import { useShadowStyles } from '@map/composables/useShadowStyles.js' import { labelFont } from '@map/maps/label-font.js' import MapToolbar from '@map/components/map-controls/MapToolbar.vue' @@ -33,6 +33,7 @@ import { treeScope, TREE_COLOR } from '../model.js' const T = useGiT() const board = useBoardState() const { bus } = board +const injectedToken = inject('mapboxToken', null) // tokenUrl / shared page token, via ProfileLoader const el = ref(null) const mapRef = shallowRef(null) @@ -208,7 +209,7 @@ function frame(coords) { async function build() { const t = await board.loadTree() if (unmounted || !el.value || mapRef.value) return - const made = await createBoardMap(el.value, board.profileConfig.value, { whiteboard: true, boundaries: false, center: [0, 0], zoom: 1 }) + const made = await createBoardMap(el.value, board.profileConfig.value, { whiteboard: true, boundaries: false, center: [0, 0], zoom: 1, token: injectedToken?.value || '' }) if (made.error) { err.value = T('messages.engineMissing', `The ${made.error} map engine did not load.`, { engine: made.error }); return } if (unmounted) { try { made.map.remove() } catch (_) {} return } const map = made.map diff --git a/public/dx-maps/doxa-maps-spa/manifest.json b/public/dx-maps/doxa-maps-spa/manifest.json index 329444b5b..8ca38ed2e 100644 --- a/public/dx-maps/doxa-maps-spa/manifest.json +++ b/public/dx-maps/doxa-maps-spa/manifest.json @@ -578,7 +578,7 @@ "bundle": "gospel-internet", "scriptUrl": "./gospel-internet/gospel-internet.js", "output": "dx-maps/gospel-internet/gospel-internet.js", - "integrity": "sha384-NVgxHdVCb5aUY7aSYhuffQ3upM9FZCTOVLq80etKnDXCr8ZnVlhgmeu/FNwo/0ld", + "integrity": "sha384-7OLwBf2bK1Szc8ISMHusFv6dZkvimSiZdBtnCIsRCMZtVnMbBe1KaZ96OvXbu37e", "elements": [ "gospel-internet-board" ], @@ -594,7 +594,7 @@ "scriptUrl": "./gospel-internet/gospel-internet.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" }, "instances": [ { diff --git a/public/dx-maps/gospel-internet/board/board/index.html b/public/dx-maps/gospel-internet/board/board/index.html index 0044b0209..a0d774a19 100644 --- a/public/dx-maps/gospel-internet/board/board/index.html +++ b/public/dx-maps/gospel-internet/board/board/index.html @@ -36,7 +36,7 @@ - + - + - + - + - + - + - + \n\n" + "script": "\n\n\n\n" }, "instances": [ {