We PWA now

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2023-04-09 00:41:45 +02:00
parent e8083c898d
commit 7ad4e2d2b1
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
69 changed files with 15 additions and 0 deletions

View file

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<!--server-generated-meta-->
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="hidden">
<noscript>To use Pleroma, please enable JavaScript.</noscript>

View file

@ -56,6 +56,20 @@ const persistedStateOptions = {
};
(async () => {
if ('serviceWorker' in navigator) {
// declaring scope manually
navigator.serviceWorker.register('/sw-pleroma.js', { scope: '/' }).then(
(registration) => {
console.log('Service worker registration succeeded:', registration)
},
/* catch */ (error) => {
console.error(`Service worker registration failed: ${error}`)
}
)
} else {
console.error('Service workers are not supported.')
}
let storageError = false
const plugins = [pushNotifications]
try {