diff --git a/.github/workflows/windows_portable.yml b/.github/workflows/windows.yml similarity index 94% rename from .github/workflows/windows_portable.yml rename to .github/workflows/windows.yml index 3d7afa1..f5d1ab3 100644 --- a/.github/workflows/windows_portable.yml +++ b/.github/workflows/windows.yml @@ -1,58 +1,58 @@ -# This is a basic workflow to help you get started with Actions -name: 'Windows Portable 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 +# This is a basic workflow to help you get started with Actions +name: 'Windows 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 diff --git a/.github/workflows/windows_installer.yml b/.github/workflows/windows_installer.yml deleted file mode 100644 index 7c0edea..0000000 --- a/.github/workflows/windows_installer.yml +++ /dev/null @@ -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 diff --git a/app/main.ts b/app/main.ts index bcdec25..b710cf6 100644 --- a/app/main.ts +++ b/app/main.ts @@ -254,10 +254,7 @@ function createWindow(): BrowserWindow { return win; } -const createSplashWindow = async (): Promise => { - if (os.platform() == 'win32') { - return undefined; - } +const createSplashWindow = async (): Promise => { const window = new BrowserWindow({ width: 480, @@ -716,7 +713,7 @@ try { await new Promise((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); }); diff --git a/electron-builder.json b/electron-builder.json index bdbd79a..fbe28bb 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -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", diff --git a/src/app/core/services/daemon/daemon-data.service.ts b/src/app/core/services/daemon/daemon-data.service.ts index bdd4b27..f1d2ec0 100644 --- a/src/app/core/services/daemon/daemon-data.service.ts +++ b/src/app/core/services/daemon/daemon-data.service.ts @@ -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(); diff --git a/src/app/pages/logs/logs.component.ts b/src/app/pages/logs/logs.component.ts index 6fd1948..d3a1117 100644 --- a/src/app/pages/logs/logs.component.ts +++ b/src/app/pages/logs/logs.component.ts @@ -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 = 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 = 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 } - public ngAfterViewInit(): void { + private initing: boolean = false; + + public ngAfterViewInit(): void { + this.initing = true; setTimeout(() => { this.scrollToBottom(); + this.initing = false; + + setTimeout(() => { + this.scrollToBottom(); + }, 500); }, 500); } diff --git a/src/app/pages/mining/mining.component.ts b/src/app/pages/mining/mining.component.ts index d357aed..55b09e2 100644 --- a/src/app/pages/mining/mining.component.ts +++ b/src/app/pages/mining/mining.component.ts @@ -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 { diff --git a/src/common/DaemonInfo.ts b/src/common/DaemonInfo.ts index 91745eb..80148df 100644 --- a/src/common/DaemonInfo.ts +++ b/src/common/DaemonInfo.ts @@ -62,6 +62,10 @@ export class DaemonInfo { public get gigaHashRate(): number { return this.hashRate / 1000; } + + public get coreSynchronized(): boolean { + return this.wasBoostrapEverUsed ? this.heightWithoutBootstrap == this.targetHeight : this.synchronized; + } constructor( adjustedTime: 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;