From 44a9e2aeb03a7316ba22e8f9f25c9c4182cda59f Mon Sep 17 00:00:00 2001 From: Anton Bracke Date: Tue, 22 Feb 2022 20:24:09 +0100 Subject: [PATCH] fix config loading --- desktop/electron/src/ipc.ts | 15 ++++++++------- desktop/electron/src/settings.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/desktop/electron/src/ipc.ts b/desktop/electron/src/ipc.ts index 959d5246..462c4e8d 100644 --- a/desktop/electron/src/ipc.ts +++ b/desktop/electron/src/ipc.ts @@ -58,13 +58,14 @@ export default () => { ipcMain.handle("local-app:addServer", (event, server: Omit) => { const servers = settings.get("servers") || []; - try { - // TODO: add proper test to see if server url is valid and points to a real WA server - // await fetch(`${server.url}/iframe_api.js`); - } catch (e) { - console.error(e); - return new Error("Invalid server url"); - } + // TODO: add proper test to see if server url is valid and points to a real WA server + // try { + // + // await fetch(`${server.url}/iframe_api.js`); + // } catch (e) { + // console.error(e); + // return new Error("Invalid server url"); + // } const newServer = { ...server, diff --git a/desktop/electron/src/settings.ts b/desktop/electron/src/settings.ts index d9ecfc97..1694d401 100644 --- a/desktop/electron/src/settings.ts +++ b/desktop/electron/src/settings.ts @@ -29,7 +29,7 @@ const defaultSettings: SettingsData = { async function init() { let _settings = await Settings.get(); - if (_settings !== undefined) { + if (Object.keys(_settings).length === 0) { _settings = defaultSettings; } settings = _settings as SettingsData;