Skip to content

Commit

Permalink
Merge pull request #1653 from numbersprotocol/feature-update-authmedi…
Browse files Browse the repository at this point in the history
…a-link-to-use-one-time-token-for-private-assets

Update authmedia link to use one-time token for private assets
  • Loading branch information
sultanmyrza committed May 31, 2022
2 parents 8e42bfd + 7751964 commit f01358f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/features/home/details/details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class DetailsPage {
const result = await this.confirmAlert.present({
message:
this.translocoService.translate(
'message.assetBecomePublicAfterSharing'
'message.assetBecomePublicFor24Hours'
) + '!',
});
if (result) {
Expand Down
11 changes: 9 additions & 2 deletions src/app/shared/share/share.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { Injectable } from '@angular/core';
import { Share } from '@capacitor/share';
import { TranslocoService } from '@ngneat/transloco';
import { catchError } from 'rxjs/operators';
import { getAssetProfileUrl } from '../../utils/url';
import {
getAssetProfileUrl,
getAssetProfileUrlWithTmpToken,
} from '../../utils/url';
import {
DiaBackendAsset,
DiaBackendAssetRepository,
Expand All @@ -22,9 +25,13 @@ export class ShareService {
) {}

async share(asset: DiaBackendAsset) {
const tmpToken = await this.diaBackendAssetRepository
.createTemporaryShareToken$(asset.id)
.toPromise();

return Share.share({
text: this.defaultShareText,
url: await this.setPublicAndGetLink(asset),
url: getAssetProfileUrlWithTmpToken(asset.id, tmpToken),
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getAssetProfileUrl(id: string, token?: string) {

export function getAssetProfileUrlWithTmpToken(id: string, tmpToken?: string) {
if (tmpToken) {
return `https://authmedia.net/asset-profile?cid=${id}&tmp_token=${tmpToken}`;
return `https://authmedia.net/asset-profile?cid=${id}&token=${tmpToken}`;
}
return `https://authmedia.net/asset-profile?cid=${id}`;
}
1 change: 1 addition & 0 deletions src/assets/i18n/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"copyIpfsAddress": "Copy IPFS address",
"shareAssetProfile": "Share Asset Profile",
"assetBecomePublicAfterSharing": "This asset will become public after sharing",
"assetBecomePublicFor24Hours": "Anyone with the link will be able to access the asset in the next 24 hours",
"mintNftToken": "Mint NFT token",
"mintNftAlert": "Once the NFT is minted, photo and its information can be accessed publicly. Do you still want to proceed?",
"sentSuccessfully": "Sent Successfully",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"copyIpfsAddress": "複製 IPFS 位址",
"shareAssetProfile": "分享資產檔案",
"assetBecomePublicAfterSharing": "該資產將在分享後公開",
"assetBecomePublicFor24Hours": "其他用戶在接下來的 24 小時將可透過此連結存取影像",
"mintNftToken": "鑄造 NFT 代幣",
"mintNftAlert": "NFT 代幣鑄造後,影像以及所有資訊都將可被公開檢視。確定要繼續嗎?",
"sentSuccessfully": "成功送出",
Expand Down

0 comments on commit f01358f

Please sign in to comment.