Merge pull request #1841 from hunicus/api-limit-note

Add note on rate limits to api docs
This commit is contained in:
wiz 2022-06-11 02:11:49 +09:00 committed by GitHub
commit feb1c051e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 5 deletions

View File

@ -34,7 +34,8 @@
<div class="doc-content">
<p class="hide-on-mobile no-bottom-space">Reference for the {{ network.val === '' ? 'Bitcoin' : network.val.charAt(0).toUpperCase() + network.val.slice(1) }} <ng-container i18n="api-docs.title">API service</ng-container>.</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){
@ -199,13 +203,16 @@ h3 {
@media (max-width: 992px) {
h3 {
margin: 1.5rem 0 0 0;
}
.hide-on-mobile {
display: none;
}
.doc-content {
width: 100%;
margin-top: -20px;
float: unset;
}
@ -238,6 +245,10 @@ h3 {
opacity: 0;
transition: 0.5s opacity ease;
}
.doc-welcome-note {
font-size: 0.85rem;
}
}
@media (min-width: 992px) {

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 !== '') {

View File

@ -34,7 +34,7 @@
</ul>
<div id="main-tab-content" [ngbNavOutlet]="nav" class="mt-2"></div>
<div id="main-tab-content" [ngbNavOutlet]="nav"></div>
<br>

View File

@ -1,6 +1,6 @@
#main-tab-content {
text-align: left;
padding-top: 10px;
padding-top: 1rem;
scroll-behavior: smooth;
}