mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 18:34:09 +00:00
feat(maps): MAP_EXTRA_CONNECT_HOSTS adds the operator's map hosts to the CSP
A GL map fetches its tiles and its style, so a template on a host of the operator's own (a self-hosted tile server) was refused by connect-src while Leaflet drew it as images. The new variable lists such hosts; each entry becomes an https source in connect-src and the same list reaches the client as map_extra_connect_hosts in the app config, so the renderer choice and the policy can never disagree. The variable is owned by readEnv() like the rest of the maps namespace and read once when the middleware is applied. The boot refuses an entry outside the shared grammar; a path that skips the boot check drops it, so a bad value never widens the policy. Unset, the CSP and the app config are as before apart from an empty list. Documented in .env.example, docker-compose.yml, the Helm values and ConfigMap and the wiki. Making room for the app config field shrinks auth.service.ts by one line, and its size baseline follows.
This commit is contained in:
@@ -72,6 +72,7 @@ services:
|
||||
# - AMAP_API_KEY= # Optional. Amap (高德地图) Web 服务 key for place search and geocoding inside mainland China. Overrides the key set in Admin > Settings > API Keys. A Web 端 (JS API) key is a different credential and is rejected with INVALID_USER_KEY.
|
||||
# - AMAP_API_SECRET= # Optional. The private secret (数字签名) of that key. Required exactly when the key was created with signing enabled, because such a key rejects every unsigned request. Leave unset otherwise.
|
||||
# - AMAP_API_BASE=https://restapi.amap.com # Optional. Send the Amap calls through an egress proxy, a cache or a gateway that speaks the same API instead of restapi.amap.com directly. (default: https://restapi.amap.com)
|
||||
# - MAP_EXTRA_CONNECT_HOSTS= # Optional. Hosts of your own map tiles or vector styles that the GL maps (MapLibre, Mapbox) may load, comma-separated, e.g. a self-hosted tile server. Each entry is a host name (tiles.example.com), optionally with a port (tiles.example.com:8443) or as a wildcard over its subdomains (*.tiles.example.com); https is implied, so no scheme or path. They are added to the Content-Security-Policy and told to the app, which otherwise draws a map template on such a host with the classic 2D map. An entry that is not a plain host name aborts startup. Read once at startup. (default: none)
|
||||
# - VAPID_PUBLIC_KEY= # Optional. Web Push key pair, public half (base64url). Unset, TREK generates a pair on first start and keeps it in the database, so it travels with backups. Set it together with VAPID_PRIVATE_KEY to use your own, e.g. from `npx web-push generate-vapid-keys`. Changing the pair means every device has to turn push on again.
|
||||
# - VAPID_PRIVATE_KEY= # Optional. Web Push key pair, private half (base64url). Only used together with VAPID_PUBLIC_KEY; a mismatched pair, or only one half, turns push off with an error in the log until it is fixed, and every device stays registered.
|
||||
# - VAPID_SUBJECT=mailto:admin@example.com # Optional. The contact push services see with every message: a mailto: address or an https:// URL. Defaults to APP_URL when it is https, else the TREK project page.
|
||||
|
||||
Reference in New Issue
Block a user