summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Controller/ApiController.php1
-rw-r--r--apps/files/lib/Controller/ViewController.php2
-rw-r--r--apps/files/tests/Controller/ViewControllerTest.php1
3 files changed, 4 insertions, 0 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index fd0f3bdf261..c5ac4b9afc8 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -400,6 +400,7 @@ class ApiController extends Controller {
/**
* @NoAdminRequired
* @NoCSRFRequired
+ * @PublicPage
*/
public function serviceWorker(): StreamResponse {
$response = new StreamResponse(__DIR__ . '/../../../../dist/preview-service-worker.js');
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index d06ea49ed17..e26d6bced65 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -320,6 +320,8 @@ class ViewController extends Controller {
);
$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
+ // Allow preview service worker
+ $policy->addAllowedWorkerSrcDomain('\'self\'');
$response->setContentSecurityPolicy($policy);
$this->provideInitialState($dir, $openfile);
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php
index 64f0f10671c..43a999bc5af 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -402,6 +402,7 @@ class ViewControllerTest extends TestCase {
);
$policy = new Http\ContentSecurityPolicy();
$policy->addAllowedFrameDomain('\'self\'');
+ $policy->addAllowedWorkerSrcDomain('\'self\'');
$expected->setContentSecurityPolicy($policy);
$this->activityHelper->method('getFavoriteFilePaths')