From d8241362e60520068c42212ddeedfc2b690dcfa8 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Aug 2023 22:41:50 -0400 Subject: [PATCH] network stats --- package.json | 2 +- .../dashboard/dashboard.component.html | 60 ++++++++++++++++++- .../dashboard/dashboard.component.ts | 11 +++- .../components/splash/splash.component.html | 26 ++++---- .../components/splash/splash.component.scss | 1 + src/app/components/splash/splash.component.ts | 5 ++ src/app/layout/app.topbar.component.html | 8 +-- src/app/services/app.service.ts | 3 + src/environments/environment.prod.ts | 2 +- src/environments/environment.ts | 2 +- src/prime-ng.module.ts | 5 +- 11 files changed, 101 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index f3b48b4..e9a45c3 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "scripts": { "ng": "ng", "start": "ng serve --proxy-config proxy.config.local.json ", + "start:prod": "ng serve --proxy-config proxy.config.prod.json ", "build": "ng build --configuration=production && gzipper compress --gzip --brotli ./dist/public-pool-ui/", "build:github": "ng build --configuration=production --base-href https://benjamin-wilson.github.io/public-pool-ui/", - "start:prod": "ng serve --proxy-config proxy.config.prod.json ", "watch": "ng build --watch --configuration development", "test": "ng test", "bundle-report": "ng build --configuration=production --source-map=true --named-chunks=true --stats-json && webpack-bundle-analyzer dist/public-pool-ui/stats.json" diff --git a/src/app/components/dashboard/dashboard.component.html b/src/app/components/dashboard/dashboard.component.html index baa5bb6..5ae1bdc 100644 --- a/src/app/components/dashboard/dashboard.component.html +++ b/src/app/components/dashboard/dashboard.component.html @@ -1,10 +1,13 @@
+
- Best Difficulty (All-Time) + Your Best Difficulty
{{clientInfo.bestDifficulty | numberSuffix}}
@@ -15,7 +18,60 @@
{{clientInfo.bestDifficulty | number}}
+ +
+ + +
+
+
+
+ Network Difficulty +
{{networkInfo.difficulty | numberSuffix}} +
+
+ +
+ {{networkInfo.difficulty | number}} +
+
+
+
+
+
+ Network Hash Rate +
{{networkInfo.networkhashps | hashSuffix}} +
+
+ +
+   +
+
+
+
+
+
+ Block Hight +
{{networkInfo.blocks}} +
+
+ +
+ Weight: {{networkInfo.currentblockweight | number}} +
+
+
@@ -29,7 +85,7 @@ Name Session ID Hash Rate - Best Difficulty (Session) + Session Best Difficulty Uptime diff --git a/src/app/components/dashboard/dashboard.component.ts b/src/app/components/dashboard/dashboard.component.ts index 0a2c59c..14ec3b7 100644 --- a/src/app/components/dashboard/dashboard.component.ts +++ b/src/app/components/dashboard/dashboard.component.ts @@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { map, Observable, shareReplay } from 'rxjs'; import { HashSuffixPipe } from '../../pipes/hash-suffix.pipe'; +import { AppService } from '../../services/app.service'; import { ClientService } from '../../services/client.service'; @Component({ @@ -19,9 +20,17 @@ export class DashboardComponent { public chartOptions: any; + public networkInfo$: Observable; + constructor( + private clientService: ClientService, + private route: ActivatedRoute, + private appService: AppService + + ) { + + this.networkInfo$ = this.appService.getNetworkInfo(); - constructor(private clientService: ClientService, private route: ActivatedRoute) { this.address = this.route.snapshot.params['address']; this.clientInfo$ = this.clientService.getClientInfo(this.address).pipe( shareReplay({ refCount: true, bufferSize: 1 }) diff --git a/src/app/components/splash/splash.component.html b/src/app/components/splash/splash.component.html index 844545b..85a9d41 100644 --- a/src/app/components/splash/splash.component.html +++ b/src/app/components/splash/splash.component.html @@ -14,28 +14,30 @@

Public Pool

Fully Open Source Solo Bitcoin Mining Pool

-
+
stratum+tcp://public-pool.airdns.org:21496
username: <your BTC address>.<worker name>, password: x -
-
- Pleb mining (under 50TH/s miners) mine with NO FEES* + Pleb mining (under 50TH/s miners) mine with NO FEES
- Miners with > 50TH/s will incur a 1.5% fee, a portion of which will go back into open source Bitcoin mining* + Miners with > 50TH/s will incur a 1.5% fee, a portion of which will go back into open source Bitcoin mining

No second best. @@ -48,8 +50,6 @@
- - * Based on a machine-by-machine basis
@@ -67,18 +67,22 @@
-

Devices

+

Online Devices

Device Currently Working + Best Difficulty + {{ userAgent.userAgent | userAgent }} {{ userAgent.count }} + {{ userAgent.bestDifficulty | numberSuffix}} diff --git a/src/app/components/splash/splash.component.scss b/src/app/components/splash/splash.component.scss index 0de12a6..41d3202 100644 --- a/src/app/components/splash/splash.component.scss +++ b/src/app/components/splash/splash.component.scss @@ -8,6 +8,7 @@ .info { font-weight: bold; + font-size: x-large; } .card { diff --git a/src/app/components/splash/splash.component.ts b/src/app/components/splash/splash.component.ts index 3bc4ea3..6aa9da1 100644 --- a/src/app/components/splash/splash.component.ts +++ b/src/app/components/splash/splash.component.ts @@ -21,10 +21,15 @@ export class SplashComponent { public chartOptions: any; + + constructor(private appService: AppService) { const info$ = this.appService.getInfo().pipe(shareReplay({ refCount: true, bufferSize: 1 })); + + + this.blockData$ = info$.pipe(map(info => info.blockData)); this.userAgents$ = info$.pipe(map(info => info.userAgents)); diff --git a/src/app/layout/app.topbar.component.html b/src/app/layout/app.topbar.component.html index 7935f05..81ef87d 100644 --- a/src/app/layout/app.topbar.component.html +++ b/src/app/layout/app.topbar.component.html @@ -13,9 +13,9 @@ -
- -
+ +
-->
\ No newline at end of file diff --git a/src/app/services/app.service.ts b/src/app/services/app.service.ts index 2f0b2c2..5e030c4 100644 --- a/src/app/services/app.service.ts +++ b/src/app/services/app.service.ts @@ -16,6 +16,9 @@ export class AppService { public getInfo() { return this.httpClient.get(`${environment.API_URL}/api/info`) as Observable; } + public getNetworkInfo() { + return this.httpClient.get(`${environment.API_URL}/api/network`) as Observable; + } public getInfoChart() { return this.httpClient.get(`${environment.API_URL}/api/info/chart`) as Observable; } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 8157e6b..2848a7d 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - API_URL: 'https://public-pool.airdns.org:40557', + API_URL: 'http://public-pool.airdns.org:40557', }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index d78e6e9..4a34310 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,4 +1,4 @@ export const environment = { production: false, - API_URL: 'https://localhost:3334' + API_URL: 'http://localhost:3334' }; diff --git a/src/prime-ng.module.ts b/src/prime-ng.module.ts index 95b061a..35d3d0a 100644 --- a/src/prime-ng.module.ts +++ b/src/prime-ng.module.ts @@ -4,8 +4,7 @@ import { ButtonModule } from 'primeng/button'; import { ChartModule } from 'primeng/chart'; import { InputSwitchModule } from 'primeng/inputswitch'; import { TableModule } from 'primeng/table'; - - +import { TooltipModule } from 'primeng/tooltip'; export const primeNgServices = [ MessageService, @@ -17,7 +16,7 @@ const primeNgModules = [ ChartModule, InputSwitchModule, ButtonModule, - + TooltipModule // DropdownModule, // ToastModule, // CheckboxModule,