From 7007d4850c415abbd66fd0859ef724ce5095b144 Mon Sep 17 00:00:00 2001 From: pomdtr Date: Fri, 8 Dec 2023 22:40:22 +0100 Subject: [PATCH] add a confirm action when tweety is not running --- frontend/src/terminal.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/terminal.ts b/frontend/src/terminal.ts index a1ec4d0..107f02d 100644 --- a/frontend/src/terminal.ts +++ b/frontend/src/terminal.ts @@ -27,6 +27,14 @@ async function main() { origin = new URL(window.location.origin) } + // check if tweety is running + const resp = await fetch(new URL("/ping", origin)) + if (!resp.ok) { + confirm("Tweety is not running. Reload?") + window.close() + return + } + const config = await fetchJSON(new URL("/config", origin)) as Config const lightTheme = await fetchTheme(config.theme || "Tomorrow", origin) const darkTheme = await fetchTheme(config.themeDark || config.theme || "Tomorrow Night", origin)