Add web/ — PTY+WebSocket server, xterm.js PWA client, Dockerfile, and PyInstaller notes

This commit is contained in:
KansaiGaijin
2026-07-07 13:21:45 +12:00
parent dee742b1e4
commit 262292228e
11 changed files with 283 additions and 0 deletions

22
web/static/sw.js Normal file
View File

@@ -0,0 +1,22 @@
const CACHE = "kanjin-v1";
const PRECACHE = ["/", "/static/manifest.json"];
self.addEventListener("install", (e) => {
e.waitUntil(
caches.open(CACHE).then((c) => c.addAll(PRECACHE)).then(() => self.skipWaiting())
);
});
self.addEventListener("activate", (e) => {
e.waitUntil(
caches.keys().then((keys) =>
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
).then(() => self.clients.claim())
);
});
self.addEventListener("fetch", (e) => {
e.respondWith(
caches.match(e.request).then((r) => r || fetch(e.request))
);
});