Skip to content

Commit

Permalink
Merge pull request #452 from mrv777/primary-ckpool-link
Browse files Browse the repository at this point in the history
fix: Move back primary to human readable ckpool
  • Loading branch information
eandersson authored Nov 8, 2024
2 parents da2d255 + 90f6c68 commit c0fc1d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ <h5>Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})
<tr>
<td>URL:</td>
<td style="word-break: break-all;">
<a style="text-decoration: underline;" [href]="(quickLink$ | async) || info.stratumURL"
<a style="text-decoration: underline;" [href]="(quickLink$ | async)"
target="_blank">{{info.stratumURL}}</a>
</td>
</tr>
Expand Down
55 changes: 19 additions & 36 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 @@ -207,44 +207,12 @@ export class HomeComponent {
}))

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

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://solostats.ckpool.org/users/${address}`;
} else {
return undefined;
}
})
)
map(info => this.getQuickLink(info.fallbackStratumURL, info.fallbackStratumUser))
);

}

Expand All @@ -253,5 +221,20 @@ export class HomeComponent {
const sum = data.reduce((sum, value) => sum + value, 0);
return sum / data.length;
}

private getQuickLink(stratumURL: string, stratumUser: string): string | undefined {
const address = stratumUser.split('.')[0];

if (stratumURL.includes('public-pool.io')) {
return `https://web.public-pool.io/#/app/${address}`;
} else if (stratumURL.includes('ocean.xyz')) {
return `https://ocean.xyz/stats/${address}`;
} else if (stratumURL.includes('solo.d-central.tech')) {
return `https://solo.d-central.tech/#/app/${address}`;
} else if (/solo[46]?.ckpool.org/.test(stratumURL)) {
return `https://solostats.ckpool.org/users/${address}`;
}
return stratumURL.startsWith('http') ? stratumURL : `http://${stratumURL}`;
}
}

0 comments on commit c0fc1d0

Please sign in to comment.