This commit is contained in:
the-djmaze 2023-03-14 13:55:20 +01:00
parent 014d22add9
commit 308c7197c7
2 changed files with 3 additions and 9 deletions

View file

@ -160,11 +160,6 @@ $tar->addFromString('index.php', $index);
$zip->addFile('README.md'); $zip->addFile('README.md');
$tar->addFile('README.md'); $tar->addFile('README.md');
$data = file_get_contents('dev/serviceworker.js');
//$data = file_get_contents('snappymail/v/0.0.0/static/js/min/serviceworker.min.js');
$zip->addFromString('serviceworker.js', $data);
$tar->addFromString('serviceworker.js', $data);
$zip->close(); $zip->close();
$tar->compress(Phar::GZ); $tar->compress(Phar::GZ);

View file

@ -1,4 +1,4 @@
import * as Links from 'Common/Links'; import { staticLink } from 'Common/Links';
import { addObservablesTo } from 'External/ko'; import { addObservablesTo } from 'External/ko';
import { fireEvent } from 'Common/Globals'; import { fireEvent } from 'Common/Globals';
@ -61,7 +61,7 @@ export const NotificationUserStore = new class {
if (DesktopNotifications && NotificationsGranted()) { if (DesktopNotifications && NotificationsGranted()) {
const options = { const options = {
body: text, body: text,
icon: imageSrc || Links.staticLink('images/icon-message-notification.png'), icon: imageSrc || staticLink('images/icon-message-notification.png'),
data: messageData data: messageData
}; };
if (messageData?.uid) { if (messageData?.uid) {
@ -69,8 +69,7 @@ export const NotificationUserStore = new class {
} }
if (WorkerNotifications) { if (WorkerNotifications) {
// Service-Worker-Allowed HTTP header to allow the scope. // Service-Worker-Allowed HTTP header to allow the scope.
WorkerNotifications.register('./serviceworker.js') WorkerNotifications.register(staticLink('js/serviceworker.js'), {scope:'/'})
// WorkerNotifications.register(Links.staticLink('js/serviceworker.js'), {scope:'/'})
.then(() => .then(() =>
WorkerNotifications.ready.then(registration => WorkerNotifications.ready.then(registration =>
/* Show the notification */ /* Show the notification */