mirror of
https://github.com/everoddandeven/monerod-gui.git
synced 2025-01-18 08:44:43 +00:00
Fix daemon url
This commit is contained in:
parent
5e46d68c24
commit
42739d9456
2 changed files with 34 additions and 26 deletions
|
@ -91,9 +91,25 @@ export class DaemonService {
|
||||||
private openDbPromise: Promise<IDBPDatabase>;
|
private openDbPromise: Promise<IDBPDatabase>;
|
||||||
|
|
||||||
private daemonRunning?: boolean;
|
private daemonRunning?: boolean;
|
||||||
private url: string = "http://127.0.0.1:28081";
|
private get url(): string {
|
||||||
|
return `http://127.0.0.1:${this.port}`;
|
||||||
|
}
|
||||||
public settings: DaemonSettings;
|
public settings: DaemonSettings;
|
||||||
|
|
||||||
|
private get port(): number {
|
||||||
|
if (this.settings.rpcBindPort > 0) {
|
||||||
|
return this.settings.rpcBindPort;
|
||||||
|
}
|
||||||
|
else if (this.settings.mainnet) {
|
||||||
|
return 18081;
|
||||||
|
}
|
||||||
|
else if (this.settings.testnet) {
|
||||||
|
return 28081;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 38081;
|
||||||
|
}
|
||||||
|
|
||||||
//private url: string = "http://node2.monerodevs.org:28089";
|
//private url: string = "http://node2.monerodevs.org:28089";
|
||||||
//private url: string = "https://testnet.xmr.ditatompel.com";
|
//private url: string = "https://testnet.xmr.ditatompel.com";
|
||||||
//private url: string = "https://xmr.yemekyedim.com:18081";
|
//private url: string = "https://xmr.yemekyedim.com:18081";
|
||||||
|
@ -119,22 +135,11 @@ export class DaemonService {
|
||||||
this.openDbPromise = this.openDatabase();
|
this.openDbPromise = this.openDatabase();
|
||||||
this.settings = new DaemonSettings();
|
this.settings = new DaemonSettings();
|
||||||
|
|
||||||
const wdw = (window as any);
|
window.electronAPI.onMoneroClose((event: any, code: number) => {
|
||||||
|
console.log(event);
|
||||||
if (this.electronService.isElectron) {
|
console.log(code);
|
||||||
this.electronService.ipcRenderer.on('monero-close', (event, code: number | null) => {
|
this.onClose();
|
||||||
console.log(event);
|
});
|
||||||
console.log(code);
|
|
||||||
this.onClose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (wdw.electronAPI && wdw.electronAPI.onMoneroClose) {
|
|
||||||
wdw.electronAPI.onMoneroClose((event: any, code: number) => {
|
|
||||||
console.log(event);
|
|
||||||
console.log(code);
|
|
||||||
this.onClose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async isWifiConnected(): Promise<boolean> {
|
public async isWifiConnected(): Promise<boolean> {
|
||||||
|
@ -365,18 +370,20 @@ export class DaemonService {
|
||||||
|
|
||||||
if (started) {
|
if (started) {
|
||||||
console.log("Daemon started");
|
console.log("Daemon started");
|
||||||
this.isRunning(true).then((running: boolean) => {
|
this.delay(3000).then(() => {
|
||||||
this.onDaemonStatusChanged.emit(running);
|
this.isRunning(true).then((running: boolean) => {
|
||||||
this.starting = false;
|
this.onDaemonStatusChanged.emit(running);
|
||||||
resolve();
|
this.starting = false;
|
||||||
|
resolve();
|
||||||
|
}).catch((error: any) => {
|
||||||
|
console.error(error);
|
||||||
|
this.onDaemonStatusChanged.emit(false);
|
||||||
|
this.starting = false;
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
}).catch((error: any) => {
|
}).catch((error: any) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.onDaemonStatusChanged.emit(false);
|
|
||||||
this.starting = false;
|
|
||||||
reject(error);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Daemon not started");
|
console.log("Daemon not started");
|
||||||
|
|
|
@ -60,6 +60,7 @@ declare global {
|
||||||
electronAPI: {
|
electronAPI: {
|
||||||
startMonerod: (options: string[]) => void;
|
startMonerod: (options: string[]) => void;
|
||||||
onMonerodStarted: (callback: (event: any, started: boolean) => void) => void;
|
onMonerodStarted: (callback: (event: any, started: boolean) => void) => void;
|
||||||
|
onMoneroClose: (callback: (event: any, code: number) => void) => void;
|
||||||
isWifiConnected: () => void;
|
isWifiConnected: () => void;
|
||||||
onIsWifiConnectedResponse: (callback: (event: any, connected: boolean) => void) => void;
|
onIsWifiConnectedResponse: (callback: (event: any, connected: boolean) => void) => void;
|
||||||
getOsType: () => void;
|
getOsType: () => void;
|
||||||
|
|
Loading…
Reference in a new issue