web: installable app, diff viewer history, calmer chat
- The diff viewer is a centered panel over a dim scrim (clicking outside closes), and the browser Back button closes the open viewer/audit/artifact viewer via a modal history entry. Transient sheets opt out (they must never undo an in-app navigation on close). - The page is installable: web app manifest, 192/512/maskable icons, apple meta, and a shell service worker that never caches the socket or artifacts. - Chat: operator bubbles are accent-tinted, agent bubbles neutral with an accent edge; the tool summary is a quiet line outside the message; the star and more controls are compact 20px corner icons inside the row. - The Refresh button's tooltip shows the last data arrival (manual or socket), per destination.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// A shell cache for an installed Pipelines app. The API (the WebSocket proxy and
|
||||
// artifact files) is never cached; static files prefer the network and fall back
|
||||
// to the last good copy so an installed app still opens when the server is away.
|
||||
const CACHE = "pipelines-shell-v1";
|
||||
const SHELL = ["/", "/index.html", "/manifest.webmanifest", "/favicon.svg"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.open(CACHE)
|
||||
.then((cache) => cache.addAll(SHELL))
|
||||
.catch(() => undefined)
|
||||
.then(() => self.skipWaiting()),
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.keys()
|
||||
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE).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) return;
|
||||
if (url.pathname.startsWith("/connect") || url.pathname.startsWith("/artifacts/")) return;
|
||||
event.respondWith(
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE).then((cache) => cache.put(request, copy)).catch(() => undefined);
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(request).then((cached) => cached ?? caches.match("/"))),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user