Windows standalone app fixes
Some checks failed
MacOS Build / build (20) (push) Waiting to run
MacOS 12 - x64 DMG Build / build (20) (push) Waiting to run
Ubuntu 22.04 - AppImage Build / build (20) (push) Waiting to run
Ubuntu 22.04 - x64 DEB Build / build (20) (push) Waiting to run
Ubuntu 24.04 - x64 DEB Build / build (20) (push) Waiting to run
Windows Installer Build / build (20) (push) Has been cancelled
Windows Portable Build / build (20) (push) Has been cancelled

This commit is contained in:
argenius 2024-11-01 21:45:25 +01:00
parent 7b2716e670
commit 6bc64a369b
8 changed files with 150 additions and 14 deletions

View file

@ -65,7 +65,7 @@ export default class AutoLaunchAPIWindows extends AutoLaunchAPI {
}
}
regKey.set(this.appName, Winreg.REG_SZ, `"${pathToAutoLaunchedApp}"${args}`, (err) => {
regKey.set(this.appName, Winreg.REG_SZ, args != '' ? `"${pathToAutoLaunchedApp}"` : `"${pathToAutoLaunchedApp}"`, (err) => {
if (err != null) {
return reject(err);
}

View file

@ -10,7 +10,8 @@ import * as tar from 'tar';
import * as os from 'os';
import * as pidusage from 'pidusage';
import AutoLaunch from './auto-launch';
import AdmZip from 'adm-zip';
import * as AdmZip from 'adm-zip';
const network = require('network');
interface Stats {
/**
@ -75,10 +76,19 @@ const minimized: boolean = process.argv.includes('--hidden');
let win: BrowserWindow | null = null;
let isHidden: boolean = false;
let isQuitting: boolean = false;
const dirname = __dirname.endsWith('/app/app') ? __dirname.replace('/app/app', '/app/src') : __dirname.endsWith('/app') ? __dirname.replace('/app', '/src') : __dirname;
const separator: string = os.platform() == 'win32' ? '\\' : '/';
const appApp = `${separator}app${separator}app`;
const appSrc = `${separator}app${separator}src`;
const _app = `${separator}app`;
const _src = `${separator}src`;
const dirname = (__dirname.endsWith(appApp) ? __dirname.replace(appApp, appSrc) : __dirname.endsWith(_app) ? __dirname.replace(_app, _src) : __dirname);
console.log('dirname: ' + dirname);
let monerodProcess: ChildProcessWithoutNullStreams | null = null;
const iconRelPath: string = 'assets/icons/monero-symbol-on-white-480.png';
const wdwIcon = `${dirname}/${iconRelPath}`;
//const wdwIcon = `${dirname}/${iconRelPath}`;
const wdwIcon = path.join(dirname, iconRelPath);
let tray: Tray;
let trayMenu: Menu;
@ -244,7 +254,11 @@ function createWindow(): BrowserWindow {
return win;
}
const createSplashWindow = async (): Promise<BrowserWindow> => {
const createSplashWindow = async (): Promise<BrowserWindow | undefined> => {
if (os.platform() == 'win32') {
return undefined;
}
const window = new BrowserWindow({
width: 480,
height: 480,
@ -266,7 +280,8 @@ const createSplashWindow = async (): Promise<BrowserWindow> => {
pathIndex = '../dist/splash.html';
}
const url = new URL(path.join('file:', dirname, pathIndex));
const cdir = dirname.replace('/app/', '/src/');
const url = new URL(path.join('file:', cdir, pathIndex));
await window.loadURL(url.href);
@ -285,6 +300,22 @@ const createSplashWindow = async (): Promise<BrowserWindow> => {
// #region WiFi
function isConnectedToWiFi(): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
network.get_active_interface((err: any | null, obj: { name: string, ip_address: string, mac_address: string, type: string, netmask: string, gateway_ip: string }) => {
if (err) {
console.error("Errore durante il controllo della connessione Wi-Fi:", err);
reject(err);
}
else {
console.log('isConnectedToWifi:');
console.log(obj);
resolve(obj.type == 'Wireless');
}
})
});
}
function isConnectedToWiFiOld(): Promise<boolean> {
return new Promise((resolve, reject) => {
const platform = os.platform(); // Use os to get the platform
@ -398,6 +429,8 @@ function startMoneroDaemon(commandOptions: string[]): ChildProcessWithoutNullStr
moneroFirstStdout = true;
commandOptions.push('--non-interactive');
// Avvia il processo usando spawn
monerodProcess = spawn(monerodPath, commandOptions);
@ -683,7 +716,7 @@ try {
await new Promise<void>((resolve, reject) => {
try {
setTimeout(() => {
splash.close();
if (splash) splash.close();
if (!minimized) win?.show();
resolve();
}, 2600);
@ -797,7 +830,7 @@ try {
const extractedDir = await extract(fPath, destination);
event.sender.send('download-progress', { progress: 100, status: 'Download and extraction completed successfully' });
event.sender.send('download-progress', { progress: 200, status: `${destination}/${extractedDir}` });
event.sender.send('download-progress', { progress: 200, status: os.platform() == 'win32' ? extractedDir : `${destination}/${extractedDir}` });
win?.setProgressBar(100, {
mode: 'none'
@ -805,6 +838,9 @@ try {
} catch (error) {
event.sender.send('download-progress', { progress: 0, status: `Error: ${error}` });
win?.setProgressBar(0, {
mode: 'error'
});
}
});

97
app/package-lock.json generated
View file

@ -10,6 +10,7 @@
"dependencies": {
"adm-zip": "^0.5.16",
"applescript": "^1.0.0",
"network": "^0.7.0",
"os": "^0.1.2",
"pidusage": "^3.0.2",
"tar": "^7.4.3",
@ -130,6 +131,11 @@
"resolved": "https://registry.npmjs.org/applescript/-/applescript-1.0.0.tgz",
"integrity": "sha512-yvtNHdWvtbYEiIazXAdp/NY+BBb65/DAseqlNiJQjOx9DynuzOYDbVLBJvuc0ve0VL9x6B3OHF6eH52y9hCBtQ=="
},
"node_modules/async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w=="
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@ -209,6 +215,17 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/commander": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
"integrity": "sha512-bmkUukX8wAOjHdN26xj5c4ctEV22TQ7dQYhSmuckKhToXrkUn0iIaolHdIxYYqD55nhpSPA9zPQ1yP57GdXP2A==",
"dependencies": {
"graceful-readlink": ">= 1.0.0"
},
"engines": {
"node": ">= 0.6.x"
}
},
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@ -266,6 +283,22 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
"integrity": "sha512-8tLu60LgxF6XpdbK8OW3FA+IfTNBn1ZHGHKF4KQbEeSkajYw5PlYJcKluntgegDPTg8UkHjpet1T82vk6TQ68w=="
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -351,6 +384,35 @@
"node": ">= 18"
}
},
"node_modules/needle": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz",
"integrity": "sha512-6k0YULvhpw+RoLNiQCRKOl09Rv1dPLr8hHnVjHqdolKwDrdNyk+Hmrthi4lIGPPz3r39dLx0hsF5s40sZ3Us4Q==",
"dependencies": {
"iconv-lite": "^0.6.3",
"sax": "^1.2.4"
},
"bin": {
"needle": "bin/needle"
},
"engines": {
"node": ">= 4.4.x"
}
},
"node_modules/network": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/network/-/network-0.7.0.tgz",
"integrity": "sha512-AquYHEZFrPi1WPaMg+21iTKN7aMERP70frgK41lbTt/9tTQcwgaOtlqHRmVbxJjWYWJy033jUbA8xXhFArXodw==",
"dependencies": {
"async": "^1.5.2",
"commander": "2.9.0",
"needle": "^3.0.0",
"wmic": "^1.0.1"
},
"bin": {
"network": "bin/network"
}
},
"node_modules/os": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/os/-/os-0.1.2.tgz",
@ -428,6 +490,16 @@
}
]
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sax": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz",
"integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -615,6 +687,31 @@
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.5.tgz",
"integrity": "sha512-uf7tHf+tw0B1y+x+mKTLHkykBgK2KMs3g+KlzmyMbLvICSHQyB/xOFjTT8qZ3oeTFyU7Bbj4FzXitGG6jvKhYw=="
},
"node_modules/wmic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/wmic/-/wmic-1.1.1.tgz",
"integrity": "sha512-6lbonssALks49dX9bJTE8i54OTjbbLfd3IraFfG1ZR1ZrEbEynCt471IX5SfslZaFwISJKdUFHjOWHk0Brs5eg==",
"dependencies": {
"async": "^3.2.0",
"iconv-lite": "^0.5.0"
}
},
"node_modules/wmic/node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="
},
"node_modules/wmic/node_modules/iconv-lite": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz",
"integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/wrap-ansi": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",

View file

@ -12,6 +12,7 @@
"dependencies": {
"adm-zip": "^0.5.16",
"applescript": "^1.0.0",
"network": "^0.7.0",
"os": "^0.1.2",
"pidusage": "^3.0.2",
"tar": "^7.4.3",

View file

@ -48,7 +48,7 @@
"electron:serve-tsc": "tsc -p tsconfig.serve.json",
"electron:serve": "wait-on tcp:4200 && npm run electron:serve-tsc && electron . --serve",
"electron:local": "npm run build:prod && electron .",
"electron:local:dev": "npm run build:dev && electron .",
"electron:local:dev": "npm run build:dev && electron --trace-warnings .",
"electron:build": "npm run build:prod && electron-builder build --publish=never",
"electron:build:deb": "npm run build:prod:deb && electron-installer-debian --src dist/monerod-gui-linux-x64/ --dest dist/installers/ --arch amd64 --config electron-installer-debian.json",
"electron:build:win": "npm run build:prod:win && electron-installer-windows --src dist/monerod-gui-win32-x64/ --dest dist/installers/ --arch amd64 --config electron-installer-windows.json",

View file

@ -348,7 +348,7 @@ export class DaemonDataService {
private async refresh(): Promise<void> {
if (this.refreshing || this.tooEarlyForRefresh) {
if (this.refreshing || this.tooEarlyForRefresh || this.daemonService.stopping) {
return;
}

View file

@ -1134,8 +1134,10 @@ export class DaemonService {
const destination = settings.downloadUpgradePath; // Aggiorna con il percorso desiderato
const moneroFolder = await this.installer.downloadMonero(destination, settings.monerodPath != '');
settings.monerodPath = `${moneroFolder}/monerod`;
const { platform } = await this.electronService.getOsType();
const ext = platform == 'win32' ? '.exe' : '';
const separator = platform ?? 'win32' ? '\\' : '/';
settings.monerodPath = `${moneroFolder}${separator}monerod${ext}`;
await this.saveSettings(settings);
}

View file

@ -27,14 +27,14 @@
&nbsp;
<li *ngIf="!quitting && running && syncDisabled && !starting && !restarting && !installing && !upgrading" class="nav-item text-nowrap">
<button [disabled]="enablingSync || syncDisabledByPeriodPolicy || syncDisabledByWifiPolicy" class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Start Sync" aria-expanded="false" aria-label="Start Sync" (click)="startSync()">
<button [disabled]="enablingSync || syncDisabledByPeriodPolicy || syncDisabledByWifiPolicy || stopping" class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Start Sync" aria-expanded="false" aria-label="Start Sync" (click)="startSync()">
<i class="bi bi-wifi"></i>
</button>
&nbsp;
</li>
<li *ngIf="!quitting && running && !syncDisabled && !starting && !restarting && !installing && !upgrading" class="nav-item text-nowrap">
<button [disabled]="disablingSync" class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Stop Sync" aria-expanded="false" aria-label="Stop Sync" (click)="stopSync()">
<button [disabled]="disablingSync || stopping" class="btn btn-outline-secondary px-3 text-white" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Stop Sync" aria-expanded="false" aria-label="Stop Sync" (click)="stopSync()">
<i class="bi bi-wifi-off"></i>
</button>
&nbsp;