From 059ef2c1bc2ea5fb377a0f1e253652c0c243e250 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 17 Oct 2023 16:43:50 +0200 Subject: [PATCH] Fix: safari-specific fixes --- scripts/generateLayouts.ts | 1 + src/Logic/State/GeoLocationState.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index 00efe42ac8..f40ece773c 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -316,6 +316,7 @@ async function generateCsp( "script-src": ["'self'", "https://gc.zgo.at/count.js", ...(options?.scriptSrcs ?? [])].join( " ", ), + "child-src": "self", "img-src": "* data:", // maplibre depends on 'data:' to load "connect-src": connectSrc.join(" "), "report-to": "https://report.mapcomplete.org/csp", diff --git a/src/Logic/State/GeoLocationState.ts b/src/Logic/State/GeoLocationState.ts index 435002e79c..814d5966e3 100644 --- a/src/Logic/State/GeoLocationState.ts +++ b/src/Logic/State/GeoLocationState.ts @@ -119,6 +119,12 @@ export class GeoLocationState { return } + if(navigator.permissions === undefined && navigator.geolocation !== undefined){ + // This is probably safari - we just start watching right away + this.startWatching() + return + } + this.permission.setData("requested") try { const status = await navigator?.permissions?.query({ name: "geolocation" })