This commit is contained in:
2022-04-29 23:32:11 +08:00
parent cc1c894d9b
commit d49d224ba4
14 changed files with 180 additions and 4 deletions

BIN
public/avatar.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

22
public/manifest.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "It's me, 186526!",
"short_name": "186526.xyz",
"lang": "zh-CN",
"start_url": "/",
"display": "standalone",
"theme_color": "#2A2734",
"background_color": "#FBDBC4",
"icons": [
{
"src": "./maskable.png",
"sizes": "1269x1269",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "./avatar.webp",
"sizes": "512x512",
"type": "image/webp"
}
]
}

BIN
public/maskable.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

49
public/sw.js Normal file
View File

@ -0,0 +1,49 @@
importScripts(
'workbox/workbox-sw.js',
);
self.addEventListener('install', (e) => {
self.skipWaiting();
});
if (workbox) {
workbox.core.setCacheNameDetails({
prefix: 'home-app',
suffix: '0.0.2',
precache: 'precache',
runtime: 'runtime',
});
workbox.routing.registerRoute(
/\/assets/,
new workbox.strategies.CacheFirst({
plugins: [
new workbox.expiration.Plugin({
maxAgeSeconds: 24 * 60 * 60,
}),
],
cacheName: 'assets',
}),
);
workbox.routing.registerRoute(
'/manifest.json',
new workbox.strategies.StaleWhileRevalidate({
plugins: [
new workbox.expiration.Plugin({
maxAgeSeconds: 7 * 24 * 60 * 60,
}),
],
cacheName: 'startpage_me',
}),
);
workbox.routing.registerRoute(
'/',
new workbox.strategies.StaleWhileRevalidate({
plugins: [
new workbox.expiration.Plugin({
maxAgeSeconds: 60 * 60 * 24,
}),
],
cacheName: 'startpage_me',
}),
);
}

1
public/workbox Symbolic link
View File

@ -0,0 +1 @@
../node_modules/workbox-cdn/workbox