feat: rebuild xiteng.site homelab platform

This commit is contained in:
2026-08-12 09:48:25 +08:00
parent 557b0eca33
commit 5b84988789
128 changed files with 14979 additions and 292 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="18" fill="#171717"/><path d="M17 20h30v20H31l-9 8v-8h-5z" fill="#fff"/><circle cx="25" cy="30" r="2" fill="#171717"/><circle cx="32" cy="30" r="2" fill="#171717"/><circle cx="39" cy="30" r="2" fill="#171717"/></svg>

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

+18
View File
@@ -0,0 +1,18 @@
{
"name": "Xiteng Chat",
"short_name": "Chat",
"description": "使用个人 Key Vault 凭据的轻量 AI 对话界面",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#f4f4f0",
"theme_color": "#171717",
"orientation": "any",
"lang": "zh-CN",
"categories": ["productivity", "utilities"],
"icons": [
{"src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png"},
{"src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png"},
{"src": "/icons/icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable"}
]
}
+49
View File
@@ -0,0 +1,49 @@
const cacheName = "xiteng-chat-shell-v4";
const shellAssets = [
"/",
"/manifest.webmanifest",
"/favicon.svg",
"/icons/icon-192.png",
"/icons/icon-512.png",
"/icons/icon-maskable-512.png",
"/icons/apple-touch-icon.png"
];
self.addEventListener("install", (event) => {
event.waitUntil(caches.open(cacheName).then(async (cache) => {
for (const asset of shellAssets) {
try {
const response = await fetch(asset, {cache: "reload"});
if (response.ok) await cache.put(asset, response);
} catch {}
}
}).then(() => self.skipWaiting()));
});
self.addEventListener("activate", (event) => {
event.waitUntil(caches.keys()
.then((keys) => Promise.all(keys.filter((key) => key !== cacheName).map((key) => caches.delete(key))))
.then(() => self.clients.claim()));
});
self.addEventListener("fetch", (event) => {
const request = event.request;
if (request.method !== "GET") return;
const url = new URL(request.url);
if (url.origin !== self.location.origin || url.pathname.startsWith("/api/") || url.pathname.startsWith("/outpost.goauthentik.io/")) return;
if (request.mode === "navigate") {
event.respondWith(fetch(request).then((response) => {
if (response.ok) caches.open(cacheName).then((cache) => cache.put("/", response.clone()));
return response;
}).catch(async () => (await caches.match("/")) || Response.error()));
return;
}
if (shellAssets.includes(url.pathname) || /\.(?:js|css|png|svg|ico|webmanifest)$/.test(url.pathname)) {
event.respondWith(caches.match(request).then((cached) => cached || fetch(request).then((response) => {
if (response.ok) caches.open(cacheName).then((cache) => cache.put(request, response.clone()));
return response;
})));
}
});