Skip to content

Commit 3a0c463

Browse files
release: desktop iota 2.0.7 #8038 from iotaledger/release/desktop-iota-2.0.7
Merge pull request #8038 from iotaledger/release/desktop-iota-2.0.7
2 parents b1aaf5f + 71d6204 commit 3a0c463

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

packages/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "desktop",
33
"productName": "Firefly IOTA",
4-
"version": "2.0.6",
4+
"version": "2.0.7",
55
"description": "Official wallet application of Shimmer",
66
"main": "public/build/main.js",
77
"repository": "[email protected]:iotaledger/firefly.git",

packages/desktop/views/dashboard/collectibles/views/CollectiblesDetailsView.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import { localize } from '@core/i18n'
77
import { ExplorerEndpoint, getOfficialExplorerUrl } from '@core/network'
88
import {
9-
INft,
10-
NftDownloadMetadata,
119
allAccountNfts,
1210
convertAndFormatNftMetadata,
1311
getNftByIdFromAllAccountNfts,
12+
INft,
13+
isFlaggedNft,
14+
NftDownloadMetadata,
1415
selectedNftId,
1516
} from '@core/nfts'
1617
import { getBaseToken } from '@core/profile/actions'
@@ -66,6 +67,7 @@
6667
$: returnIfNftWasSent($allAccountNfts[$selectedAccountIndex], $time)
6768
$: timeDiff = getTimeDifference(new Date(nft.timelockTime), $time)
6869
$: alertText = getAlertText(downloadMetadata)
70+
$: flaggedNftWarning = nft && isFlaggedNft(nft)
6971
$: detailsList = {
7072
...(id && {
7173
nftId: { data: truncateString(id, 20, 20), copyValue: id, isCopyable: true },
@@ -178,6 +180,9 @@
178180
</Text>
179181
</nft-description>
180182
{/if}
183+
{#if flaggedNftWarning}
184+
<Alert type="warning" message={flaggedNftWarning} />
185+
{/if}
181186
<div class="overflow-y-scroll h-full flex flex-col space-y-4 pr-2 -mr-4">
182187
<nft-details class="flex flex-col space-y-4">
183188
<Text type={TextType.h5} fontWeight={FontWeight.semibold}>

packages/shared/components/NftActivityDetails.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import { selectedAccountIndex } from '@core/account/stores'
44
import { time } from '@core/app'
55
import { localize } from '@core/i18n'
6-
import { getNftByIdFromAllAccountNfts, ownedNfts, selectedNftId } from '@core/nfts'
7-
import { CollectiblesRoute, collectiblesRouter, DashboardRoute, dashboardRouter } from '@core/router'
6+
import { getNftByIdFromAllAccountNfts, isFlaggedNft, ownedNfts, selectedNftId } from '@core/nfts'
7+
import { CollectiblesRoute, DashboardRoute, collectiblesRouter, dashboardRouter } from '@core/router'
88
import { ActivityAsyncStatus, NftActivity } from '@core/wallet'
99
import { getSubjectFromActivity } from '@core/wallet/utils/generateActivity/helper'
10+
import { Alert } from '@ui'
1011
import {
1112
ActivityAsyncStatusPill,
1213
FontWeight,
@@ -26,6 +27,7 @@
2627
$: nftIsOwned = $ownedNfts.some((nft) => nft.id === activity.nftId)
2728
$: isTimelocked = activity?.asyncData?.timelockDate > $time
2829
$: subject = getSubjectFromActivity(activity)
30+
$: flaggedNftWarning = nft && isFlaggedNft(nft)
2931
3032
async function onClick(): Promise<void> {
3133
closePopup()
@@ -74,5 +76,8 @@
7476
{#if activity?.subject}
7577
<SubjectBox {subject} />
7678
{/if}
79+
{#if flaggedNftWarning}
80+
<Alert type="warning" message={flaggedNftWarning} />
81+
{/if}
7782
</main-content>
7883
</nft-transaction-details>

packages/shared/lib/core/nfts/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from './composeUrlFromNftUri'
44
export * from './convertAndFormatNftMetadata'
55
export * from './getSpendableStatusFromUnspentNftOutput'
66
export * from './fetchWithTimeout'
7+
export * from './isFlaggedNft'
78
export * from './isNftOwnedByAnyAccount'
89
export * from './parseNftMetadata'
910
export * from './rewriteIpfsUri'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { INft } from '../interfaces'
2+
3+
/**
4+
* Check if an NFT is flagged as a potential scam
5+
* @param nft The NFT to check
6+
* @returns True if the NFT is flagged
7+
*/
8+
export function isFlaggedNft(nft: INft): string | undefined {
9+
const name = nft.name ?? ''
10+
const parsedMetadata = nft.parsedMetadata
11+
const parsedName = parsedMetadata?.name ?? ''
12+
const parsedDescription = parsedMetadata?.description ?? ''
13+
const urlRegex = /((https?|ftp|file):\/\/)?([\da-z-]+\.)+([a-z]{2,6})([/\w .-]*)*\/?$/gi
14+
const containsUrl = urlRegex.test(name) || urlRegex.test(parsedName) || urlRegex.test(parsedDescription)
15+
// Note: in order to avoid issues with the translations, we are using a hardcoded string here
16+
const WARNING_MESSAGE =
17+
'Be careful when following unknown links. Never share your private keys, nor enter them into any websites or services. '
18+
return containsUrl ? WARNING_MESSAGE : undefined
19+
}

0 commit comments

Comments
 (0)