Skip to content

Commit 35db632

Browse files
guanbinruiUncleBillnuanyang233
authored
[Release] Hotfix 2.24.4 => 2.24.5 (patch) (#11401)
* chore: bump version to 2.24.5 * fix: mf-6034 return to original way of sending tweet (#11402) * fix: mf-6034 return to original way of sending tweet * refactor: comment --------- Co-authored-by: guanbinrui <[email protected]> * fix: sort redpacket history via rpc (#11405) * fix: init plugin hub ref in popup page (#11413) --------- Co-authored-by: UncleBill <[email protected]> Co-authored-by: nuanyang233 <[email protected]>
1 parent 3d13e9f commit 35db632

File tree

12 files changed

+42
-54
lines changed

12 files changed

+42
-54
lines changed

Diff for: 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.24.4",
11+
"version": "2.24.5",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {

Diff for: packages/mask/content-script/components/CompositionDialog/useSubmit.ts

+13-36
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Services from '#services'
22
import { encodeByNetwork } from '@masknet/encryption'
3-
import { PluginID, PostIdentifier, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base'
3+
import { PluginID, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base'
44
import type { Meta } from '@masknet/typed-message'
55
import { Telemetry } from '@masknet/web3-telemetry'
66
import { EventID, EventType } from '@masknet/web3-telemetry/types'
@@ -51,42 +51,19 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
5151
await SteganographyPayload(typeof rawEncrypted === 'string' ? encrypted : rawEncrypted)
5252
: undefined
5353

54-
if (activatedSiteAdaptorUI?.automation.endpoint?.publishPost && reason === 'timeline') {
55-
const postId = await activatedSiteAdaptorUI.automation.endpoint.publishPost(
56-
mediaObject ? [decoratedText || defaultText, mediaObject] : [decoratedText || defaultText],
57-
{
58-
reason,
59-
},
60-
)
61-
const postIdentifier =
62-
lastRecognizedIdentity.identifier && postId ?
63-
new PostIdentifier(lastRecognizedIdentity.identifier, postId)
64-
: undefined
65-
66-
if (postIdentifier) {
67-
const postUrl = activatedSiteAdaptorUI.utils.getPostURL?.(postIdentifier)
68-
if (postUrl) location.assign(postUrl)
69-
} else if (postId) {
70-
location.reload()
71-
}
54+
if (encode === 'image') {
55+
if (!mediaObject) throw new Error('Failed to create image payload.')
56+
// Don't await this, otherwise the dialog won't disappear
57+
activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachImage?.(mediaObject, {
58+
recover: true,
59+
relatedTextPayload: decoratedText || defaultText,
60+
reason,
61+
})
7262
} else {
73-
if (encode === 'image') {
74-
if (!mediaObject) throw new Error('Failed to create image payload.')
75-
// Don't await this, otherwise the dialog won't disappear
76-
activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachImage?.(mediaObject, {
77-
recover: true,
78-
relatedTextPayload: decoratedText || defaultText,
79-
reason,
80-
})
81-
} else {
82-
activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachText?.(
83-
decoratedText || defaultText,
84-
{
85-
recover: true,
86-
reason,
87-
},
88-
)
89-
}
63+
activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachText?.(decoratedText || defaultText, {
64+
recover: true,
65+
reason,
66+
})
9067
}
9168

9269
if (content.meta?.has(`${PluginID.RedPacket}:1`) || content.meta?.has(`${PluginID.RedPacket}_nft:1`))

Diff for: packages/mask/content-script/site-adaptors/twitter.com/collecting/getSearchedKeyword.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* Otherwise, if a pathname not in this list the keyword will be cleaned and remove relative components from DOM.
55
*/
66
const SAFE_PATHNAMES_ON_TWITTER = [
7+
// redirect to /compose/post
78
'/compose/tweet',
9+
'/compose/post',
810
'/search-advanced',
911
'/settings/trends',
1012
'/settings/search',

Diff for: packages/mask/content-script/site-adaptors/twitter.com/injection/Banner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function injectBannerAtTwitter(signal: AbortSignal) {
1313
})
1414
injectBanner(
1515
postEditorInPopupSelector().map((x) => (isCompose() && hasEditor() ? x : emptyNode)),
16-
{ signal, missingReportRule: { name: 'Setup prompt', rule: 'https://twitter.com/compose/tweet' } },
16+
{ signal, missingReportRule: { name: 'Setup prompt', rule: 'https://twitter.com/compose/post' } },
1717
)
1818
}
1919

Diff for: packages/mask/content-script/site-adaptors/twitter.com/injection/PostDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function renderPostDialogTo<T>(reason: 'timeline' | 'popup', ls: LiveSelector<T,
1616
export function injectPostDialogAtTwitter(signal: AbortSignal) {
1717
renderPostDialogTo('popup', postEditorContentInPopupSelector(), {
1818
signal,
19-
missingReportRule: { name: 'PostDialog popup', rule: 'https://twitter.com/compose/tweet' },
19+
missingReportRule: { name: 'PostDialog popup', rule: 'https://twitter.com/compose/post' },
2020
})
2121
renderPostDialogTo('timeline', rootSelector(), {
2222
signal,

Diff for: packages/mask/content-script/site-adaptors/twitter.com/injection/PostDialogHint.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function injectPostDialogHintAtTwitter(signal: AbortSignal) {
4343
signal,
4444
missingReportRule: {
4545
name: 'PostDialog hint popup',
46-
rule: 'https://twitter.com/compose/tweet',
46+
rule: 'https://twitter.com/compose/post',
4747
},
4848
},
4949
)

Diff for: packages/mask/content-script/site-adaptors/twitter.com/utils/postBox.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function getEditorContent() {
99
}
1010

1111
export function isCompose() {
12-
return globalThis.location.pathname === '/compose/tweet'
12+
return globalThis.location.pathname === '/compose/post'
1313
}
1414

1515
export function hasFocus(x: LiveSelector<HTMLElement, true>) {

Diff for: packages/mask/content-script/site-adaptors/twitter.com/utils/selector.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export function rootSelector() {
9292
export function composeAnchorSelector() {
9393
return querySelector<HTMLAnchorElement>(
9494
[
95-
'header[role=banner] a[href="/compose/tweet"]',
96-
'aside a[href="/compose/tweet"]',
95+
'header[role=banner] a[href="/compose/post"]',
96+
'aside a[href="/compose/post"]',
9797
// can't see the compose button on share popup, use the tweetButton instead
9898
'[role=main] [role=button][data-testid=tweetButton]',
9999
].join(','),
@@ -123,7 +123,7 @@ export function isReplyPageSelector() {
123123
return !!location.pathname.match(/^\/\w+\/status\/\d+$/)
124124
}
125125
export function postEditorDraftContentSelector() {
126-
if (location.pathname === '/compose/tweet') {
126+
if (location.pathname === '/compose/post') {
127127
return querySelector<HTMLDivElement>(
128128
'[contenteditable][aria-label][spellcheck],textarea[aria-label][spellcheck]',
129129
)

Diff for: packages/mask/popups/components/NetworkSelector/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { Box, MenuItem, Typography } from '@mui/material'
33
import { makeStyles } from '@masknet/theme'
44
import type { ChainId, NetworkType, SchemaType } from '@masknet/web3-shared-evm'
55
import { useChainContext, useNetworks, useWeb3State } from '@masknet/web3-hooks-base'
6-
import { ImageIcon, NetworkIcon, useMenuConfig } from '@masknet/shared'
6+
import { ImageIcon, NetworkIcon, TRADER_WEB3_CONFIG, useMenuConfig } from '@masknet/shared'
77
import { Icons } from '@masknet/icons'
88
import type { ReasonableNetwork } from '@masknet/web3-shared-base'
9-
import { NetworkPluginID, PluginID } from '@masknet/shared-base'
9+
import { NetworkPluginID } from '@masknet/shared-base'
1010
import { EVMWeb3 } from '@masknet/web3-providers'
11-
import { useActivatedPluginSiteAdaptor } from '@masknet/plugin-infra/content-script'
1211
import { first } from 'lodash-es'
1312

1413
const useStyles = makeStyles()((theme) => ({
@@ -42,8 +41,7 @@ export const NetworkSelector = memo(() => {
4241
const networks = useNetworks(NetworkPluginID.PLUGIN_EVM)
4342
const { Network } = useWeb3State(NetworkPluginID.PLUGIN_EVM)
4443

45-
const traderDefinition = useActivatedPluginSiteAdaptor.visibility.useAnyMode(PluginID.Trader)
46-
const chainIdList = traderDefinition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? []
44+
const chainIdList = TRADER_WEB3_CONFIG[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? []
4745

4846
const actualNetworks = useMemo(
4947
() => networks.filter((x) => chainIdList.includes(x.chainId)),

Diff for: packages/plugin-infra/src/manager/site-adaptor.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useMemo } from 'react'
22
import { isEqual } from 'lodash-es'
33
import { unreachable } from '@masknet/kit'
44
import { useValueRef } from '@masknet/shared-base-ui'
5-
import { type EnhanceableSite, ValueRefWithReady } from '@masknet/shared-base'
5+
import { type EnhanceableSite, ValueRefWithReady, Sniffings } from '@masknet/shared-base'
66
import { createManager } from './manage.js'
77
import { getPluginDefine } from './store.js'
88
import type { Plugin } from '../types.js'
@@ -17,6 +17,16 @@ events.on('activateChanged', () => (activatedSub.value = [...activated.plugins])
1717
const minimalModeSub = new ValueRefWithReady<string[]>([], isEqual)
1818
events.on('minimalModeChanged', () => (minimalModeSub.value = [...minimalMode]))
1919

20+
/**
21+
* On the popup page, the plugin is not loaded.
22+
* So in order for the valueRef not to remain pending,
23+
* manually assigning the value solves this problem
24+
*/
25+
if (Sniffings.is_popup_page) {
26+
activatedSub.value = []
27+
minimalModeSub.value = []
28+
}
29+
2030
export function useActivatedPluginsSiteAdaptor(minimalModeEqualsTo: 'any' | boolean) {
2131
const minimalMode = useValueRef(minimalModeSub)
2232
const result = useValueRef(activatedSub)

Diff for: packages/web3-providers/src/RedPacket/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import urlcat from 'urlcat'
2-
import { mapKeys } from 'lodash-es'
2+
import { mapKeys, sortBy } from 'lodash-es'
33
import type { AbiItem } from 'web3-utils'
44
import { createIndicator, createPageable, type PageIndicator, type Pageable } from '@masknet/shared-base'
55
import { type Transaction, attemptUntil, type NonFungibleCollection } from '@masknet/web3-shared-base'
@@ -46,16 +46,17 @@ class RedPacketAPI implements RedPacketBaseAPI.Provider<ChainId, SchemaType> {
4646
)
4747
return this.parseRedPacketCreationTransactions(transactions, senderAddress)
4848
},
49-
() => {
49+
async () => {
5050
// block range might be too large
51-
return ContractRedPacket.getHistories(
51+
const results = await ContractRedPacket.getHistories(
5252
chainId,
5353
senderAddress,
5454
contractAddress,
5555
methodId,
5656
fromBlock,
5757
endBlock,
5858
)
59+
return sortBy(results, (x) => -x.block_number!)
5960
},
6061
],
6162
[],

Diff for: packages/web3-providers/src/Twitter/apis/getUserSettings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function getComputedUserSettings(): TwitterBaseAPI.UserSettings {
5656
}
5757

5858
const getThemeColor = () => {
59-
const tweetButton = document.querySelector('a[href="/compose/tweet"][data-testid="SideNav_NewTweet_Button"]')
59+
const tweetButton = document.querySelector('a[href="/compose/post"][data-testid="SideNav_NewTweet_Button"]')
6060
if (!tweetButton) return
6161

6262
const { backgroundColor } = getComputedStyle(tweetButton)

0 commit comments

Comments
 (0)