mirror of
https://github.com/everoddandeven/monerod-gui.git
synced 2025-01-03 09:29:36 +00:00
Optimize wifi check, disable dev tools
This commit is contained in:
parent
ab0c54c458
commit
5d7324ced2
2 changed files with 15 additions and 13 deletions
|
@ -68,15 +68,12 @@ function createWindow(): BrowserWindow {
|
|||
preload: path.join(__dirname, 'preload.js'),
|
||||
nodeIntegration: false,
|
||||
allowRunningInsecureContent: (serve),
|
||||
contextIsolation: true,
|
||||
devTools: true,
|
||||
contextIsolation: true
|
||||
},
|
||||
autoHideMenuBar: true,
|
||||
icon: wdwIcon
|
||||
});
|
||||
|
||||
//win.webContents.openDevTools();
|
||||
//win.setIcon()
|
||||
|
||||
if (serve) {
|
||||
const debug = require('electron-debug');
|
||||
|
@ -139,14 +136,12 @@ function isWifiConnectedOld() {
|
|||
const networkInterfaces = os.networkInterfaces();
|
||||
|
||||
console.log(`isWifiConnected(): network interfaces ${networkInterfaces}`);
|
||||
console.log(networkInterfaces);
|
||||
|
||||
for (const interfaceName in networkInterfaces) {
|
||||
const networkInterface = networkInterfaces[interfaceName];
|
||||
|
||||
if (networkInterface) {
|
||||
for (const network of networkInterface) {
|
||||
console.log(network);
|
||||
if (network.family === 'IPv4' && !network.internal && network.mac !== '00:00:00:00:00:00') {
|
||||
if (interfaceName.toLowerCase().includes('wifi') || interfaceName.toLowerCase().includes('wlan')) {
|
||||
return true;
|
||||
|
|
|
@ -337,17 +337,24 @@ export class DaemonDataService {
|
|||
}
|
||||
|
||||
const syncAlreadyDisabled = this.daemonService.settings.noSync;
|
||||
const wifiConnected = await this.daemonService.isWifiConnected();
|
||||
|
||||
if (!settings.noSync && !syncAlreadyDisabled && !settings.syncOnWifi && wifiConnected) {
|
||||
console.log("Disabling sync ...");
|
||||
if (!settings.noSync && !syncAlreadyDisabled && !settings.syncOnWifi) {
|
||||
const wifiConnected = await this.daemonService.isWifiConnected();
|
||||
|
||||
await this.daemonService.disableSync();
|
||||
if (wifiConnected) {
|
||||
console.log("Disabling sync ...");
|
||||
await this.daemonService.disableSync();
|
||||
}
|
||||
}
|
||||
else if (!settings.noSync && syncAlreadyDisabled && !settings.syncOnWifi && !wifiConnected) {
|
||||
console.log("Enabling sync ...");
|
||||
else if (!settings.noSync && syncAlreadyDisabled && !settings.syncOnWifi) {
|
||||
const wifiConnected = await this.daemonService.isWifiConnected();
|
||||
|
||||
if (!wifiConnected) {
|
||||
console.log("Enabling sync ...");
|
||||
|
||||
await this.daemonService.enableSync();
|
||||
}
|
||||
|
||||
await this.daemonService.enableSync();
|
||||
}
|
||||
|
||||
this.syncStart.emit({ first: this._firstRefresh });
|
||||
|
|
Loading…
Reference in a new issue