Skip to content

Commit

Permalink
other: disable service worker in debug mode
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Nov 14, 2023
1 parent 623cbe5 commit 7eb232c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Controller/OtherController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ public function static(string $name): Http\Response
return Util::guardEx(static function () use ($name) {
switch ($name) {
case 'service-worker.js':
// Disable service worker if server is in debug mode
if (\OC::$server->get(\OCP\IConfig::class)->getSystemValue('debug', false)) {
throw Exceptions::NotFound('Service worker is disabled in debug mode');
}

$response = (new StreamResponse(__DIR__.'/../../js/memories-service-worker.js'))->setHeaders([
'Content-Type' => 'application/javascript',
'Service-Worker-Allowed' => '/',
Expand Down

0 comments on commit 7eb232c

Please sign in to comment.