Add Web Push, guided start screen, SVG icons, chunked uploads, rename
- Web Push (VAPID + RFC 8291, pure Rust): permission/question/finished notifications while no app window is visible; settings with test button - Guided new-session flow: task, craft target (website/app/game/old software/fresh), clean room or deep, description, model, folder (new, existing or cloned git repository); originals upload to original/ - Craft phase bar (craft_phase tool) for study/specify/build/check/ready - Chunked uploads (8 MB) up to server.max_upload_mb (default 500 MB) - All UI glyphs and emojis replaced by themeable SVG icons - Rename dialog with manual name or model-generated suggestion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
013695722a
commit
a0d0e707f2
48 files changed
+2724
-228
No files matched your search
@@ -62,6 +62,7 @@ export function connectEvents(handlers: {
|
||||
ws = new WebSocket(`${proto}://${location.host}/api/ws`);
|
||||
ws.onopen = () => {
|
||||
retry = 0;
|
||||
reportVisibility();
|
||||
handlers.onOpen();
|
||||
};
|
||||
ws.onmessage = (m) => {
|
||||
@@ -80,7 +81,12 @@ export function connectEvents(handlers: {
|
||||
};
|
||||
open();
|
||||
// Reconnect immediately when the app comes back to the foreground (mobile PWA).
|
||||
// The server sends push notifications only while no app window is visible.
|
||||
const reportVisibility = () => {
|
||||
if (ws?.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: "visibility", visible: document.visibilityState === "visible" }));
|
||||
};
|
||||
const onVisible = () => {
|
||||
reportVisibility();
|
||||
if (document.visibilityState === "visible" && ws && ws.readyState > WebSocket.OPEN) {
|
||||
clearTimeout(timer);
|
||||
open();
|
||||
@@ -94,3 +100,28 @@ export function connectEvents(handlers: {
|
||||
ws?.close();
|
||||
};
|
||||
}
|
||||
|
||||
const CHUNK = 8 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* Upload a file in 8 MB chunks (stays below reverse proxy body limits; up to the
|
||||
* server's max_upload_mb). `onProgress` gets the uploaded fraction 0..1.
|
||||
*/
|
||||
export async function uploadFile(path: string, file: Blob, onProgress?: (fraction: number) => void): Promise<void> {
|
||||
let offset = 0;
|
||||
do {
|
||||
const chunk = file.slice(offset, offset + CHUNK);
|
||||
const res = await fetch(`/api/files/upload?path=${encodeURIComponent(path)}&offset=${offset}`, { method: "PUT", body: chunk, credentials: "same-origin" });
|
||||
if (!res.ok) {
|
||||
let msg = `HTTP ${res.status}`;
|
||||
try {
|
||||
msg = (await res.json()).error ?? msg;
|
||||
} catch {
|
||||
if (res.status === 413) msg = "too large for the reverse proxy";
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
offset += chunk.size;
|
||||
onProgress?.(file.size ? offset / file.size : 1);
|
||||
} while (offset < file.size);
|
||||
}
|
||||
Reference in new issue
Block a user