Skip to content

Commit c91b741

Browse files
authored
[Release] Hotfix 2.18.3 => 2.18.4 (patch) (#9203)
1 parent 98dbced commit c91b741

File tree

44 files changed

+337
-166
lines changed

Some content is hidden

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

44 files changed

+337
-166
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"yarn": ">=999.0.0",
88
"npm": ">=999.0.0"
99
},
10-
"version": "2.18.3",
10+
"version": "2.18.4",
1111
"private": true,
1212
"license": "AGPL-3.0-or-later",
1313
"scripts": {

packages/flags/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@masknet/flags",
3+
"version": "0.0.0",
34
"private": true,
45
"type": "module",
56
"exports": {

packages/flags/src/flags/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const isAndroidApp = process.env.architecture === 'app' && process.env.engine ==
33

44
const appOnly = process.env.architecture === 'app'
55
const devOnly = process.env.NODE_ENV === 'development'
6+
const prodOnly = process.env.NODE_ENV === 'production'
67
const webOnly = process.env.architecture === 'web' || devOnly
78
const insiderOnly = process.env.channel === 'insider' || devOnly
89
const betaOrInsiderOnly = insiderOnly || process.env.channel === 'beta'
@@ -59,6 +60,14 @@ export const flags = {
5960
sandboxedPluginRuntime: insiderOnly,
6061

6162
simplehash_ab_percentage: 50,
63+
64+
/** The earliest version for the sentry to watch events and exceptions. */
65+
sentry_earliest_version: process.env.VERSION,
66+
sentry_sample_rate: 0.1,
67+
sentry_enabled: prodOnly,
68+
sentry_event_enabled: prodOnly,
69+
sentry_exception_enabled: prodOnly,
70+
sentry_fetch_exception_enabled: prodOnly,
6271
} as const
6372

6473
if (process.env.NODE_ENV === 'development') {

packages/mask/src/components/DataSource/useNextIDVerify.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { activatedSocialNetworkUI } from '../../social-network/index.js'
99

1010
export function useNextIDVerify() {
1111
const verifyPostCollectTimer = useRef<NodeJS.Timer | null>(null)
12-
const collectVerificationPost = activatedSocialNetworkUI.configuration.nextIDConfig?.collectVerificationPost
12+
const getPostIdFromNewPostToast = activatedSocialNetworkUI.configuration.nextIDConfig?.getPostIdFromNewPostToast
1313
const postMessage = activatedSocialNetworkUI.automation?.nativeCompositionDialog?.appendText
1414
const platform = activatedSocialNetworkUI.configuration.nextIDConfig?.platform as NextIDPlatform | undefined
1515

@@ -36,11 +36,10 @@ export function useNextIDVerify() {
3636

3737
const postContent = payload.postContent.replace('%SIG_BASE64%', toBase64(fromHex(signature)))
3838
postMessage?.(postContent, { recover: false })
39-
4039
await new Promise<void>((resolve, reject) => {
4140
verifyPostCollectTimer.current = setInterval(async () => {
42-
const post = collectVerificationPost?.(postContent)
43-
if (post && persona.identifier.publicKeyAsHex) {
41+
const postId = getPostIdFromNewPostToast?.()
42+
if (postId && persona.identifier.publicKeyAsHex) {
4443
clearInterval(verifyPostCollectTimer.current!)
4544
await NextIDProof.bindProof(
4645
payload.uuid,
@@ -51,7 +50,7 @@ export function useNextIDVerify() {
5150
payload.createdAt,
5251
{
5352
signature,
54-
proofLocation: post.postId,
53+
proofLocation: postId,
5554
},
5655
)
5756
resolve()

packages/mask/src/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Mask Network",
3-
"version": "2.18.3",
3+
"version": "2.18.4",
44
"manifest_version": 2,
55
"permissions": ["storage", "downloads", "webNavigation", "activeTab"],
66
"optional_permissions": ["<all_urls>", "notifications", "clipboardRead"],

packages/mask/src/social-network-adaptor/twitter.com/collecting/post.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { DOMProxy, DOMProxyEvents, IntervalWatcher } from '@dimensiondev/holoflows-kit'
22
import type { PostInfo } from '@masknet/plugin-infra/content-script'
33
import { PostIdentifier, ProfileIdentifier } from '@masknet/shared-base'
4+
import { parseId } from '../utils/url.js'
45
import {
56
isTypedMessageAnchor,
67
isTypedMessageText,
@@ -23,7 +24,12 @@ import { twitterBase } from '../base.js'
2324
import { injectMaskIconToPostTwitter } from '../injection/MaskIcon.js'
2425
import { twitterShared } from '../shared.js'
2526
import { getPostId, postContentMessageParser, postImagesParser, postParser } from '../utils/fetch.js'
26-
import { postsContentSelector, postsImageSelector, timelinePostContentSelector } from '../utils/selector.js'
27+
import {
28+
postsContentSelector,
29+
postsImageSelector,
30+
timelinePostContentSelector,
31+
toastLinkSelector,
32+
} from '../utils/selector.js'
2733
import { IdentityProviderTwitter } from './identity.js'
2834

2935
function getPostActionsNode(postNode: HTMLElement | null) {
@@ -156,6 +162,11 @@ export const PostProviderTwitter: Next.CollectingCapabilities.PostsProvider = {
156162
},
157163
}
158164

165+
export function getPostIdFromNewPostToast() {
166+
const toastLinkNode = toastLinkSelector().evaluate()
167+
return toastLinkNode?.href ? parseId(toastLinkNode?.href) : ''
168+
}
169+
159170
export function collectVerificationPost(keyword: string) {
160171
const userId = IdentityProviderTwitter.recognized.value.identifier || globalUIState.profiles.value[0].identifier
161172
const postNodes = timelinePostContentSelector().evaluate()

packages/mask/src/social-network-adaptor/twitter.com/ui-provider.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { gotoNewsFeedPageTwitter } from './automation/gotoNewsFeedPage.js'
1515
import { gotoProfilePageTwitter } from './automation/gotoProfilePage.js'
1616
import { IdentityProviderTwitter, CurrentVisitingIdentityProviderTwitter } from './collecting/identity.js'
1717
import { ThemeSettingsProviderTwitter } from './collecting/theme.js'
18-
import { collectVerificationPost, PostProviderTwitter } from './collecting/post.js'
18+
import { collectVerificationPost, PostProviderTwitter, getPostIdFromNewPostToast } from './collecting/post.js'
1919
import { useThemeTwitterVariant } from './customization/custom.js'
2020
import { injectToolboxHintAtTwitter } from './injection/ToolboxHint.js'
2121
import { i18NOverwriteTwitter } from './customization/i18n.js'
@@ -217,6 +217,7 @@ const twitterUI: SocialNetworkUI.Definition = {
217217
enable: true,
218218
platform: NextIDPlatform.Twitter,
219219
collectVerificationPost,
220+
getPostIdFromNewPostToast,
220221
},
221222
steganography: {
222223
// ! Change this might be a breaking change !

packages/mask/src/social-network-adaptor/twitter.com/utils/fetch.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { keccak256 } from 'web3-utils'
2-
import { regexMatch } from '../../../utils/utils.js'
32
import { flattenDeep } from 'lodash-es'
4-
import { canonifyImgUrl } from './url.js'
3+
import { canonifyImgUrl, parseId } from './url.js'
54
import {
65
makeTypedMessageText,
76
makeTypedMessageAnchor,
@@ -14,10 +13,6 @@ import {
1413
} from '@masknet/typed-message'
1514
import { collectNodeText, collectTwitterEmoji } from '../../../utils/index.js'
1615

17-
const parseId = (t: string) => {
18-
return regexMatch(t, /status\/(\d+)/, 1)!
19-
}
20-
2116
/**
2217
* Get post id from dom, including normal tweet, quoted tweet and retweet one
2318
*/

packages/mask/src/social-network-adaptor/twitter.com/utils/selector.ts

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ export const timelinePostContentSelector = () =>
187187
].join(),
188188
)
189189

190+
export const toastLinkSelector = () => querySelector<HTMLLinkElement>('[data-testid="toast"] a')
191+
190192
export const postsContentSelector = () =>
191193
querySelectorAll(
192194
[

packages/mask/src/social-network-adaptor/twitter.com/utils/url.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { regexMatch } from '../../../utils/utils.js'
2+
13
export const twitterUrl = {
24
hostIdentifier: 'twitter.com',
35
hostLeadingUrl: 'https://twitter.com',
@@ -26,3 +28,7 @@ export const canonifyImgUrl = (url: string) => {
2628
}
2729
return parsed.href
2830
}
31+
32+
export const parseId = (t: string) => {
33+
return regexMatch(t, /status\/(\d+)/, 1)!
34+
}

packages/plugins/Debugger/src/SNSAdaptor/components/ConnectionContent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function ConnectionContent(props: ConnectionContentProps) {
4545
telemetry.captureException(
4646
TelemetryAPI.ExceptionType.Error,
4747
TelemetryAPI.ExceptionID.Debug,
48-
new Error('An error message.'),
48+
new Error(`An error message ${Date.now()}.`),
4949
)
5050
}, [telemetry])
5151

packages/plugins/EVM/src/state/IdentityService.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import { Web3StateSettings } from '../settings/index.js'
2020
const ENS_RE = /[^\s()[\]]{1,256}\.(eth|kred|xyz|luxe)\b/gi
2121
const SID_RE = /[^\t\n\v()[\]]{1,256}\.bnb\b/gi
2222
const ADDRESS_FULL = /0x\w{40,}/i
23-
const RSS3_URL_RE = /https?:\/\/(?<name>[\w.]+)\.(rss3|cheers)\.bio/
24-
const RSS3_RNS_RE = /(?<name>[\w.]+)\.rss3/
23+
const CROSSBELL_HANDLE_RE = /(?<name>[\w.]+)\.csb/
2524
const LENS_RE = /[^\s()[\]]{1,256}\.lens\b/i
2625
const LENS_URL_RE = /https?:\/\/.+\/(\w+\.lens)/
2726
const LENS_DOMAIN_RE = /[a-z][\d_a-z]{4,25}\.lens/
@@ -40,10 +39,10 @@ function getSIDNames(userId: string, nickname: string, bio: string) {
4039
return [userId.match(SID_RE), nickname.match(SID_RE), bio.match(SID_RE)].flatMap((result) => result ?? [])
4140
}
4241

43-
function getRSS3Ids(nickname: string, profileURL: string, bio: string) {
44-
return [nickname.match(RSS3_RNS_RE), profileURL.match(RSS3_URL_RE), bio.match(RSS3_URL_RE), bio.match(RSS3_RNS_RE)]
45-
.map((result) => result?.groups?.name ?? '')
46-
.filter(Boolean)
42+
function getCrossBellHandles(nickname: string, bio: string) {
43+
return [nickname.match(CROSSBELL_HANDLE_RE), bio.match(CROSSBELL_HANDLE_RE)]
44+
.map((result) => result?.groups?.name)
45+
.filter(Boolean) as string[]
4746
}
4847

4948
function getAddress(text: string) {
@@ -120,15 +119,16 @@ export class IdentityService extends IdentityServiceState<ChainId> {
120119
return this.createSocialAddress(SocialAddressType.Address, address)
121120
}
122121

123-
/** Read a social address from bio when it contains a RSS3 ID. */
124-
private async getSocialAddressFromRSS3({ nickname = '', homepage = '', bio = '' }: SocialIdentity) {
125-
const ids = getRSS3Ids(nickname, homepage, bio)
126-
if (!ids.length) return
122+
/** Read a social address from bio when it contains a csb handle. */
123+
private async getSocialAddressFromCrossbell({ nickname = '', bio = '' }: SocialIdentity) {
124+
const handles = getCrossBellHandles(nickname, bio)
125+
if (!handles.length) return
127126

128127
const allSettled = await Promise.allSettled(
129-
ids.map(async (id) => {
130-
const info = await RSS3.getNameInfo(id)
131-
return this.createSocialAddress(SocialAddressType.RSS3, info?.address ?? '', `${id}.rss3`)
128+
handles.map(async (handle) => {
129+
const info = await RSS3.getNameInfo(handle)
130+
if (!info?.crossbell) return
131+
return this.createSocialAddress(SocialAddressType.Crossbell, info.address, info.crossbell)
132132
}),
133133
)
134134
return compact(allSettled.map((x) => (x.status === 'fulfilled' ? x.value : undefined)).filter(Boolean))
@@ -279,7 +279,7 @@ export class IdentityService extends IdentityServiceState<ChainId> {
279279
this.getSocialAddressFromENS(identity),
280280
this.getSocialAddressFromSpaceID(identity),
281281
this.getSocialAddressFromAvatarNextID(identity),
282-
this.getSocialAddressFromRSS3(identity),
282+
this.getSocialAddressFromCrossbell(identity),
283283
this.getSocialAddressFromTwitterBlue(identity),
284284
this.getSocialAddressesFromNextID(identity),
285285
this.getSocialAddressesFromMaskX(identity),

packages/types/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export namespace SocialNetworkUI {
286286
enable?: boolean
287287
platform: NextIDPlatform
288288
collectVerificationPost: (keyword: string) => PostIdentifier | null
289+
getPostIdFromNewPostToast: () => string
289290
}
290291
export interface TipsConfig {
291292
enableUserGuide?: boolean

packages/web3-providers/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@bonfida/spl-name-service": "^0.1.50",
3535
"@dimensiondev/mask-wallet-core": "0.1.0-20211013082857-eb62e5f",
3636
"@masknet/icons": "workspace:^",
37+
"@masknet/flags": "workspace:^",
3738
"@masknet/public-api": "workspace:^",
3839
"@masknet/shared-base": "workspace:^",
3940
"@masknet/web3-constants": "workspace:^",

packages/web3-providers/src/CoinGecko/apis/DSearchAPI.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export interface NonFungibleToken {
2020
export class CoinGeckoSearchAPI<ChainId, SchemaType> implements DSearchBaseAPI.DataSourceProvider<ChainId, SchemaType> {
2121
async get(): Promise<Array<FungibleTokenResult<ChainId, SchemaType>>> {
2222
const tokensURL = urlcat(DSEARCH_BASE_URL, '/fungible-tokens/coingecko.json')
23-
return fetchJSON<Array<FungibleTokenResult<ChainId, SchemaType>>>(tokensURL)
23+
return fetchJSON<Array<FungibleTokenResult<ChainId, SchemaType>>>(tokensURL, { mode: 'cors' })
2424
}
2525
}

packages/web3-providers/src/CoinMarketCap/apis/DSearchAPI.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export class CoinMarketCapSearchAPI<ChainId, SchemaType>
2222
{
2323
async get(): Promise<Array<FungibleTokenResult<ChainId, SchemaType>>> {
2424
const tokensURL = urlcat(DSEARCH_BASE_URL, '/fungible-tokens/coinmarketcap.json')
25-
return fetchJSON<Array<FungibleTokenResult<ChainId, SchemaType>>>(tokensURL)
25+
return fetchJSON<Array<FungibleTokenResult<ChainId, SchemaType>>>(tokensURL, { mode: 'cors' })
2626
}
2727
}

packages/web3-providers/src/DSearch/index.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ export class DSearchAPI<ChainId = Web3Helper.ChainIdAll, SchemaType = Web3Helper
221221
const specificTokens = (
222222
await Promise.allSettled([
223223
fetchJSON<Array<FungibleTokenResult<ChainId, SchemaType>>>(
224-
urlcat(DSEARCH_BASE_URL, '/fungible-tokens/specific-list.json'),
224+
urlcat(DSEARCH_BASE_URL, '/fungible-tokens/specific-list.json', { mode: 'cors' }),
225225
),
226226
fetchJSON<Array<NonFungibleTokenResult<ChainId, SchemaType>>>(
227-
urlcat(DSEARCH_BASE_URL, '/non-fungible-tokens/specific-list.json'),
227+
urlcat(DSEARCH_BASE_URL, '/non-fungible-tokens/specific-list.json', { mode: 'cors' }),
228228
),
229229
fetchJSON<Array<NonFungibleCollectionResult<ChainId, SchemaType>>>(
230-
urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/specific-list.json'),
230+
urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/specific-list.json', { mode: 'cors' }),
231231
),
232232
])
233233
).flatMap(
@@ -444,9 +444,10 @@ export class DSearchAPI<ChainId = Web3Helper.ChainIdAll, SchemaType = Web3Helper
444444
* @returns
445445
*/
446446
async search<T extends SearchResult<ChainId, SchemaType> = SearchResult<ChainId, SchemaType>>(
447-
keyword: string,
447+
keyword_: string,
448448
type?: SearchResultType,
449449
): Promise<T[]> {
450+
const keyword = keyword_.toLowerCase()
450451
// filter out 'domain/xxx' or string ends with punctuation marks like 'eth.'
451452
if (
452453
keyword.replace(/([#$])?([\s\w+.])+/, '').length > 0 ||

packages/web3-providers/src/MaskX/index.ts

+3-13
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,9 @@ export class MaskX_API implements MaskX_BaseAPI.Provider {
2828
}
2929
}
3030

31-
try {
32-
const nameInfo = await this.RSS3.getNameInfo(handle)
33-
if (!nameInfo?.rnsName) throw new Error('Failed to fetch RNS name.')
34-
35-
return {
36-
...identity,
37-
sns_handle: nameInfo.rnsName,
38-
}
39-
} catch (error) {
40-
return {
41-
...identity,
42-
sns_handle: identity.web3_addr,
43-
}
31+
return {
32+
...identity,
33+
sns_handle: identity.web3_addr,
4434
}
4535
}
4636

packages/web3-providers/src/NFTScan/apis/DSearchAPI.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ export interface NonFungibleToken {
1919

2020
export class NFTScanSearchAPI<ChainId, SchemaType> implements DSearchBaseAPI.DataSourceProvider<ChainId, SchemaType> {
2121
async get(): Promise<Array<SearchResult<ChainId, SchemaType>>> {
22-
const nftsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-tokens/nftscan.json')
23-
const collectionsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/nftscan.json')
22+
const nftsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-tokens/nftscan.json', { mode: 'cors' })
23+
const collectionsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/nftscan.json', { mode: 'cors' })
2424
const nfts = fetchJSON<Array<SearchResult<ChainId, SchemaType>>>(nftsURL)
2525
const collections = fetchJSON<Array<SearchResult<ChainId, SchemaType>>>(collectionsURL)
26-
27-
return (await Promise.allSettled([nfts, collections])).flatMap((v) =>
26+
const collectionsFromSpecialList = await fetchJSON<Array<SearchResult<ChainId, SchemaType>>>(
27+
urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/specific-list.json', { mode: 'cors' }),
28+
)
29+
return (await Promise.allSettled([collectionsFromSpecialList, nfts, collections])).flatMap((v) =>
2830
v.status === 'fulfilled' && v.value ? v.value : [],
2931
)
3032
}
@@ -34,9 +36,9 @@ export class NFTScanCollectionSearchAPI<ChainId, SchemaType>
3436
implements DSearchBaseAPI.DataSourceProvider<ChainId, SchemaType>
3537
{
3638
async get(): Promise<Array<NonFungibleCollectionResult<ChainId, SchemaType>>> {
37-
const collectionsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/nftscan.json')
39+
const collectionsURL = urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/nftscan.json', { mode: 'cors' })
3840
const collectionsFromSpecialList = await fetchJSON<Array<NonFungibleCollectionResult<ChainId, SchemaType>>>(
39-
urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/specific-list.json'),
41+
urlcat(DSEARCH_BASE_URL, '/non-fungible-collections/specific-list.json', { mode: 'cors' }),
4042
)
4143
const collections = await fetchJSON<Array<NonFungibleCollectionResult<ChainId, SchemaType>>>(collectionsURL)
4244
return (await Promise.allSettled([collectionsFromSpecialList, collections])).flatMap((v) =>

packages/web3-providers/src/NFTScan/tests/solana.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest'
2-
import { NFTScanNonFungibleTokenAPI_Solana } from '../index.js'
2+
import { NFTScanNonFungibleTokenAPI_Solana } from '../apis/NonFungibleTokenAPI_Solana.js'
33

44
describe('NFTScan Solana', () => {
55
const provider = new NFTScanNonFungibleTokenAPI_Solana()

packages/web3-providers/src/RSS3/apis/RSS3API.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ export class RSS3API implements RSS3BaseAPI.Provider {
7676
const { result, cursor } = await fetchJSON<RSS3Result<RSS3BaseAPI.Footprint>>(collectionURL)
7777
return createPageable(result, createIndicator(indicator), createNextIndicator(indicator, cursor))
7878
}
79-
async getNameInfo(id: string) {
80-
if (!id) return
81-
const url = urlcat('https://rss3.domains/name/:id', { id })
79+
/** get .csb handle info */
80+
async getNameInfo(handle: string) {
81+
if (!handle) return
82+
const url = urlcat('https://pregod.rss3.dev/v1/ns/:id', { id: handle })
8283
return fetchJSON<RSS3BaseAPI.NameInfo>(url)
8384
}
8485

0 commit comments

Comments
 (0)