Show rate limiting note on official instances only

Also fix some styling flaws resulting from hiding
the rate limiting text.
This commit is contained in:
hunicus 2022-06-07 23:27:35 -04:00
parent 0073322758
commit 752156281f
No known key found for this signature in database
GPG Key ID: 24837C51B6D81FD9
3 changed files with 10 additions and 4 deletions

View File

@ -34,8 +34,8 @@
<div class="doc-content">
<p class="api-note">Below is a reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} <ng-container i18n="api-docs.title">REST API service</ng-container>.</p>
<p class="api-note no-bottom-space">Note that we enforce rate limits. If you exceed these limits, you will get a polite error encouraging you to run your own Mempool instance. If you repeatedly exceed the limits, you may be banned from accessing the service altogether.</p>
<p class="doc-welcome-note">Below is a reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} <ng-container i18n="api-docs.title">REST API service</ng-container>.</p>
<p class="doc-welcome-note api-note" *ngIf="officialMempoolInstance">Note that we enforce rate limits. If you exceed these limits, you will get a polite error encouraging you to run your own Mempool instance. If you repeatedly exceed the limits, you may be banned from accessing the service altogether.</p>
<div class="doc-item-container" *ngFor="let item of restDocs">
<h3 *ngIf="( item.type === 'category' ) && ( item.showConditions.indexOf(network.val) > -1 )">{{ item.title }}</h3>

View File

@ -22,10 +22,14 @@ li.nav-item {
}
}
.no-bottom-space {
.doc-welcome-note {
margin-bottom: 0;
}
.api-note {
margin-top: 1rem;
}
.nav-tabs .nav-link.active {
border-bottom: 1px solid #fff;
@media (min-width: 676px){
@ -242,7 +246,7 @@ h3 {
transition: 0.5s opacity ease;
}
.api-note {
.doc-welcome-note {
font-size: 0.85rem;
}
}

View File

@ -23,6 +23,7 @@ export class ApiDocsComponent implements OnInit {
restDocs: any[];
wsDocs: any;
screenWidth: number;
officialMempoolInstance: boolean;
constructor(
private stateService: StateService,
@ -43,6 +44,7 @@ export class ApiDocsComponent implements OnInit {
ngOnInit(): void {
this.env = this.stateService.env;
this.officialMempoolInstance = this.env.OFFICIAL_MEMPOOL_SPACE;
this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
tap((network: string) => {
if (this.env.BASE_MODULE === 'mempool' && network !== '') {