Strip non-alphanumeric chars from miner names
This commit is contained in:
parent
4220f99477
commit
e6dbde952e
@ -62,17 +62,8 @@
|
|||||||
<div class="animated" *ngIf="block.extras?.pool != undefined && showPools">
|
<div class="animated" *ngIf="block.extras?.pool != undefined && showPools">
|
||||||
<a [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-pool'" class="badge" [routerLink]="[('/mining/pool/' + block.extras.pool.slug) | relativeUrl]">
|
<a [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-pool'" class="badge" [routerLink]="[('/mining/pool/' + block.extras.pool.slug) | relativeUrl]">
|
||||||
<div *ngIf="block.extras.pool.minerNames != undefined && block.extras.pool.minerNames.length > 1 && block.extras.pool.minerNames[1] != ''; else centralisedPool">
|
<div *ngIf="block.extras.pool.minerNames != undefined && block.extras.pool.minerNames.length > 1 && block.extras.pool.minerNames[1] != ''; else centralisedPool">
|
||||||
<div class="on-pool-container" *ngIf="block.height != markHeight; else selectedDecentralisedPool">
|
<img [ngbTooltip]="block.extras.pool.name" class="pool-logo faded" [src]="'/resources/mining-pools/' + block.extras.pool.slug + '.svg'" onError="this.src = '/resources/mining-pools/default.svg'" [alt]="'Logo of ' + block.extras.pool.name + ' mining pool'">
|
||||||
{{ block.extras.pool.minerNames[1] }}
|
{{ block.extras.pool.minerNames[1] }}
|
||||||
<div class="on-pool">
|
|
||||||
<img class="pool-logo faded" [src]="'/resources/mining-pools/' + block.extras.pool.slug + '.svg'" onError="this.src = '/resources/mining-pools/default.svg'" [alt]="'Logo of ' + block.extras.pool.name + ' mining pool'">
|
|
||||||
<span class="on-pool-name-text">{{ block.extras.pool.name }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ng-template #selectedDecentralisedPool>
|
|
||||||
<img class="pool-logo faded" [src]="'/resources/mining-pools/' + block.extras.pool.slug + '.svg'" onError="this.src = '/resources/mining-pools/default.svg'" [alt]="'Logo of ' + block.extras.pool.name + ' mining pool'">
|
|
||||||
{{ block.extras.pool.minerNames[1] }}
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
</div>
|
||||||
<ng-template #centralisedPool>
|
<ng-template #centralisedPool>
|
||||||
<img class="pool-logo" [src]="'/resources/mining-pools/' + block.extras.pool.slug + '.svg'" onError="this.src = '/resources/mining-pools/default.svg'" [alt]="'Logo of ' + block.extras.pool.name + ' mining pool'"> {{ block.extras.pool.name }}
|
<img class="pool-logo" [src]="'/resources/mining-pools/' + block.extras.pool.slug + '.svg'" onError="this.src = '/resources/mining-pools/default.svg'" [alt]="'Logo of ' + block.extras.pool.name + ' mining pool'"> {{ block.extras.pool.name }}
|
||||||
|
@ -283,6 +283,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
if (block.extras.pool?.minerNames) {
|
if (block.extras.pool?.minerNames) {
|
||||||
block.extras.pool.minerNames = block.extras.pool.minerNames.map((name) => {
|
block.extras.pool.minerNames = block.extras.pool.minerNames.map((name) => {
|
||||||
|
name = name.replace(/[^a-zA-Z0-9 ]/g, '');
|
||||||
if (name.length > 16) {
|
if (name.length > 16) {
|
||||||
return name.slice(0, 16) + '…';
|
return name.slice(0, 16) + '…';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user