feat: 首次推送到Gitea - 完整项目代码 + 安全加固 + 知识库

This commit is contained in:
ZhuiGuangAI Dev
2026-10-02 18:52:49 +08:00
parent b44601bb66
commit 8205ae709c
1185 changed files with 49841 additions and 12802 deletions
+33
View File
@@ -0,0 +1,33 @@
// Simple service worker for PWA
const CACHE_NAME = 'zhuiguang-v1';
self.addEventListener('install', (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(clients.claim());
});
self.addEventListener('fetch', (event) => {
// Network-first strategy for API routes
// Cache-first for static assets
const url = new URL(event.request.url);
if (url.pathname.startsWith('/_next/') || url.pathname.includes('/fonts/') || url.pathname.includes('/logos/')) {
// Cache static assets
event.respondWith(
caches.match(event.request).then((cached) => {
const fetchPromise = fetch(event.request).then((response) => {
if (response.ok) {
const clone = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
}
return response;
});
return cached || fetchPromise;
})
);
}
// All other requests: network-only (don't cache dynamic content)
});