Windows standalone app, msi installer and minor fixes

This commit is contained in:
argenius 2024-11-02 10:52:00 +01:00
parent 6bc64a369b
commit 02bfd5ff9f
8 changed files with 107 additions and 158 deletions

View file

@ -1,5 +1,5 @@
# This is a basic workflow to help you get started with Actions
name: 'Windows Portable Build'
name: 'Windows Build'
# Controls when the action will run.
on:

View file

@ -1,58 +0,0 @@
# This is a basic workflow to help you get started with Actions
name: 'Windows Installer Build'
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read
jobs:
build:
strategy:
matrix:
node-version: [20]
# The type of runner that the job will run on
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm`
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm i
- name: Check lint
run: npm run lint
- name: Build the app
run: npm run electron:build:win

View file

@ -254,10 +254,7 @@ function createWindow(): BrowserWindow {
return win;
}
const createSplashWindow = async (): Promise<BrowserWindow | undefined> => {
if (os.platform() == 'win32') {
return undefined;
}
const createSplashWindow = async (): Promise<BrowserWindow> => {
const window = new BrowserWindow({
width: 480,
@ -716,7 +713,7 @@ try {
await new Promise<void>((resolve, reject) => {
try {
setTimeout(() => {
if (splash) splash.close();
splash.close();
if (!minimized) win?.show();
resolve();
}, 2600);
@ -1028,7 +1025,7 @@ try {
});
ipcMain.handle('is-app-image', (event: IpcMainInvokeEvent) => {
const isAppImage: boolean = !!process.env.APPIMAGE;
const isAppImage: boolean = (!!process.env.APPIMAGE) || (!!process.env.PORTABLE_EXECUTABLE_DIR);
win?.webContents.send('on-is-app-image', isAppImage ? true : false);
});

View file

@ -17,11 +17,16 @@
"win": {
"icon": "dist/assets/icons",
"target": [
"msi",
"portable"
]
},
"msi": {
"artifactName": "${productName}-${version}-setup.${ext}",
"createDesktopShortcut": "always"
},
"portable": {
"splashImage": "dist/assets/icons/electron.bmp"
"artifactName": "${productName}-${version}-portable.${ext}"
},
"mac": {
"icon": "dist/assets/icons",

View file

@ -416,6 +416,7 @@ export class DaemonDataService {
try {
this._daemonRunning = await this.daemonService.isRunning();
const firstRefresh = this._firstRefresh;
this._firstRefresh = false;
if (!this._daemonRunning) {
@ -426,6 +427,15 @@ export class DaemonDataService {
await this.refreshProcessStats();
if (firstRefresh) {
this._gettingIsBlockchainPruned = true;
const settings = await this.daemonService.getSettings();
this._isBlockchainPruned = settings.pruneBlockchain;
this._gettingIsBlockchainPruned = false;
}
this._gettingDaemonInfo = true;
this._daemonInfo = await this.daemonService.getInfo();
this._gettingDaemonInfo = false;
@ -451,24 +461,7 @@ export class DaemonDataService {
this._gettingLastBlockHeader = false;
}
this._gettingIsBlockchainPruned = true;
const settings = await this.daemonService.getSettings();
this._isBlockchainPruned = settings.pruneBlockchain;
/*
if (firstRefresh) {
this.daemonService.pruneBlockchain(true).then((info) => {
this._isBlockchainPruned = info.pruned;
}).catch((error) => {
console.error(error);
});
}
*/
this._gettingIsBlockchainPruned = false;
if (this._daemonInfo.synchronized) await this.refreshAltChains();
if (this._daemonInfo.synchronized && this._daemonInfo.altBlocksCount > 0) await this.refreshAltChains();
this._gettingNetStats = true;
this.netStatsRefreshStart.emit();
@ -477,9 +470,10 @@ export class DaemonDataService {
this.netStatsRefreshEnd.emit();
this._gettingNetStats = false;
if (this._daemonInfo.synchronized) await this.refreshMiningStatus();
if (this._daemonInfo.synchronized) await this.refreshMinerData();
if (this._daemonInfo.coreSynchronized) {
await this.refreshMiningStatus();
await this.refreshMinerData();
}
this._gettingPeerList = true;
this._peerList = await this.daemonService.getPeerList();

View file

@ -58,27 +58,26 @@ export class LogsComponent extends BasePageComponent implements AfterViewInit {
}
public get logs(): string {
return this.lines.join("\n");
return this.initing ? '' : this.lines.join("\n");
}
private scrollToBottom(): void {
this.ngZone.run(() => {
this.lines;
const terminalOutput = <HTMLDivElement | null>document.getElementById('terminalOutput');
if (terminalOutput) {
terminalOutput.style.width = `${window.innerWidth}`;
console.log(`scrolling from ${terminalOutput.offsetTop} to ${terminalOutput.scrollHeight}`)
terminalOutput.scrollBy(0, terminalOutput.scrollHeight)
}
setTimeout(() => {
const terminalOutput = <HTMLDivElement | null>document.getElementById('terminalOutput');
if (terminalOutput) {
terminalOutput.style.width = `${window.innerWidth}`;
//console.log(`scrolling from ${terminalOutput.offsetTop} to ${terminalOutput.scrollHeight}`)
terminalOutput.scrollBy(0, terminalOutput.scrollHeight)
}
}, 100);
});
}
private onLog(): void {
if (this.logTerminal) this.logTerminal.nativeElement.scrollTop = this.logTerminal.nativeElement.scrollHeight;
// Scorri automaticamente in basso
setTimeout(() => {
this.scrollToBottom();
}, 100);
this.scrollToBottom();
}
public trackByFn(index: number, item: string): number {
@ -86,9 +85,17 @@ export class LogsComponent extends BasePageComponent implements AfterViewInit {
return index; // usa l'indice per tracciare gli elementi
}
private initing: boolean = false;
public ngAfterViewInit(): void {
this.initing = true;
setTimeout(() => {
this.scrollToBottom();
this.initing = false;
setTimeout(() => {
this.scrollToBottom();
}, 500);
}, 500);
}

View file

@ -13,7 +13,7 @@ import { SimpleBootstrapCard } from '../../shared/utils';
export class MiningComponent extends BasePageComponent implements AfterViewInit, AfterContentInit {
public get coreBusy(): boolean {
return this.daemonData.info? !this.daemonData.info.synchronized : true;
return this.daemonData.info? !this.daemonData.info.coreSynchronized : true;
}
public get miningStatus(): MiningStatus | undefined {

View file

@ -63,6 +63,10 @@ export class DaemonInfo {
return this.hashRate / 1000;
}
public get coreSynchronized(): boolean {
return this.wasBoostrapEverUsed ? this.heightWithoutBootstrap == this.targetHeight : this.synchronized;
}
constructor(
adjustedTime: number,
altBlocksCount: number,
@ -184,7 +188,7 @@ export class DaemonInfo {
const untrusted: boolean = info.untrusted;
const updateAvailable: boolean = info.update_available;
const version: string = info.version;
const wasBoostrapEverUsed: boolean = info.was_boostrap_ever_used === true ? true : false;
const wasBoostrapEverUsed: boolean = info.was_bootstrap_ever_used === true ? true : false;
const whitePeerlistSize: number = info.white_peerlist_size;
const wideCumulativeDifficulty: string = info.wide_cumulative_difficulty;
const wideDifficulty: string = info.wide_difficulty;