Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manifest.json for PWA support #392

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 2 additions & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Paimon.moe</title>
<meta name="theme-color" content="#333333" />
<meta property="og:title" content="Paimon.moe" />
<meta property="og:type" content="website" />
Expand All @@ -12,7 +13,7 @@
href="https://fonts.googleapis.com/css2?family=Catamaran:wght@600;700;900&family=Poppins:wght@400;500;600&display=swap"
rel="stylesheet"
/>
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link rel="manifest" href="/pwa-manifest.json" crossorigin="use-credentials" />
<link rel="icon" type="image/png" href="/favicon.png" />

<!-- <script src="https://js.sentry-cdn.com/446c4cef71a54aafb71b698555500b7d.min.js" crossorigin="anonymous"></script> -->
Expand Down
6 changes: 3 additions & 3 deletions src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ self.addEventListener('activate', (event) => {
}
}

self.clients.claim();
await self.clients.claim();
console.log('SW NEED UPDATE', needUpdate);
if (needUpdate) {
channel.postMessage({
Expand All @@ -50,7 +50,7 @@ self.addEventListener('activate', (event) => {
});
}

fetchAddCache('/');
await fetchAddCache('/');
channel.addEventListener('message', (event) => {
if (event.data.type === 'fetch-doc') {
fetchAddCache(event.data.path);
Expand All @@ -74,7 +74,7 @@ self.addEventListener('fetch', async (event) => {
}

const res = await fetch(event.request);
if (res.ok) cache.put(event.request, res.clone());
if (res.ok) await cache.put(event.request, res.clone());
return res;
})(),
);
Expand Down
File renamed without changes.