chore: sync
This commit is contained in:
BIN
sproutgate-frontend/public/apple-touch-icon.png
Normal file
BIN
sproutgate-frontend/public/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
sproutgate-frontend/public/favicon.ico
Normal file
BIN
sproutgate-frontend/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
BIN
sproutgate-frontend/public/icon-192.png
Normal file
BIN
sproutgate-frontend/public/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
sproutgate-frontend/public/icon-512.png
Normal file
BIN
sproutgate-frontend/public/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 308 KiB |
BIN
sproutgate-frontend/public/logo.png
Normal file
BIN
sproutgate-frontend/public/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
BIN
sproutgate-frontend/public/logo192.png
Normal file
BIN
sproutgate-frontend/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
23
sproutgate-frontend/public/manifest.webmanifest
Normal file
23
sproutgate-frontend/public/manifest.webmanifest
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "萌芽账户认证中心",
|
||||
"short_name": "SproutGate",
|
||||
"description": "统一认证与账户管理中心",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#f4f6fb",
|
||||
"theme_color": "#3b82f6",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
64
sproutgate-frontend/public/sw.js
Normal file
64
sproutgate-frontend/public/sw.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const CACHE_NAME = "sproutgate-v1";
|
||||
const PRECACHE_URLS = [
|
||||
"/",
|
||||
"/index.html",
|
||||
"/manifest.webmanifest",
|
||||
"/favicon.ico",
|
||||
"/logo.png",
|
||||
"/logo192.png",
|
||||
"/icon-192.png",
|
||||
"/icon-512.png",
|
||||
"/apple-touch-icon.png"
|
||||
];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.open(CACHE_NAME)
|
||||
.then((cache) => cache.addAll(PRECACHE_URLS))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.keys()
|
||||
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
|
||||
.then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
const { request } = event;
|
||||
if (request.method !== "GET") return;
|
||||
|
||||
const url = new URL(request.url);
|
||||
if (url.origin !== self.location.origin) return;
|
||||
|
||||
if (request.mode === "navigate") {
|
||||
event.respondWith(
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(request).then((cached) => cached || caches.match("/index.html")))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
caches.match(request).then((cached) =>
|
||||
cached ||
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
|
||||
return response;
|
||||
})
|
||||
.catch(() => cached)
|
||||
)
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user