Use Twitter API to fetch profile photos.

fixes #133
This commit is contained in:
softsimon
2020-10-16 16:29:54 +07:00
parent e7a7b45ad0
commit 15fdb69b96
6 changed files with 119 additions and 33 deletions

View File

@@ -44,7 +44,9 @@
<ng-template ngFor let-sponsor [ngForOf]="sponsors">
<a [href]="'https://twitter.com/' + sponsor.handle" target="_blank">
<div class="profile_photo d-inline-block" [ngStyle]="{'background-image': 'url(' + sponsor.imageUrl + ')'}" [title]="sponsor.handle"></div>
<div class="profile_photo d-inline-block" [title]="sponsor.handle">
<img class="profile_img" [src]="bypassSecurityTrustUrl('data:image/jpeg;base64,' + sponsor.image_64)" />
</div>
</a>
</ng-template>
<br><br>
@@ -82,7 +84,7 @@
<div *ngIf="donationStatus === 3" class="text-center">
<div class="qr-wrapper mt-2 mb-2">
<a [href]="bitcoinUrl" target="_blank">
<a [href]="bypassSecurityTrustUrl('bitcoin:' + donationObj.address + '?amount=' + donationObj.amount)" target="_blank">
<app-qrcode [data]="'bitcoin:' + donationObj.address + '?amount=' + donationObj.amount"></app-qrcode>
</a>
</div>

View File

@@ -12,6 +12,13 @@
margin: 10px;
}
.profile_img {
width: 80px;
height: 80px;
border-radius: 50%;
border: 0;
}
.text-small {
font-size: 12px;
}
}

View File

@@ -22,7 +22,6 @@ export class AboutComponent implements OnInit {
donationObj: any;
sponsorsEnabled = env.SPONSORS_ENABLED;
sponsors = null;
bitcoinUrl: SafeUrl;
constructor(
private websocketService: WebsocketService,
@@ -63,8 +62,11 @@ export class AboutComponent implements OnInit {
.subscribe((response) => {
this.websocketService.trackDonation(response.id);
this.donationObj = response;
this.bitcoinUrl = this.sanitizer.bypassSecurityTrustUrl('bitcoin:' + this.donationObj.address + '?amount=' + this.donationObj.amount);
this.donationStatus = 3;
});
}
bypassSecurityTrustUrl(text: string): SafeUrl {
return this.sanitizer.bypassSecurityTrustUrl(text);
}
}