v0.1.3: interface scales with the window, realmlist line per Friends mode, robust close handler

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-09-30 19:42:05 +05:00
1 parent 0e1016e93c
commit 4eda03ab63
12 files changed
+80 -23

No files matched your search

+21 -16
View File
@@ -103,22 +103,27 @@ export async function installNow(): Promise<void> {
/** Install a downloaded update when the user closes the window. Call once at start-up. */
export function installOnClose(): () => void {
let stop: (() => void) | undefined;
void getCurrentWindow()
.onCloseRequested(async (event) => {
if (state.phase !== "ready" || !update || !autoUpdateEnabled()) return;
event.preventDefault();
try {
set({ phase: "installing" });
await update.install();
} catch (e) {
set({ phase: "error", error: String(e) });
await getCurrentWindow().destroy();
}
})
.then((un) => {
stop = un;
})
.catch(() => {});
try {
const win = getCurrentWindow();
void win
.onCloseRequested(async (event) => {
if (state.phase !== "ready" || !update || !autoUpdateEnabled()) return;
event.preventDefault();
try {
set({ phase: "installing" });
await update.install();
} catch (e) {
set({ phase: "error", error: String(e) });
await win.destroy();
}
})
.then((un) => {
stop = un;
})
.catch(() => {});
} catch {
/* not running inside the desktop shell (browser preview) */
}
return () => stop?.();
}