From 00ff5c1c38e2bec1cdeb3cd733469003b66baaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Fri, 15 Mar 2024 09:40:12 +0100 Subject: [PATCH] Simplify authentication logic --- src/lib/httpd.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/httpd.ts b/src/lib/httpd.ts index 1e70dd376..b9bc9b01a 100644 --- a/src/lib/httpd.ts +++ b/src/lib/httpd.ts @@ -139,6 +139,7 @@ async function checkState() { httpdState = JSON.parse(rawHttpdState); } catch (error) { console.error(error); + return; } } @@ -153,10 +154,6 @@ async function checkState() { scope: config?.scope, }; - if (httpdState && httpdState.state !== "stopped") { - httpdState.node = node; - } - if (httpdState && httpdState.state === "authenticated") { const sess = await api.session.getById(httpdState.session.id); const unixTimeInSeconds = Math.floor(Date.now() / 1000); @@ -169,7 +166,7 @@ async function checkState() { node, }); } else { - update(httpdState); + update({ ...httpdState, node }); } } else { update({