mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 21:32:55 +01:00
Proxy donation requests to mempool.space when BTCPay Sponsors is disabled.
This commit is contained in:
parent
7673bf13b9
commit
e37a9de71d
@ -7,6 +7,7 @@ import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as WebSocket from 'ws';
|
||||
import * as cluster from 'cluster';
|
||||
import * as request from 'request';
|
||||
|
||||
import { checkDbConnection } from './database';
|
||||
import routes from './routes';
|
||||
@ -174,6 +175,11 @@ class Server {
|
||||
.post(config.API_ENDPOINT + 'donations', routes.createDonationRequest.bind(routes))
|
||||
.post(config.API_ENDPOINT + 'donations-webhook', routes.donationWebhook.bind(routes))
|
||||
;
|
||||
} else {
|
||||
this.app
|
||||
.get(config.API_ENDPOINT + 'donations', (req, res) => {
|
||||
req.pipe(request('http://mempool.space/api/v1/donations')).pipe(res);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WebsocketService } from '../../services/websocket.service';
|
||||
import { SeoService } from 'src/app/services/seo.service';
|
||||
import { StateService } from 'src/app/services/state.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ApiService } from 'src/app/services/api.service';
|
||||
import { env } from '../../app.constants';
|
||||
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||
@ -43,7 +43,7 @@ export class AboutComponent implements OnInit {
|
||||
handle: [''],
|
||||
});
|
||||
|
||||
(this.sponsorsEnabled ? this.apiService.getDonation$() : this.apiService.getDonationRemote$())
|
||||
this.apiService.getDonation$()
|
||||
.subscribe((sponsors) => {
|
||||
this.sponsors = sponsors;
|
||||
});
|
||||
|
@ -73,8 +73,4 @@ export class ApiService {
|
||||
getDonation$(): Observable<any[]> {
|
||||
return this.httpClient.get<any[]>(this.apiBaseUrl + '/donations');
|
||||
}
|
||||
|
||||
getDonationRemote$(): Observable<any[]> {
|
||||
return this.httpClient.get<any[]>('http://mempool.space/api/v1/donations');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user