Skip to content

Commit dcce67e

Browse files
guanbinruiswkatmasknuanyang233
authored
[Release] Hotfix 2.31.3 => 2.31.4 (patch) (#12116)
* chore: bump version to v2.31.4 * refactor: mf-6630 replace relation service with web3bio (#12115) (#12117) * fix: mf-6631 add custom token (#12118) * fix: mf-6632 missing period * fix: mf-6631 add custom token * fix: run codegen --------- Co-authored-by: swkatmask <[email protected]> * fix(Web3Bio): convert twitter handle to lowercase (#12121) * feat: feedback for uninstall (#12111) * fix(Web3Bio): profile api could fail to found profiles (#12122) * fix: merge lens and farcaster accounts (#12123) * fix: merge lens and farcaster accounts * fix: two calendars get injected in search page * fix(Web3bio): use uid as identity for farcaster account (#12124) * fix(Web3bio): use uid as identity for farcaster account * fix: prettier --------- Co-authored-by: swkatmask <[email protected]> * fix: mf-6618 farcaster id could be duplicate (#12109) * fix: mf-6597 improve okx api request (#12126) * fix: typing * fix: mf-6597 improve okx api request * fix: throw error to trigger refetching (#12127) * chore: add api key header for web3bio requests (#12128) * fix: mf-6634 farcaster userId is number (#12129) --------- Co-authored-by: Wukong Sun <[email protected]> Co-authored-by: swkatmask <[email protected]> Co-authored-by: nuanyang233 <[email protected]>
1 parent be6ff34 commit dcce67e

File tree

53 files changed

+424
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+424
-678
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"yarn": ">=999.0.0",
99
"npm": ">=999.0.0"
1010
},
11-
"version": "2.31.3",
11+
"version": "2.31.4",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {

packages/mask/background/tasks/NotCancellable/OnInstall.ts

+2
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ browser.runtime.onInstalled.addListener(async (detail) => {
4848
}
4949
}
5050
})
51+
52+
browser.runtime.setUninstallURL('https://www.mask.io/feedback')

packages/mask/content-script/components/InjectedComponents/ProfileCard/ProfileCardTitle.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '@masknet/shared-base'
1212
import { makeStyles } from '@masknet/theme'
1313
import type { Web3Helper } from '@masknet/web3-helpers'
14-
import { NextIDProof } from '@masknet/web3-providers'
14+
import { Web3Bio } from '@masknet/web3-providers'
1515
import { useQuery } from '@tanstack/react-query'
1616
import type { HTMLProps } from 'react'
1717
import { useLastRecognizedIdentity } from '../../DataSource/useActivatedUI.js'
@@ -105,12 +105,12 @@ export function ProfileCardTitle({
105105

106106
const userId = identity?.identifier?.userId
107107
const itsMe = !!userId && userId === me?.identifier?.userId
108-
const { data: nextIdBindings = EMPTY_LIST } = useQuery({
109-
queryKey: ['next-id', 'profiles-by-twitter-id', userId],
108+
const { data: web3bioProfiles = EMPTY_LIST } = useQuery({
109+
queryKey: ['web3bio', 'profiles-by-twitter-id', userId],
110110
enabled: !!userId,
111111
queryFn: async () => {
112112
if (!userId) return EMPTY_LIST
113-
return NextIDProof.queryProfilesByTwitterId(userId)
113+
return Web3Bio.getProfilesByTwitterId(userId)
114114
},
115115
})
116116
const tipsDisabled = useIsMinimalMode(PluginID.Tips)
@@ -131,9 +131,9 @@ export function ProfileCardTitle({
131131
address={address}
132132
onAddressChange={onAddressChange}>
133133
<div className={classes.operations}>
134-
{nextIdBindings.length ?
134+
{web3bioProfiles.length ?
135135
<SocialAccountList
136-
nextIdBindings={nextIdBindings}
136+
web3bioProfiles={web3bioProfiles}
137137
userId={userId}
138138
disablePortal
139139
anchorPosition={{

packages/mask/content-script/components/InjectedComponents/ProfileTabContent.tsx

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
1-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
2-
import { useUpdateEffect } from 'react-use'
3-
import { first } from 'lodash-es'
4-
import { TabContext } from '@mui/lab'
5-
import { Button, Stack, Tab, ThemeProvider, Typography } from '@mui/material'
1+
import Services from '#services'
2+
import { Trans } from '@lingui/react/macro'
63
import { Icons } from '@masknet/icons'
7-
import { useQuery } from '@tanstack/react-query'
8-
import { Telemetry } from '@masknet/web3-telemetry'
9-
import { EventType, EventID } from '@masknet/web3-telemetry/types'
4+
import { getAvailablePlugins } from '@masknet/plugin-infra'
105
import {
6+
getProfileTabContent,
117
useActivatedPluginsSiteAdaptor,
128
useIsMinimalMode,
139
usePluginTransField,
14-
getProfileTabContent,
1510
} from '@masknet/plugin-infra/content-script'
16-
import { getAvailablePlugins } from '@masknet/plugin-infra'
1711
import {
1812
AddressItem,
13+
addressSorter,
1914
ConnectPersonaBoundary,
2015
GrantPermissions,
16+
LoadingStatus,
2117
PluginCardFrameMini,
22-
useCurrentPersonaConnectStatus,
23-
useSocialAccountsBySettings,
24-
TokenWithSocialGroupMenu,
2518
SocialAccountList,
19+
TokenWithSocialGroupMenu,
2620
useCollectionByTwitterHandle,
27-
addressSorter,
21+
useCurrentPersonaConnectStatus,
22+
useSocialAccountsBySettings,
2823
WalletSettingsEntry,
29-
LoadingStatus,
3024
} from '@masknet/shared'
3125
import {
3226
CrossIsolationMessages,
27+
currentPersonaIdentifier,
3328
EMPTY_LIST,
3429
MaskMessages,
3530
NextIDPlatform,
3631
PluginID,
3732
ProfileTabs,
3833
Sniffings,
39-
currentPersonaIdentifier,
4034
} from '@masknet/shared-base'
41-
import { useValueRef, useLocationChange } from '@masknet/shared-base-ui'
35+
import { useLocationChange, useValueRef } from '@masknet/shared-base-ui'
4236
import { makeStyles, MaskLightTheme, MaskTabList, useTabs } from '@masknet/theme'
43-
import { NextIDProof } from '@masknet/web3-providers'
44-
import { isSameAddress } from '@masknet/web3-shared-base'
4537
import { ScopedDomainsContainer, useSnapshotSpacesByTwitterHandle } from '@masknet/web3-hooks-base'
38+
import { Web3Bio } from '@masknet/web3-providers'
39+
import { isSameAddress } from '@masknet/web3-shared-base'
40+
import { Telemetry } from '@masknet/web3-telemetry'
41+
import { EventID, EventType } from '@masknet/web3-telemetry/types'
42+
import { TabContext } from '@mui/lab'
43+
import { Button, Stack, Tab, ThemeProvider, Typography } from '@mui/material'
44+
import { useQuery } from '@tanstack/react-query'
45+
import { first } from 'lodash-es'
46+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
47+
import { useUpdateEffect } from 'react-use'
48+
import { usePersonasFromDB } from '../../../shared-ui/hooks/usePersonasFromDB.js'
4649
import {
4750
useCurrentVisitingIdentity,
4851
useLastRecognizedIdentity,
@@ -51,9 +54,6 @@ import {
5154
} from '../DataSource/useActivatedUI.js'
5255
import { useGrantPermissions, usePluginHostPermissionCheck } from '../DataSource/usePluginHostPermission.js'
5356
import { SearchResultInspector } from './SearchResultInspector.js'
54-
import { usePersonasFromDB } from '../../../shared-ui/hooks/usePersonasFromDB.js'
55-
import Services from '#services'
56-
import { Trans } from '@lingui/react/macro'
5757

5858
const useStyles = makeStyles()((theme) => ({
5959
root: {
@@ -306,11 +306,11 @@ function Content(props: ProfileTabContentProps) {
306306

307307
const { data: identity } = useSocialIdentityByUserId(currentVisitingUserId)
308308

309-
const { data: nextIdBindings = EMPTY_LIST } = useQuery({
310-
queryKey: ['profiles', 'by-twitter-id', currentVisitingUserId],
309+
const { data: web3bioProfiles = EMPTY_LIST } = useQuery({
310+
queryKey: ['web3bio', 'by-twitter-id', currentVisitingUserId],
311311
queryFn: () => {
312312
if (!currentVisitingUserId) return EMPTY_LIST
313-
return NextIDProof.queryProfilesByTwitterId(currentVisitingUserId)
313+
return Web3Bio.getProfilesByTwitterId(currentVisitingUserId)
314314
},
315315
})
316316

@@ -465,7 +465,7 @@ function Content(props: ProfileTabContentProps) {
465465
fromSocialCard
466466
/>
467467

468-
<SocialAccountList nextIdBindings={nextIdBindings} userId={currentVisitingUserId} />
468+
<SocialAccountList web3bioProfiles={web3bioProfiles} userId={currentVisitingUserId} />
469469
</div>
470470
<div className={classes.settingItem}>
471471
<Trans>
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
1-
import {
2-
EMPTY_LIST,
3-
NextIDPlatform,
4-
type BindingProof,
5-
type ProfileIdentifier,
6-
type EnhanceableSite,
7-
} from '@masknet/shared-base'
8-
import { NextIDProof } from '@masknet/web3-providers'
1+
import { EMPTY_LIST, type EnhanceableSite, NextIDPlatform, type ProfileIdentifier } from '@masknet/shared-base'
2+
import { Web3Bio } from '@masknet/web3-providers'
93
import { useQuery } from '@tanstack/react-query'
10-
import { useCurrentPersona } from '../../shared-ui/hooks/index.js'
11-
import { PlatformSort, UnsupportedPlatforms } from '../pages/Friends/common.js'
124
import { useMemo } from 'react'
5+
import { useCurrentPersona } from '../../shared-ui/hooks/index.js'
6+
import { PlatformSort, UnsupportedPlatforms, type Profile } from '../pages/Friends/common.js'
137

14-
export function profilesFilter(x: BindingProof) {
15-
return (x.platform === NextIDPlatform.ENS && x.name.endsWith('.eth')) || !UnsupportedPlatforms.includes(x.platform)
8+
export function profilesFilter(x: Profile) {
9+
return (
10+
(x.platform === NextIDPlatform.ENS && x.name.endsWith('.eth')) ||
11+
!UnsupportedPlatforms.includes(x.platform as NextIDPlatform)
12+
)
1613
}
1714

18-
export function useFriendProfiles(seen: boolean, nextId?: string, profile?: ProfileIdentifier) {
15+
export function useFriendProfiles(seen: boolean, nextId?: string, profile?: ProfileIdentifier): Profile[] {
1916
const currentPersona = useCurrentPersona()
2017

2118
const { data: profiles = EMPTY_LIST } = useQuery({
19+
enabled: seen && !!nextId,
2220
queryKey: ['profiles', currentPersona?.identifier.publicKeyAsHex, nextId],
2321
queryFn: async () => {
2422
if (!nextId) return EMPTY_LIST
2523
try {
26-
return await NextIDProof.queryProfilesByPublicKey(nextId, 2)
24+
return await Web3Bio.getProfilesByNextId(nextId)
2725
} catch (error) {
2826
return EMPTY_LIST
2927
}
3028
},
31-
enabled: seen && !!nextId,
29+
select(profiles) {
30+
return profiles.map((profile) => ({
31+
platform: profile.platform,
32+
identity: profile.identity,
33+
is_valid: true,
34+
last_checked_at: '',
35+
name: profile.displayName,
36+
created_at: '',
37+
}))
38+
},
3239
})
3340
return useMemo(() => {
3441
if (profiles.length === 0) {
@@ -50,6 +57,6 @@ export function useFriendProfiles(seen: boolean, nextId?: string, profile?: Prof
5057
return EMPTY_LIST
5158
}
5259
}
53-
return profiles.filter(profilesFilter).sort((a, b) => PlatformSort[a.platform] - PlatformSort[b.platform])
60+
return profiles.sort((a, b) => PlatformSort[a.platform] - PlatformSort[b.platform])
5461
}, [profiles])
5562
}

packages/mask/popups/hooks/useFriendsFromSearch.tsx

+22-23
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,28 @@ export function useFriendsFromSearch(
2222
const currentIdentifier = useCurrentLinkedPersona()
2323
return useMemo(() => {
2424
if (!searchResult?.length && !localSearchedResult?.length) return EMPTY_LIST
25-
const localProfiles: NextIDPersonaBindingsWithIdentifier[] =
26-
localSearchedResult
27-
.filter((x) => x.persona.publicKeyAsHex !== currentIdentifier?.identifier.publicKeyAsHex && x.profile)
28-
.map((item) => {
29-
const profile = item.profile!
30-
return {
31-
proofs: [
32-
{
33-
platform: profile.network as FriendNetwork,
34-
identity: profile.userId,
35-
is_valid: true,
36-
last_checked_at: '',
37-
name: profile.userId,
38-
created_at: '',
39-
},
40-
],
41-
linkedPersona: item.persona,
42-
activated_at: '',
43-
persona: item.persona.publicKeyAsHex,
44-
isLocal: true,
45-
avatar: item.avatar,
46-
}
47-
}) ?? EMPTY_LIST
25+
const localProfiles: NextIDPersonaBindingsWithIdentifier[] = localSearchedResult
26+
.filter((x) => x.persona.publicKeyAsHex !== currentIdentifier?.identifier.publicKeyAsHex && x.profile)
27+
.map((item) => {
28+
const profile = item.profile!
29+
return {
30+
proofs: [
31+
{
32+
platform: profile.network as FriendNetwork,
33+
identity: profile.userId,
34+
is_valid: true,
35+
last_checked_at: '',
36+
name: profile.userId,
37+
created_at: '',
38+
},
39+
],
40+
linkedPersona: item.persona,
41+
activated_at: '',
42+
persona: item.persona.publicKeyAsHex,
43+
isLocal: true,
44+
avatar: item.avatar,
45+
}
46+
})
4847
const profiles: NextIDPersonaBindingsWithIdentifier[] =
4948
searchResult ?
5049
searchResult

packages/mask/popups/pages/Friends/AccountRender/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const AccountRender = memo<AccountRenderProps>(function AccountRender({ p
4141
profile.name
4242
: profile.identity
4343
return detail ?
44-
<DetailAccount userId={_userID} platform={profile.platform} />
45-
: <Account userId={_userID} platform={profile.platform} />
44+
<DetailAccount userId={_userID} displayName={profile.name} platform={profile.platform} />
45+
: <Account userId={_userID} displayName={profile.name} platform={profile.platform} />
4646
case NextIDPlatform.CyberConnect:
4747
case NextIDPlatform.Bit:
4848
case NextIDPlatform.SYBIL:

packages/mask/popups/pages/Friends/ContactCard/Account/index.tsx

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { memo } from 'react'
22
import { Box, Link } from '@mui/material'
33
import { Icons } from '@masknet/icons'
4-
import { makeStyles } from '@masknet/theme'
4+
import { makeStyles, TextOverflowTooltip } from '@masknet/theme'
55
import { NextIDPlatform } from '@masknet/shared-base'
66
import { formatEthereumAddress } from '@masknet/web3-shared-evm'
7-
import { formatUserId } from '../SocialAccount/index.js'
87
import { PlatformIconMap, PlatformUrlMap, type SupportedPlatforms } from '../../common.js'
98

109
interface AccountProps {
1110
platform: SupportedPlatforms
1211
userId?: string
12+
displayName?: string
1313
}
1414

1515
const useStyles = makeStyles()((theme) => ({
@@ -24,20 +24,34 @@ const useStyles = makeStyles()((theme) => ({
2424
fontStyle: 'normal',
2525
fontWeight: 700,
2626
lineHeight: '18px',
27+
minWidth: 0,
28+
},
29+
name: {
30+
flexGrow: 1,
31+
minWidth: 0,
32+
textOverflow: 'ellipsis',
33+
whiteSpace: 'nowrap',
34+
overflow: 'hidden',
2735
},
2836
}))
2937

30-
export const Account = memo<AccountProps>(function Account({ userId, platform }) {
38+
export const Account = memo<AccountProps>(function Account({ userId, displayName, platform }) {
3139
const { classes } = useStyles()
3240
const Icon = PlatformIconMap[platform]
3341

3442
if (!userId) return null
43+
const name =
44+
platform === NextIDPlatform.Ethereum ? formatEthereumAddress(userId, 4)
45+
: platform === NextIDPlatform.Farcaster && displayName ? displayName
46+
: userId
3547

3648
return (
3749
<Box width="156px" padding="4px" display="flex" gap="10px" alignItems="center">
3850
<Icon size={30} />
3951
<Box className={classes.userId}>
40-
{platform === NextIDPlatform.Ethereum ? formatEthereumAddress(userId, 4) : formatUserId(userId)}
52+
<TextOverflowTooltip title={name}>
53+
<span className={classes.name}>{name}</span>
54+
</TextOverflowTooltip>
4155
<Link
4256
underline="none"
4357
target="_blank"

packages/mask/popups/pages/Friends/ContactCard/SocialAccount/index.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Icons } from '@masknet/icons'
22
import { EnhanceableSite, twitterDomainMigrate } from '@masknet/shared-base'
3-
import { makeStyles } from '@masknet/theme'
3+
import { makeStyles, TextOverflowTooltip } from '@masknet/theme'
44
import { FireflyTwitter } from '@masknet/web3-providers'
55
import { Box, Link } from '@mui/material'
66
import { useQuery } from '@tanstack/react-query'
@@ -31,15 +31,15 @@ const useStyles = makeStyles()((theme) => ({
3131
fontWeight: 700,
3232
lineHeight: '18px',
3333
},
34+
name: {
35+
flexGrow: 1,
36+
minWidth: 0,
37+
textOverflow: 'ellipsis',
38+
whiteSpace: 'nowrap',
39+
overflow: 'hidden',
40+
},
3441
}))
3542

36-
export const formatUserId = (userId: string) => {
37-
if (userId.length > 7) {
38-
return `${userId.slice(0, 7)}...`
39-
}
40-
return userId
41-
}
42-
4343
export const SocialAccount = memo<SocialAccountProps>(function SocialAccount({ avatar, userId, site }) {
4444
const isOnTwitter = site === EnhanceableSite.Twitter
4545
const { data: twitterAvatar = avatar } = useQuery({
@@ -52,6 +52,7 @@ export const SocialAccount = memo<SocialAccountProps>(function SocialAccount({ a
5252
})
5353
const userAvatar = isOnTwitter ? twitterAvatar : avatar
5454
const { classes } = useStyles()
55+
const name = `@${userId}`
5556
return (
5657
<Box width="156px" padding="4px" display="flex" gap="10px" alignItems="center">
5758
<AccountAvatar
@@ -61,7 +62,9 @@ export const SocialAccount = memo<SocialAccountProps>(function SocialAccount({ a
6162
classes={{ avatar: classes.avatar, container: classes.avatar }}
6263
/>
6364
<Box className={classes.userId}>
64-
{`@${formatUserId(userId)}`}
65+
<TextOverflowTooltip title={name}>
66+
<span className={classes.name}>{name}</span>
67+
</TextOverflowTooltip>
6568
<Link
6669
underline="none"
6770
target="_blank"

packages/mask/popups/pages/Friends/ContactCard/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const ContactCard = memo<ContactCardProps>(function ContactCard({
103103
profile: profileIdentifier,
104104
}
105105
}
106-
}, [profiles, nextId, rawPublicKey])
106+
}, [nextId, rawPublicKey])
107107

108108
const handleAddFriend = useCallback(async () => {
109109
if (!friendInfo || !currentPersona) return

0 commit comments

Comments
 (0)