mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 06:35:15 +01:00
add audit=[bool] param to block hash url
This commit is contained in:
parent
bfde456ca8
commit
fffffffdb3
2 changed files with 43 additions and 4 deletions
3
contributors/russeree.txt
Normal file
3
contributors/russeree.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of March 8, 2024.
|
||||||
|
|
||||||
|
Signed: PortlandHODL
|
|
@ -61,6 +61,7 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||||
transactionsError: any = null;
|
transactionsError: any = null;
|
||||||
overviewError: any = null;
|
overviewError: any = null;
|
||||||
webGlEnabled = true;
|
webGlEnabled = true;
|
||||||
|
auditParamEnabled: boolean = false;
|
||||||
auditSupported: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;
|
auditSupported: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;
|
||||||
auditModeEnabled: boolean = !this.stateService.hideAudit.value;
|
auditModeEnabled: boolean = !this.stateService.hideAudit.value;
|
||||||
auditAvailable = true;
|
auditAvailable = true;
|
||||||
|
@ -124,11 +125,18 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||||
this.setAuditAvailable(this.auditSupported);
|
this.setAuditAvailable(this.auditSupported);
|
||||||
|
|
||||||
if (this.auditSupported) {
|
if (this.auditSupported) {
|
||||||
this.auditPrefSubscription = this.stateService.hideAudit.subscribe((hide) => {
|
this.isAuditEnabledFromParam().subscribe(auditParam => {
|
||||||
|
if (this.auditParamEnabled) {
|
||||||
|
console.log(`auditParamEnabled: ${auditParam}`);
|
||||||
|
this.auditModeEnabled = auditParam;
|
||||||
|
} else {
|
||||||
|
this.auditPrefSubscription = this.stateService.hideAudit.subscribe(hide => {
|
||||||
this.auditModeEnabled = !hide;
|
this.auditModeEnabled = !hide;
|
||||||
this.showAudit = this.auditAvailable && this.auditModeEnabled;
|
this.showAudit = this.auditAvailable && this.auditModeEnabled;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.txsLoadingStatus$ = this.route.paramMap
|
this.txsLoadingStatus$ = this.route.paramMap
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -723,6 +731,24 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
toggleAuditMode(): void {
|
toggleAuditMode(): void {
|
||||||
this.stateService.hideAudit.next(this.auditModeEnabled);
|
this.stateService.hideAudit.next(this.auditModeEnabled);
|
||||||
|
|
||||||
|
this.route.queryParams.subscribe(params => {
|
||||||
|
let queryParams = { ...params };
|
||||||
|
delete queryParams['audit'];
|
||||||
|
|
||||||
|
let newUrl = this.router.url.split('?')[0];
|
||||||
|
let queryString = new URLSearchParams(queryParams).toString();
|
||||||
|
if (queryString) {
|
||||||
|
newUrl += '?' + queryString;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.location.replaceState(newUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.auditPrefSubscription = this.stateService.hideAudit.subscribe((hide) => {
|
||||||
|
this.auditModeEnabled = !hide;
|
||||||
|
this.showAudit = this.auditAvailable && this.auditModeEnabled;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAuditAvailableFromBlockHeight(blockHeight: number): void {
|
updateAuditAvailableFromBlockHeight(blockHeight: number): void {
|
||||||
|
@ -731,6 +757,16 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAuditEnabledFromParam(): Observable<boolean> {
|
||||||
|
return this.route.queryParams.pipe(
|
||||||
|
map(params => {
|
||||||
|
this.auditParamEnabled = 'audit' in params;
|
||||||
|
|
||||||
|
return this.auditParamEnabled ? !(params['audit'] === 'false') : true;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
isAuditAvailableFromBlockHeight(blockHeight: number): boolean {
|
isAuditAvailableFromBlockHeight(blockHeight: number): boolean {
|
||||||
if (!this.auditSupported) {
|
if (!this.auditSupported) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue