mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 10:24:05 +00:00
fix(maps): let users and admins enter a CARTO API key (#2060)
CARTO stamps an "API KEY REQUIRED" watermark onto every basemap tile fetched without a key since 26.08.2026, and both CartoDB presets plus the built-in fallback are CARTO. The key is free and needs no account, so add it as a setting rather than dropping the provider. carto_api_key sits next to mapbox_access_token: per user in Settings/Map, instance-wide under Admin/User Defaults, encrypted at rest, injected from CARTO_API_KEY on managed instances. Unlike Mapbox it never switches the map provider, since a raster key says nothing about the renderer. The key is appended as ?key= at render time instead of being stored in the template, so a saved URL stays portable and survives a rotation. That is also what reaches the four maps that pinned CARTO and ignored the user's tile setting: atlas, collections, the public trip share and the public journey. The two share pages read it from their token-gated payload, the same way baseCurrency already travels. Also lifts the release notice above page chrome. Its overlay sat at z-index 50, under the Vacay mode toolbar at 61, so the dialog was neither on top nor modal. Adds a six-step layer scale to index.css and moves the three notice shells onto it. Closes #2054 Closes #2052
This commit is contained in:
@@ -4,7 +4,13 @@ import { decrypt_api_key, maybe_encrypt_api_key } from '../common/crypto/apiKeyC
|
||||
import { MASKED_SETTING_VALUE, normalizeAppearance } from '@trek/shared';
|
||||
import { readEnv } from '../../app-config';
|
||||
|
||||
const ENCRYPTED_SETTING_KEYS = new Set(['webhook_url', 'ntfy_token', 'mapbox_access_token', 'llm_api_key']);
|
||||
const ENCRYPTED_SETTING_KEYS = new Set([
|
||||
'webhook_url',
|
||||
'ntfy_token',
|
||||
'mapbox_access_token',
|
||||
'carto_api_key',
|
||||
'llm_api_key',
|
||||
]);
|
||||
// Encrypted keys that are masked (••••••••) when returned to the client.
|
||||
// Keys not in this set but in ENCRYPTED_SETTING_KEYS are decrypted and returned.
|
||||
const MASKED_SETTING_KEYS = new Set(['webhook_url', 'ntfy_token', 'llm_api_key']);
|
||||
@@ -19,6 +25,10 @@ export const DEFAULTABLE_USER_SETTING_KEYS = [
|
||||
'default_currency',
|
||||
'blur_booking_codes',
|
||||
'map_tile_url',
|
||||
// CARTO stamps an "API KEY REQUIRED" watermark into keyless tiles (#2054), and
|
||||
// the key is per-instance rather than per-person: defaultable so one admin
|
||||
// value clears the watermark for everybody at once.
|
||||
'carto_api_key',
|
||||
// Instance-wide GL map defaults: admins can set Mapbox token/style or
|
||||
// tokenless MapLibre/OpenFreeMap style defaults for new users (#920).
|
||||
'map_provider',
|
||||
@@ -216,6 +226,12 @@ export class SettingsService {
|
||||
merged.map_provider = 'mapbox-gl';
|
||||
}
|
||||
}
|
||||
// Injected the same way, but without touching map_provider: a CARTO key only
|
||||
// says whose basemap account the tiles are billed to, nothing about which
|
||||
// renderer the user wants.
|
||||
if (readEnv().managed.enabled && managedMaps.cartoKey) {
|
||||
merged.carto_api_key = managedMaps.cartoKey;
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user