fixed service worker

This commit is contained in:
Luca Haid
2025-04-09 21:42:46 +02:00
parent 3d7bc55302
commit cbb6497d77
3 changed files with 23 additions and 11 deletions

View File

@@ -240,6 +240,27 @@ class PatchingController extends mfBaseController {
$this->redirect("Patching","Index", $qs);
}
protected function swAction() {
$javascript = "self.addEventListener('install', event => {
console.log('Patching PWA Service Worker: Installing...');
});
self.addEventListener('activate', event => {
console.log('Patching PWA Service Worker: Activating...');
});
console.log('Patching PWA Service Worker: Script loaded.');";
header("Content-Type: application/javascript");
header("Service-Worker-Allowed: /");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header("Expires: 0");
echo $javascript;
exit;
}
}