diff --git a/backend/src/api/donations.ts b/backend/src/api/donations.ts index d9c96aa6e..efde7116a 100644 --- a/backend/src/api/donations.ts +++ b/backend/src/api/donations.ts @@ -63,15 +63,18 @@ class Donations { } let imageUrl = ''; + let handle = ''; if (response.orderId !== '') { try { - imageUrl = await this.$getTwitterImageUrl(response.orderId); + const hiveData = await this.$getTwitterImageUrl(response.orderId); + imageUrl = hiveData.imageUrl; + handle = hiveData.screenName; } catch (e) { console.log('Error fetching twitter image', e.message); } } - this.$addDonationToDatabase(response, imageUrl); + this.$addDonationToDatabase(response.btcPaid, handle, response.id, imageUrl); } private getStatus(id: string): Promise { @@ -90,7 +93,7 @@ class Donations { async $getDonationsFromDatabase() { try { const connection = await DB.pool.getConnection(); - const query = `SELECT handle, imageUrl FROM donations WHERE handle != ''`; + const query = `SELECT handle, imageUrl FROM donations WHERE handle != '' ORDER BY id ASC`; const [rows] = await connection.query(query); connection.release(); return rows; @@ -99,14 +102,14 @@ class Donations { } } - private async $addDonationToDatabase(response: any, imageUrl: string): Promise { + private async $addDonationToDatabase(btcPaid: number, handle: string, orderId: string, imageUrl: string): Promise { try { const connection = await DB.pool.getConnection(); const query = `INSERT INTO donations(added, amount, handle, order_id, imageUrl) VALUES (NOW(), ?, ?, ?, ?)`; const params: (string | number)[] = [ - response.btcPaid, - response.orderId, - response.id, + btcPaid, + handle, + orderId, imageUrl, ]; const [result]: any = await connection.query(query, params); @@ -116,14 +119,14 @@ class Donations { } } - private async $getTwitterImageUrl(handle: string): Promise { + private async $getTwitterImageUrl(handle: string): Promise { return new Promise((resolve, reject) => { request.get({ uri: `https://api.hive.one/v1/influencers/screen_name/${handle}/?format=json`, json: true, }, (err, res, body) => { if (err) { return reject(err); } - resolve(body.data.imageUrl); + resolve(body.data); }); }); } diff --git a/frontend/src/app/components/about/about.component.html b/frontend/src/app/components/about/about.component.html index f84270ca1..b99f888d8 100644 --- a/frontend/src/app/components/about/about.component.html +++ b/frontend/src/app/components/about/about.component.html @@ -4,82 +4,111 @@

-

Contributors

+

Mempool Open Source Project

+ +
+ + + + + + + + + + + + + + + + + + + +


+ +

Maintainers

+ +
+
+
+
+ + @softsimon_ +
+ Development +
+
+
+ + @wiz +
+ Operations +
+
+
-

Development @softsimon_ -
Operations @wiz -
Logo & theme design @markjborg

- +

Sponsors

-

❤️ Sponsors

+
+
+
+
+
+

+ + +

+ Navigate to https://mempool.space/about to sponsor +

-
-

- - - -
-
-
-
- -
- +
+ +
+
+
-
-
- @ -
- -
-
- -
- -
- - -
- If you donate 0.01 BTC or more, your profile photo will be added to the list of sponsors above :) +
-
- -
-
- +
+
+ @ +
+
-
-

{{ donationObj.address }}

-

{{ donationObj.amount }} BTC

+
+ +
+ +
-

Waiting for transaction...

-
+ +
+ If you donate 0.01 BTC or more, your profile photo will be added to the list of sponsors above :)
- -
-

Donation confirmed!
Thank you!

-

If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.

-
- -

-
-

Open source

+
+
+ +
+
+

{{ donationObj.address }}

+

{{ donationObj.amount }} BTC

+ +

Waiting for transaction...

+
+
+ +
+

Donation confirmed!
Thank you!

+

If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.

+
- - - - Git - - - - - - github.com/mempool/mempool

diff --git a/frontend/src/app/components/about/about.component.scss b/frontend/src/app/components/about/about.component.scss index 0bb662b1e..1917fd536 100644 --- a/frontend/src/app/components/about/about.component.scss +++ b/frontend/src/app/components/about/about.component.scss @@ -10,6 +10,7 @@ background-size: 100%, 100%; border-radius: 50%; cursor: pointer; + margin: 10px; } .text-small { diff --git a/frontend/src/app/components/about/about.component.ts b/frontend/src/app/components/about/about.component.ts index fbdeb73dc..7e8eaefca 100644 --- a/frontend/src/app/components/about/about.component.ts +++ b/frontend/src/app/components/about/about.component.ts @@ -19,6 +19,7 @@ export class AboutComponent implements OnInit { sponsors$: Observable; donationObj: any; sponsorsEnabled = env.SPONSORS_ENABLED; + sponsors = null; constructor( private websocketService: WebsocketService, @@ -38,7 +39,12 @@ export class AboutComponent implements OnInit { handle: [''], }); - this.sponsors$ = this.apiService.getDonation$(); + (this.sponsorsEnabled ? this.apiService.getDonation$() : this.apiService.getDonationRemote$()) + .subscribe((sponsors) => { + this.sponsors = sponsors; + }); + + this.apiService.getDonation$() this.stateService.donationConfirmed$.subscribe(() => this.donationStatus = 4); } diff --git a/frontend/src/app/components/api-docs/api-docs.component.ts b/frontend/src/app/components/api-docs/api-docs.component.ts index f6fcfe94f..3ec89c27b 100644 --- a/frontend/src/app/components/api-docs/api-docs.component.ts +++ b/frontend/src/app/components/api-docs/api-docs.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { StateService } from 'src/app/services/state.service'; +import { WebsocketService } from 'src/app/services/websocket.service'; @Component({ selector: 'app-api-docs', @@ -12,9 +13,12 @@ export class ApiDocsComponent implements OnInit { constructor( private stateService: StateService, + private websocketService: WebsocketService, ) { } ngOnInit(): void { + this.websocketService.want(['blocks']); + if (this.stateService.network === 'bisq') { this.active = 2; } diff --git a/frontend/src/app/components/master-page/master-page.component.html b/frontend/src/app/components/master-page/master-page.component.html index 6aa8d4291..65809e329 100644 --- a/frontend/src/app/components/master-page/master-page.component.html +++ b/frontend/src/app/components/master-page/master-page.component.html @@ -52,12 +52,12 @@ - +
diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts index 5f97481fb..2a28e5b05 100644 --- a/frontend/src/app/services/api.service.ts +++ b/frontend/src/app/services/api.service.ts @@ -73,4 +73,8 @@ export class ApiService { getDonation$(): Observable { return this.httpClient.get(this.apiBaseUrl + '/donations'); } + + getDonationRemote$(): Observable { + return this.httpClient.get('http://mempool.space/api/v1/donations'); + } } diff --git a/frontend/src/resources/profile_softsimon.jpg b/frontend/src/resources/profile_softsimon.jpg new file mode 100644 index 000000000..2e8966120 Binary files /dev/null and b/frontend/src/resources/profile_softsimon.jpg differ diff --git a/frontend/src/resources/profile_wiz.jpg b/frontend/src/resources/profile_wiz.jpg new file mode 100644 index 000000000..9247a675e Binary files /dev/null and b/frontend/src/resources/profile_wiz.jpg differ