fix config loading

This commit is contained in:
Anton Bracke
2022-02-22 20:24:09 +01:00
parent 445bcaf130
commit 44a9e2aeb0
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -58,13 +58,14 @@ export default () => {
ipcMain.handle("local-app:addServer", (event, server: Omit<Server, "_id">) => {
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,
+1 -1
View File
@@ -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;