Skip to content

Commit 7d3b802

Browse files
[Release] Hotfix 2.24.2 => 2.24.3 (patch) (#11356)
* chore: bump version to 2.24.3 * refactor: sns utils (#11345) * refactor: renaming (#11348) * fix: after posting * chore: enable okx * feat: mf-6036 add farcaster widget (#11369) * fix(Farcaster): combine accounts (#11375) * fix: mf-6040 align link icon * fix: mf-6039 farcaster avatar * fix: combine accounts * fix: add background for okx wallet in connect modal (#11381) * fix: add background for okx wallet in connect modal * fixup! fix: add background for okx wallet in connect modal * fix: okx auto switch chain * chore: explicitly setting composers to enable typing guarding (#11386) --------- Co-authored-by: UncleBill <[email protected]>
1 parent 3331d63 commit 7d3b802

File tree

55 files changed

+1265
-84
lines changed

Some content is hidden

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

55 files changed

+1265
-84
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.2",
11+
"version": "2.24.3",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {

Diff for: packages/app/src/initialization/plugin-host/enable.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ __setSiteAdaptorContext__({
4747
currentNextIDPlatform: undefined,
4848
currentPersonaIdentifier: UNDEFINED,
4949
getPostURL: () => null,
50+
getProfileURL: () => null,
5051
share: undefined,
5152
connectPersona: reject,
5253
getPostIdFromNewPostToast: undefined,

Diff for: packages/icons/brands/DarkLens.svg

+12
Loading

Diff for: packages/icons/icon-generated-as-jsx.js

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ export const DangerOutline = /*#__PURE__*/ __createIcon('DangerOutline', [
114114
s: true,
115115
},
116116
])
117+
export const DarkLens = /*#__PURE__*/ __createIcon('DarkLens', [
118+
{
119+
u: () => new URL('./brands/DarkLens.svg', import.meta.url).href,
120+
},
121+
])
117122
export const Debank = /*#__PURE__*/ __createIcon('Debank', [
118123
{
119124
u: () => new URL('./brands/Debank.svg', import.meta.url).href,

Diff for: packages/icons/icon-generated-as-url.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function cross_sync_url() { return new URL("./brands/CrossSync.svg", impo
1414
export function cyber_connect_url() { return new URL("./brands/CyberConnect.svg", import.meta.url).href }
1515
export function danger_url() { return new URL("./brands/Danger.svg", import.meta.url).href }
1616
export function danger_outline_url() { return new URL("./brands/DangerOutline.svg", import.meta.url).href }
17+
export function dark_lens_url() { return new URL("./brands/DarkLens.svg", import.meta.url).href }
1718
export function debank_url() { return new URL("./brands/Debank.svg", import.meta.url).href }
1819
export function discord_url() { return new URL("./brands/Discord.svg", import.meta.url).href }
1920
export function discord_round_url() { return new URL("./brands/DiscordRound.svg", import.meta.url).href }

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

+12-2
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, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base'
3+
import { PluginID, PostIdentifier, 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'
@@ -58,7 +58,17 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
5858
reason,
5959
},
6060
)
61-
if (postId) location.reload()
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+
}
6272
} else {
6373
if (encode === 'image') {
6474
if (!mediaObject) throw new Error('Failed to create image payload.')

Diff for: packages/mask/content-script/site-adaptor-infra/ui.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export async function activateSiteAdaptorUIInner(ui_deferred: SiteAdaptorUI.Defe
102102
ui.injection.profileAvatar?.(signal)
103103
ui.injection.tips?.(signal)
104104
ui.injection.nameWidget?.(signal)
105+
ui.injection.farcaster?.(signal)
105106
ui.injection.lens?.(signal)
106107

107108
ui.injection.enhancedProfileNFTAvatar?.(signal)
@@ -147,6 +148,7 @@ export async function activateSiteAdaptorUIInner(ui_deferred: SiteAdaptorUI.Defe
147148
currentNextIDPlatform: ui.configuration.nextIDConfig?.platform,
148149
currentPersonaIdentifier: createSubscriptionFromValueRef(currentPersonaIdentifier, signal),
149150
getPostURL: ui.utils.getPostURL || (() => null),
151+
getProfileURL: ui.utils.getProfileURL || (() => null),
150152
share: ui.utils.share,
151153
getPostIdFromNewPostToast: ui.configuration.nextIDConfig?.getPostIdFromNewPostToast,
152154
connectPersona,

Diff for: packages/mask/content-script/site-adaptors/facebook.com/shared.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1+
import urlcat from 'urlcat'
12
import type { SiteAdaptor } from '@masknet/types'
23
import { facebookBase } from './base.js'
34
import { getPostUrlAtFacebook, isValidFacebookUsername } from './utils/parse-username.js'
4-
import { type PostIdentifier } from '@masknet/shared-base'
5+
import { type ProfileIdentifier, type PostIdentifier } from '@masknet/shared-base'
56
import { hasPayloadLike } from '../../utils/index.js'
67
import { createSiteAdaptorSpecializedPostContext } from '../../site-adaptor-infra/utils/create-post-context.js'
78
import { openWindow } from '@masknet/shared-base-ui'
8-
import { FacebookAdaptor } from '../../../shared/site-adaptors/implementations/facebook.com.js'
99

1010
function getPostURL(post: PostIdentifier): URL | null {
1111
return new URL(getPostUrlAtFacebook(post))
1212
}
13+
function getProfileURL(profile: ProfileIdentifier): URL | null {
14+
return new URL('https://www.facebook.com')
15+
}
16+
function getShareURL(text: string): URL | null {
17+
return new URL(
18+
urlcat('https://www.facebook.com/sharer/sharer.php', {
19+
quote: text,
20+
u: 'mask.io',
21+
}),
22+
)
23+
}
1324
export const facebookShared: SiteAdaptor.Shared & SiteAdaptor.Base = {
1425
...facebookBase,
1526
utils: {
1627
isValidUsername: (v) => !!isValidFacebookUsername(v),
1728
getPostURL,
29+
getProfileURL,
1830
share(message) {
19-
openWindow(FacebookAdaptor.getShareLinkURL?.(message))
31+
openWindow(getShareURL?.(message))
2032
},
2133
createPostContext: createSiteAdaptorSpecializedPostContext(facebookBase.networkIdentifier, {
2234
hasPayloadLike,

Diff for: packages/mask/content-script/site-adaptors/facebook.com/ui-provider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ const facebookUI: SiteAdaptorUI.Definition = {
116116
...facebookShared,
117117
automation: {
118118
redirect: {
119-
profilePage(profile) {
119+
gotoProfilePage(profile) {
120120
// there is no PWA way on Facebook desktop.
121121
// mobile not tested
122122
location.assign(getProfilePageUrlAtFacebook(profile))
123123
},
124-
newsFeed() {
124+
gotoNewsFeed() {
125125
const homeLink = document.querySelector<HTMLAnchorElement>(
126126
[
127127
'[data-click="bluebar_logo"] a[href]',

Diff for: packages/mask/content-script/site-adaptors/instagram.com/shared.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ import { createSiteAdaptorSpecializedPostContext } from '../../site-adaptor-infr
33
import { hasPayloadLike } from '../../utils/index.js'
44
import { instagramBase } from './base.js'
55

6+
function getProfileURL(): URL | null {
7+
return new URL('https://www.instagram.com/')
8+
}
9+
610
export const instagramShared: SiteAdaptor.Shared & SiteAdaptor.Base = {
711
...instagramBase,
812
utils: {
13+
getProfileURL,
914
createPostContext: createSiteAdaptorSpecializedPostContext(instagramBase.networkIdentifier, {
1015
hasPayloadLike,
1116
}),

Diff for: packages/mask/content-script/site-adaptors/minds.com/shared.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
1-
import { type PostIdentifier } from '@masknet/shared-base'
1+
import urlcat from 'urlcat'
2+
import { type ProfileIdentifier, type PostIdentifier } from '@masknet/shared-base'
23
import { openWindow } from '@masknet/shared-base-ui'
34
import type { SiteAdaptor } from '@masknet/types'
45
import { createSiteAdaptorSpecializedPostContext } from '../../site-adaptor-infra/utils/create-post-context.js'
56
import { hasPayloadLike } from '../../utils/index.js'
67
import { mindsBase } from './base.js'
78
import { usernameValidator } from './utils/user.js'
8-
import { MindsAdaptor } from '../../../shared/site-adaptors/implementations/minds.com.js'
99

1010
function getPostURL(post: PostIdentifier): URL {
1111
return new URL(`https://minds.com/newsfeed/${post.postId}`)
1212
}
13+
14+
function getProfileURL(profile: ProfileIdentifier): URL | null {
15+
return new URL('https://www.minds.com')
16+
}
17+
18+
function getShareURL(text: string): URL | null {
19+
return new URL(
20+
urlcat('https://www.minds.com/newsfeed/subscriptions', {
21+
intentUrl: text,
22+
}),
23+
)
24+
}
25+
1326
export const mindsShared: SiteAdaptor.Shared & SiteAdaptor.Base = {
1427
...mindsBase,
1528
utils: {
1629
isValidUsername: usernameValidator,
1730
getPostURL,
31+
getProfileURL,
1832
share(message) {
19-
openWindow(MindsAdaptor.getShareLinkURL?.(message))
33+
openWindow(getShareURL(message))
2034
},
2135
createPostContext: createSiteAdaptorSpecializedPostContext(mindsBase.networkIdentifier, {
2236
hasPayloadLike,

Diff for: packages/mask/content-script/site-adaptors/minds.com/ui-provider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ const mindsUI: SiteAdaptorUI.Definition = {
132132
attachImage: pasteImageToCompositionMinds(),
133133
},
134134
redirect: {
135-
newsFeed: gotoNewsFeedPageMinds,
136-
profilePage: gotoProfilePageMinds,
135+
gotoNewsFeed: gotoNewsFeedPageMinds,
136+
gotoProfilePage: gotoProfilePageMinds,
137137
},
138138
},
139139
collecting: {

Diff for: packages/mask/content-script/site-adaptors/mirror.xyz/shared.ts

+9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ import { hasPayloadLike } from '../../utils/index.js'
44
import { mirrorBase } from './base.js'
55
import { getUserIdentity } from './utils/user.js'
66

7+
function getProfileURL() {
8+
return new URL('https://mirror.xyz/dashboard')
9+
}
10+
function getShareURL(text: string) {
11+
return new URL('https://mirror.xyz')
12+
}
13+
714
export const mirrorShared: SiteAdaptor.Shared & SiteAdaptor.Base = {
815
...mirrorBase,
916
utils: {
17+
getProfileURL,
18+
getShareURL,
1019
createPostContext: createSiteAdaptorSpecializedPostContext(mirrorBase.networkIdentifier, {
1120
hasPayloadLike,
1221
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { injectFarcasterOnConversation } from './injectFarcasterOnConversation.js'
2+
import { injectFarcasterOnPost } from './injectFarcasterOnPost.js'
3+
import { injectFarcasterOnProfile } from './injectFarcasterOnProfile.js'
4+
import { injectFarcasterOnSpaceDock } from './injectFarcasterOnSpaceDock.js'
5+
import { injectFarcasterOnUserCell } from './injectFarcasterOnUserCell.js'
6+
7+
export function injectFarcaster(signal: AbortSignal) {
8+
injectFarcasterOnProfile(signal)
9+
injectFarcasterOnPost(signal)
10+
injectFarcasterOnUserCell(signal)
11+
injectFarcasterOnConversation(signal)
12+
injectFarcasterOnSpaceDock(signal)
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { memo, useMemo, useState } from 'react'
2+
import { MutationObserverWatcher } from '@dimensiondev/holoflows-kit'
3+
import { createInjectHooksRenderer, Plugin, useActivatedPluginsSiteAdaptor } from '@masknet/plugin-infra/content-script'
4+
import { EnhanceableSite, ProfileIdentifier } from '@masknet/shared-base'
5+
import { makeStyles } from '@masknet/theme'
6+
import { attachReactTreeWithContainer } from '../../../../utils/shadow-root/renderInShadowRoot.js'
7+
import { querySelectorAll } from '../../utils/selector.js'
8+
import { startWatch } from '../../../../utils/startWatch.js'
9+
10+
function selector() {
11+
return querySelectorAll<HTMLElement>('[data-testid=conversation] div:not([tabindex]) div[dir] + div[dir]')
12+
}
13+
14+
const useStyles = makeStyles()((theme) => ({
15+
hide: {
16+
display: 'none',
17+
},
18+
slot: {
19+
position: 'relative',
20+
display: 'flex',
21+
justifyContent: 'center',
22+
alignItems: 'center',
23+
borderRadius: 999,
24+
marginLeft: theme.spacing(0.5),
25+
verticalAlign: 'top',
26+
},
27+
}))
28+
29+
interface Props {
30+
userId: string
31+
}
32+
33+
function createRootElement() {
34+
const span = document.createElement('span')
35+
Object.assign(span.style, {
36+
verticalAlign: 'bottom',
37+
height: '21px',
38+
alignItems: 'center',
39+
justifyContent: 'center',
40+
display: 'inline-flex',
41+
} as CSSStyleDeclaration)
42+
return span
43+
}
44+
45+
const ConversationFarcasterSlot = memo(function ConversationFarcasterSlot({ userId }: Props) {
46+
const [disabled, setDisabled] = useState(true)
47+
const { classes, cx } = useStyles()
48+
49+
const component = useMemo(() => {
50+
const Component = createInjectHooksRenderer(
51+
useActivatedPluginsSiteAdaptor.visibility.useNotMinimalMode,
52+
(plugin) => plugin.Farcaster?.UI?.Content,
53+
undefined,
54+
createRootElement,
55+
)
56+
const identifier = ProfileIdentifier.of(EnhanceableSite.Twitter, userId).unwrapOr(null)
57+
if (!identifier) return null
58+
59+
return (
60+
<Component
61+
identity={identifier}
62+
slot={Plugin.SiteAdaptor.FarcasterSlot.Sidebar}
63+
onStatusUpdate={setDisabled}
64+
/>
65+
)
66+
}, [userId])
67+
68+
if (!component) return null
69+
70+
return <span className={cx(classes.slot, disabled ? classes.hide : null)}>{component}</span>
71+
})
72+
73+
/**
74+
* Inject on conversation, including both DM drawer and message page (/messages/xxx)
75+
*/
76+
export function injectFarcasterOnConversation(signal: AbortSignal) {
77+
const watcher = new MutationObserverWatcher(selector())
78+
startWatch(watcher, signal)
79+
watcher.useForeach((node, _, proxy) => {
80+
const spans = node
81+
.closest('[data-testid=conversation]')
82+
?.querySelectorAll<HTMLElement>('[tabindex] [dir] span:not([data-testid=tweetText])')
83+
if (!spans) return
84+
const userId = [...spans].reduce((id, node) => {
85+
if (id) return id
86+
if (node.textContent?.match(/@\w/)) {
87+
return node.textContent.trim().slice(1)
88+
}
89+
return ''
90+
}, '')
91+
if (!userId) return
92+
attachReactTreeWithContainer(proxy.afterShadow, { signal, untilVisible: true }).render(
93+
<ConversationFarcasterSlot userId={userId} />,
94+
)
95+
})
96+
}

0 commit comments

Comments
 (0)