Skip to content

Commit

Permalink
feat(config): overwrite outdated public node url on new sheikah update
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Jun 2, 2022
1 parent 23fcd7d commit a8a75fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/background/autoUpdaterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { autoUpdater } from 'electron-updater'
import { BrowserWindow, dialog } from 'electron'
import { WalletManager } from './walletManager'
import { AppManager } from './appManager'
import overwriteWalletConfigFile from './utils/overwriteWalletConfigFile'
import {
SHEIKAH_PATH,
WITNET_CONFIG_FILE_NAME,
URLS_PUBLIC_WITNET_NODES,
} from './constants'

export class AutoUpdaterManager {
public isBeingUpdated: boolean = false
Expand Down Expand Up @@ -34,6 +40,11 @@ export class AutoUpdaterManager {
cancelId: 1, // bound to buttons array
}
this.wallet.setIsUpdating(true)
overwriteWalletConfigFile({
sheikahPath: SHEIKAH_PATH,
witnetConfigFileName: WITNET_CONFIG_FILE_NAME,
publicNodeUrls: URLS_PUBLIC_WITNET_NODES,
})
dialog
.showMessageBox(this.app.win as BrowserWindow, options)
.then(result => {
Expand Down
3 changes: 2 additions & 1 deletion src/background/utils/overwriteWalletConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export function overwriteWalletConfigFile({
.replace(
'node_url = "127.0.0.1:21338"',
`node_url = ${JSON.stringify(publicNodeUrls)}\n`.replace("'", ''),
),
)
.replace('52.166.178.145:21338', `20.126.70.77:21338`.replace("'", '')),
)
} catch (error) {
console.log('Error overwriting configuration file')
Expand Down

0 comments on commit a8a75fd

Please sign in to comment.