Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Simply display just the active pool #394

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 35 additions & 33 deletions main/http_server/axe-os/src/app/components/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,39 +205,41 @@ <h5>Performance</h5>


<div class="col-12 lg:col-6">
<div class="card">
<h5>Pool Information</h5>
<table *ngIf="info$ | async as info; else loading">
<tr *ngIf="quickLink$ | async as quickLink">
<td>Quick Link:</td>
<td style="word-break: break-all;">
<a style="color: white; text-decoration: underline;" [href]="quickLink" target="_blank">{{quickLink}}</a>
</td>
</tr>
<tr>
<td>URL:</td>
<td style="word-break: break-all;">{{info.stratumURL}}</td>
</tr>
<tr>
<td>Port:</td>
<td style="word-break: break-all;">{{info.stratumPort}}</td>
</tr>
<tr>
<td>User:</td>
<td style="word-break: break-all;">{{info.stratumUser}}</td>
</tr>
<tr>
<td>Fallback URL:</td>
<td style="word-break: break-all;">{{info.fallbackStratumURL}}</td>
</tr>
<tr>
<td>Fallback Port:</td>
<td style="word-break: break-all;">{{info.fallbackStratumPort}}</td>
</tr>
<tr>
<td>Fallback User:</td>
<td style="word-break: break-all;">{{info.fallbackStratumUser}}</td>
</tr>
<div class="card" *ngIf="info$ | async as info; else loading">
<h5>Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})</h5>
<table>
<ng-container *ngIf="!info.isUsingFallbackStratum">
<tr>
<td>URL:</td>
<td style="word-break: break-all;">
<a style="text-decoration: underline;" [href]="(quickLink$ | async) || info.stratumURL" target="_blank">{{info.stratumURL}}</a>
</td>
</tr>
<tr>
<td>Port:</td>
<td style="word-break: break-all;">{{info.stratumPort}}</td>
</tr>
<tr>
<td>User:</td>
<td style="word-break: break-all;">{{info.stratumUser}}</td>
</tr>
</ng-container>
<ng-container *ngIf="info.isUsingFallbackStratum">
<tr>
<td>URL:</td>
<td style="word-break: break-all;">
<a style="text-decoration: underline;" [href]="(fallbackQuickLink$ | async) || info.fallbackStratumURL" target="_blank">{{info.fallbackStratumURL}}</a>
</td>
</tr>
<tr>
<td>Port:</td>
<td style="word-break: break-all;">{{info.fallbackStratumPort}}</td>
</tr>
<tr>
<td>User:</td>
<td style="word-break: break-all;">{{info.fallbackStratumUser}}</td>
</tr>
</ng-container>
</table>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

.card {
min-height: 100%;
}
}
21 changes: 21 additions & 0 deletions main/http_server/axe-os/src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class HomeComponent {
public info$: Observable<ISystemInfo>;

public quickLink$: Observable<string | undefined>;
public fallbackQuickLink$: Observable<string | undefined>;
public expectedHashRate$: Observable<number | undefined>;


Expand Down Expand Up @@ -186,6 +187,26 @@ export class HomeComponent {
})
)

this.fallbackQuickLink$ = this.info$.pipe(
map(info => {
if (info.fallbackStratumURL.includes('public-pool.io')) {
const address = info.fallbackStratumUser.split('.')[0]
return `https://web.public-pool.io/#/app/${address}`;
} else if (info.fallbackStratumURL.includes('ocean.xyz')) {
const address = info.fallbackStratumUser.split('.')[0]
return `https://ocean.xyz/stats/${address}`;
} else if (info.fallbackStratumURL.includes('solo.d-central.tech')) {
const address = info.fallbackStratumUser.split('.')[0]
return `https://solo.d-central.tech/#/app/${address}`;
} else if (/solo[46]?.ckpool.org/.test(info.fallbackStratumURL)) {
const address = info.fallbackStratumUser.split('.')[0]
return `https://solo.ckpool.org/users/${address}`;
} else {
return undefined;
}
})
)

}

private calculateAverage(data: number[]): number {
Expand Down
3 changes: 2 additions & 1 deletion main/http_server/axe-os/src/app/services/system.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class SystemService {
current: 2237.5,
temp: 60,
vrTemp: 45,
hashRate: 475,
hashRate: Math.floor(Math.random() * (350 - 300 + 1)) + 300,
bestDiff: "0",
bestSessionDiff: "0",
freeHeap: 200504,
Expand All @@ -49,6 +49,7 @@ export class SystemService {
fallbackStratumPort: 21497,
stratumUser: "bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d.bitaxe-U1",
fallbackStratumUser: "bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d.bitaxe-U1",
isUsingFallbackStratum: true,
frequency: 485,
version: "2.0",
boardVersion: "204",
Expand Down
1 change: 1 addition & 0 deletions main/http_server/axe-os/src/models/ISystemInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface ISystemInfo {
stratumPort: number,
fallbackStratumURL: string,
fallbackStratumPort: number,
isUsingFallbackStratum: boolean,
stratumUser: string,
fallbackStratumUser: string,
frequency: number,
Expand Down
Loading