fix config loading
This commit is contained in:
parent
445bcaf130
commit
44a9e2aeb0
@ -58,13 +58,14 @@ export default () => {
|
|||||||
ipcMain.handle("local-app:addServer", (event, server: Omit<Server, "_id">) => {
|
ipcMain.handle("local-app:addServer", (event, server: Omit<Server, "_id">) => {
|
||||||
const servers = settings.get("servers") || [];
|
const servers = settings.get("servers") || [];
|
||||||
|
|
||||||
try {
|
// TODO: add proper test to see if server url is valid and points to a real WA server
|
||||||
// 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) {
|
// await fetch(`${server.url}/iframe_api.js`);
|
||||||
console.error(e);
|
// } catch (e) {
|
||||||
return new Error("Invalid server url");
|
// console.error(e);
|
||||||
}
|
// return new Error("Invalid server url");
|
||||||
|
// }
|
||||||
|
|
||||||
const newServer = {
|
const newServer = {
|
||||||
...server,
|
...server,
|
||||||
|
@ -29,7 +29,7 @@ const defaultSettings: SettingsData = {
|
|||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
let _settings = await Settings.get();
|
let _settings = await Settings.get();
|
||||||
if (_settings !== undefined) {
|
if (Object.keys(_settings).length === 0) {
|
||||||
_settings = defaultSettings;
|
_settings = defaultSettings;
|
||||||
}
|
}
|
||||||
settings = _settings as SettingsData;
|
settings = _settings as SettingsData;
|
||||||
|
Loading…
Reference in New Issue
Block a user