convert soft 404s to hard 404s in unfurler ssr

This commit is contained in:
Mononaut
2023-03-09 02:34:21 -06:00
parent 2f3e498906
commit 105cccf9b0
19 changed files with 90 additions and 9 deletions

View File

@@ -88,6 +88,7 @@ export class AddressComponent implements OnInit, OnDestroy {
catchError((err) => {
this.isLoadingAddress = false;
this.error = err;
this.seoService.logSoft404();
console.log(err);
return of(null);
})
@@ -157,6 +158,7 @@ export class AddressComponent implements OnInit, OnDestroy {
(error) => {
console.log(error);
this.error = error;
this.seoService.logSoft404();
this.isLoadingAddress = false;
});

View File

@@ -86,6 +86,7 @@ export class AssetComponent implements OnInit, OnDestroy {
catchError((err) => {
this.isLoadingAsset = false;
this.error = err;
this.seoService.logSoft404();
console.log(err);
return of(null);
})
@@ -153,6 +154,7 @@ export class AssetComponent implements OnInit, OnDestroy {
(error) => {
console.log(error);
this.error = error;
this.seoService.logSoft404();
this.isLoadingAsset = false;
});

View File

@@ -82,6 +82,7 @@ export class BlockPreviewComponent implements OnInit, OnDestroy {
}),
catchError((err) => {
this.error = err;
this.seoService.logSoft404();
this.openGraphService.fail('block-data-' + this.rawId);
this.openGraphService.fail('block-viz-' + this.rawId);
return of(null);
@@ -138,6 +139,7 @@ export class BlockPreviewComponent implements OnInit, OnDestroy {
(error) => {
this.error = error;
this.isLoadingOverview = false;
this.seoService.logSoft404();
this.openGraphService.fail('block-viz-' + this.rawId);
this.openGraphService.fail('block-data-' + this.rawId);
if (this.blockGraph) {

View File

@@ -192,6 +192,7 @@ export class BlockComponent implements OnInit, OnDestroy {
this.error = err;
this.isLoadingBlock = false;
this.isLoadingOverview = false;
this.seoService.logSoft404();
return EMPTY;
})
);
@@ -200,6 +201,7 @@ export class BlockComponent implements OnInit, OnDestroy {
this.error = err;
this.isLoadingBlock = false;
this.isLoadingOverview = false;
this.seoService.logSoft404();
return EMPTY;
}),
);
@@ -215,6 +217,7 @@ export class BlockComponent implements OnInit, OnDestroy {
this.error = err;
this.isLoadingBlock = false;
this.isLoadingOverview = false;
this.seoService.logSoft404();
return EMPTY;
})
);

View File

@@ -61,6 +61,7 @@ export class PoolPreviewComponent implements OnInit {
}),
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
this.openGraphService.fail('pool-hash-' + this.slug);
return of([slug]);
})
@@ -70,6 +71,7 @@ export class PoolPreviewComponent implements OnInit {
return this.apiService.getPoolStats$(slug).pipe(
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
this.openGraphService.fail('pool-stats-' + this.slug);
return of(null);
})

View File

@@ -1,8 +1,8 @@
import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EChartsOption, graphic } from 'echarts';
import { BehaviorSubject, Observable, timer } from 'rxjs';
import { distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
import { BehaviorSubject, Observable, of, timer } from 'rxjs';
import { catchError, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
import { BlockExtended, PoolStat } from '../../interfaces/node-api.interface';
import { ApiService } from '../../services/api.service';
import { StateService } from '../../services/state.service';
@@ -59,10 +59,21 @@ export class PoolComponent implements OnInit {
this.prepareChartOptions(data.map(val => [val.timestamp * 1000, val.avgHashrate]));
return [slug];
}),
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
return of([slug]);
})
);
}),
switchMap((slug) => {
return this.apiService.getPoolStats$(slug);
return this.apiService.getPoolStats$(slug).pipe(
catchError(() => {
this.isLoading = false;
this.seoService.logSoft404();
return of(null);
})
);
}),
tap(() => {
this.loadMoreSubject.next(this.blocks[this.blocks.length - 1]?.height);

View File

@@ -133,6 +133,7 @@ export class TransactionPreviewComponent implements OnInit, OnDestroy {
)
.subscribe((tx: Transaction) => {
if (!tx) {
this.seoService.logSoft404();
this.openGraphService.fail('tx-data-' + this.txId);
return;
}
@@ -182,6 +183,7 @@ export class TransactionPreviewComponent implements OnInit, OnDestroy {
this.openGraphService.waitOver('tx-data-' + this.txId);
},
(error) => {
this.seoService.logSoft404();
this.openGraphService.fail('tx-data-' + this.txId);
this.error = error;
this.isLoadingTx = false;

View File

@@ -193,8 +193,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
})
).subscribe((tx) => {
if (!tx) {
this.seoService.logSoft404();
return;
}
this.seoService.clearSoft404();
this.tx = tx;
this.isCached = true;
@@ -286,9 +288,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
})
)
.subscribe((tx: Transaction) => {
if (!tx) {
return;
}
if (!tx) {
this.seoService.logSoft404();
return;
}
this.seoService.clearSoft404();
this.tx = tx;
this.isCached = false;
@@ -340,6 +344,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
},
(error) => {
this.error = error;
this.seoService.logSoft404();
this.isLoadingTx = false;
}
);
@@ -394,6 +399,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.waitingForTransaction = true;
}
this.error = error;
this.seoService.logSoft404();
this.isLoadingTx = false;
return of(false);
}