Skip to content

Commit

Permalink
Only unregister the WS worker
Browse files Browse the repository at this point in the history
This is done so that a walrus site
can still use its' own service worker.
  • Loading branch information
Tzal3x committed Dec 19, 2024
1 parent 3e126e1 commit 897f6ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions portal/server/inject_unregister_sw_script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ export async function inject_unregister_service_worker_script(response: Response
console.log('Unregistering the walrus sites service-worker!');
navigator.serviceWorker.getRegistrations().then(registrations => {
registrations.forEach(registration => {
registration.unregister();
console.log('Service worker successfully unregistered.');
if (registration.scope.includes('walrus-sites-sw')) {
registration.unregister();
console.log('Service worker successfully unregistered.');
}
});
});
}
Expand Down

0 comments on commit 897f6ca

Please sign in to comment.