Skip to content

Commit

Permalink
restore new config generation
Browse files Browse the repository at this point in the history
  • Loading branch information
BigslimVdub committed Jul 26, 2020
1 parent 80e89bf commit 84a646f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 108 deletions.
84 changes: 0 additions & 84 deletions src-electron/main-process/auto-updater.js

This file was deleted.

38 changes: 15 additions & 23 deletions src-electron/main-process/modules/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require("fs");
const path = require("path");

export class Backend {
constructor (mainWindow) {
constructor(mainWindow) {
this.mainWindow = mainWindow
this.daemon = null
this.walletd = null
Expand All @@ -22,7 +22,8 @@ export class Backend {
}

init(config) {
if (os.platform() === "win32") {

if(os.platform() == "win32") {
this.config_dir = "C:\\ProgramData\\Aeon";
//this.config_dir = path.join(os.homedir(), "Aeon");
} else {
Expand Down Expand Up @@ -148,29 +149,15 @@ export class Backend {
if(i == "appearance") return
Object.keys(this.config_data[i]).map(j => {
if(this.config_data[i][j] !== params[i][j])
{config_changed = true}
config_changed = true
})
})
case "save_config_init":
Object.keys(params).map(key => {
this.config_data[key] = Object.assign(this.config_data[key], params[key])
})

const validated = Object.keys(this.defaults)
.filter(k => k in this.config_data)
.map(k => [k, this.validate_values(this.config_data[k], this.defaults[k])])
.reduce((map, obj) => {
map[obj[0]] = obj[1]
return map
}, {})

// Validate deamon data
this.config_data = {
...this.config_data,
...validated
}

});
fs.writeFile(this.config_file, JSON.stringify(this.config_data, null, 4), 'utf8', () => {

if(data.method == "save_config_init") {
this.startup();
} else {
Expand Down Expand Up @@ -326,20 +313,25 @@ export class Backend {
}
});
}).catch(error => {
this.daemon.killProcess()
this.send("show_notification", { type: "negative", message: error.message, timeout: 3000 })
this.daemon.killProcess();
this.send("show_notification", {
type: "negative",
message: error.message,
timeout: 2000
})
this.send("set_app_data", {
status: {
code: -1 // Return to config screen
}
});
return;
});

}).catch(error => {
if(this.config_data.daemon.type == "remote") {
this.send("show_notification", {type: "negative", message: "Remote daemon cannot be reached", timeout: 3000})
this.send("show_notification", {type: "negative", message: "Remote daemon cannot be reached", timeout: 2000})
} else {
this.send("show_notification", {type: "negative", message: "Local daemon internal error", timeout: 3000})
this.send("show_notification", {type: "negative", message: "Local daemon internal error", timeout: 2000})
}
this.send("set_app_data", {
status: {
Expand Down
2 changes: 1 addition & 1 deletion src-electron/main-process/modules/wallet-rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ export class WalletRPC {

sendGateway(method, data) {
// if wallet is closed, do not send any wallet data to gateway
// this is for the case that we close the wallet at the same
// this is for the case that we close the wallet at the same time
// after another action has started, but before it has finished
if(!this.wallet_state.open && method == "set_wallet_data")
return
Expand Down

0 comments on commit 84a646f

Please sign in to comment.