map: fix for sw
parent
8d4d2d6240
commit
479665ca62
|
@ -73,11 +73,7 @@ class OtherController extends ApiBase
|
||||||
'Content-Type' => 'application/javascript',
|
'Content-Type' => 'application/javascript',
|
||||||
'Service-Worker-Allowed' => '/',
|
'Service-Worker-Allowed' => '/',
|
||||||
]);
|
]);
|
||||||
$policy = new ContentSecurityPolicy();
|
$response->setContentSecurityPolicy(PageController::getCSP());
|
||||||
$policy->addAllowedWorkerSrcDomain("'self'");
|
|
||||||
$policy->addAllowedScriptDomain("'self'");
|
|
||||||
$policy->addAllowedConnectDomain("'self'");
|
|
||||||
$response->setContentSecurityPolicy($policy);
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,21 @@ class PageController extends Controller
|
||||||
/** Get the common content security policy */
|
/** Get the common content security policy */
|
||||||
public static function getCSP()
|
public static function getCSP()
|
||||||
{
|
{
|
||||||
|
// Image domains MUST be added to the connect domain list
|
||||||
|
// because of the service worker fetch() call
|
||||||
|
$addImageDomain = function ($url) use (&$policy) {
|
||||||
|
$policy->addAllowedImageDomain($url);
|
||||||
|
$policy->addAllowedConnectDomain($url);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create base policy
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedWorkerSrcDomain("'self'");
|
$policy->addAllowedWorkerSrcDomain("'self'");
|
||||||
$policy->addAllowedScriptDomain("'self'");
|
$policy->addAllowedScriptDomain("'self'");
|
||||||
|
$policy->addAllowedFrameDomain("'self'");
|
||||||
|
$policy->addAllowedImageDomain("'self'");
|
||||||
|
$policy->addAllowedMediaDomain("'self'");
|
||||||
|
$policy->addAllowedConnectDomain("'self'");
|
||||||
|
|
||||||
// Video player
|
// Video player
|
||||||
$policy->addAllowedWorkerSrcDomain('blob:');
|
$policy->addAllowedWorkerSrcDomain('blob:');
|
||||||
|
@ -116,8 +128,8 @@ class PageController extends Controller
|
||||||
|
|
||||||
// Allow OSM
|
// Allow OSM
|
||||||
$policy->addAllowedFrameDomain('www.openstreetmap.org');
|
$policy->addAllowedFrameDomain('www.openstreetmap.org');
|
||||||
$policy->addAllowedImageDomain('https://*.tile.openstreetmap.org');
|
$addImageDomain('https://*.tile.openstreetmap.org');
|
||||||
$policy->addAllowedImageDomain('https://*.a.ssl.fastly.net');
|
$addImageDomain('https://*.a.ssl.fastly.net');
|
||||||
|
|
||||||
return $policy;
|
return $policy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<LMap
|
<LMap
|
||||||
class="map"
|
class="map"
|
||||||
ref="map"
|
ref="map"
|
||||||
|
:crossOrigin="true"
|
||||||
:zoom="zoom"
|
:zoom="zoom"
|
||||||
:minZoom="2"
|
:minZoom="2"
|
||||||
@moveend="refresh"
|
@moveend="refresh"
|
||||||
|
|
Loading…
Reference in New Issue