diff --git a/packages/configuration/src/index.ts b/packages/configuration/src/index.ts index 3b7ff75c8a2f..69c3e9e18294 100644 --- a/packages/configuration/src/index.ts +++ b/packages/configuration/src/index.ts @@ -26,10 +26,10 @@ class Configuration { const cache = new Map>() -export function create(name: string, initialData?: T) { - const url = urlcat(`${DEFAULT_HOST}', ':prefix.:name.json`, { +export function create(name: string, prefix?: string, initialData?: T) { + const url = urlcat(DEFAULT_HOST, prefix ? ':prefix.:name.json' : ':name.json', { name, - prefix: DEFAULT_PREFIX, + prefix: prefix ?? DEFAULT_PREFIX, }) if (!cache.has(url)) cache.set(url, new Configuration(url, initialData)) return cache.get(url) as Configuration diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx index b557f5a5e5f9..6bbb9a97454b 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx @@ -38,6 +38,10 @@ const useStyles = makeStyles()((theme) => ({ width: 36, height: 36, }, + iframe: { + minWidth: 300, + minHeight: 300, + }, })) export interface ArticleTabProps {} diff --git a/packages/plugin-infra/src/types.ts b/packages/plugin-infra/src/types.ts index 33f24ece0eec..e0843945d151 100644 --- a/packages/plugin-infra/src/types.ts +++ b/packages/plugin-infra/src/types.ts @@ -412,7 +412,7 @@ export namespace Plugin.SNSAdaptor { /** * If it returns false, this tab will not be displayed. */ - shouldDisplay?: (identity?: ProfileIdentity, addressNames?: ProfileAddress[]) => boolean + shouldDisplay?(identity?: ProfileIdentity, addressNames?: ProfileAddress[]): boolean /** * Sort address name in expected order. diff --git a/packages/plugins/DAO/package.json b/packages/plugins/DAO/package.json index 0739ec2ae698..df9ab11a71ec 100644 --- a/packages/plugins/DAO/package.json +++ b/packages/plugins/DAO/package.json @@ -8,6 +8,7 @@ "@masknet/plugin-infra": "workspace:*", "@masknet/shared": "workspace:*", "@masknet/shared-base": "workspace:*", + "@masknet/configuration": "workspace:*", "bignumber.js": "^9.0.2", "date-fns": "^2.28.0", "iframe-resizer-react": "^1.1.0", diff --git a/packages/plugins/DAO/src/SNSAdaptor/index.tsx b/packages/plugins/DAO/src/SNSAdaptor/index.tsx index 43e2c41c27c6..bdf0114e3dac 100644 --- a/packages/plugins/DAO/src/SNSAdaptor/index.tsx +++ b/packages/plugins/DAO/src/SNSAdaptor/index.tsx @@ -1,7 +1,25 @@ import type { Plugin } from '@masknet/plugin-infra' import { base } from '../base' -import { PLUGIN_ID, SUPPORTED_TWITTER_IDS } from '../constants' +import { PLUGIN_ID } from '../constants' import { DAOPage } from '../components/DAOPage' +import { create } from '@masknet/configuration' + +// cspell:disable +const DEFAULT_SUPPORTED_TWITTER_IDS = [ + 'ConstitutionDAO', + 'juiceboxETH', + 'AssangeDAO', + 'OfficialMoonDAO', + 'TheSpiceDAO', + 'sharkdao', + 'CrayonFinance', + 'merge_dao', + 'DAOTaiFung', + 'Tile_DAO', + 'mountaindao', + 'OfficialMoonDAO', +] +// cspell:enable const sns: Plugin.SNSAdaptor.Definition = { ...base, @@ -17,10 +35,18 @@ const sns: Plugin.SNSAdaptor.Definition = { }, }, Utils: { - shouldDisplay: (identity) => { + shouldDisplay: (identity, _addressNames) => { + const daoTabTwitterIdList = create( + 'twitter-supported-id-list', + '', + DEFAULT_SUPPORTED_TWITTER_IDS, + ).get() + return ( !identity?.identifier.isUnknown && - SUPPORTED_TWITTER_IDS.some((x) => x.toLowerCase() === identity?.identifier.userId.toLowerCase()) + (daoTabTwitterIdList ?? []).some( + (x) => x.toLowerCase() === identity?.identifier.userId.toLowerCase(), + ) ) }, }, diff --git a/packages/plugins/DAO/src/constants.ts b/packages/plugins/DAO/src/constants.ts index daef3fa7b801..b83ee33aa073 100644 --- a/packages/plugins/DAO/src/constants.ts +++ b/packages/plugins/DAO/src/constants.ts @@ -4,20 +4,3 @@ export const PLUGIN_ID = PluginId.DAO export const PLUGIN_META_KEY = `${PluginId.DAO}:1` export const PLUGIN_DESCRIPTION = 'The Web3 DAO based on JuiceBox.' export const PLUGIN_NAME = 'DAO' - -// cspell:disable -export const SUPPORTED_TWITTER_IDS = [ - 'ConstitutionDAO', - 'juiceboxETH', - 'AssangeDAO', - 'OfficialMoonDAO', - 'TheSpiceDAO', - 'sharkdao', - 'CrayonFinance', - 'merge_dao', - 'DAOTaiFung', - 'Tile_DAO', - 'mountaindao', - 'OfficialMoonDAO', -] -// cspell:enable diff --git a/packages/plugins/DAO/tsconfig.json b/packages/plugins/DAO/tsconfig.json index 1b3fd3a09a2e..035bf8c892ae 100644 --- a/packages/plugins/DAO/tsconfig.json +++ b/packages/plugins/DAO/tsconfig.json @@ -13,6 +13,7 @@ { "path": "../../shared" }, { "path": "../../shared-base" }, { "path": "../../theme" }, - { "path": "../../web3-providers" } + { "path": "../../web3-providers" }, + { "path": "../../configuration" } ] } diff --git a/packages/shared/src/UI/components/AssetPlayer/index.tsx b/packages/shared/src/UI/components/AssetPlayer/index.tsx index 840d114df82f..08ce050d74b1 100644 --- a/packages/shared/src/UI/components/AssetPlayer/index.tsx +++ b/packages/shared/src/UI/components/AssetPlayer/index.tsx @@ -146,6 +146,12 @@ export const AssetPlayer = memo((props) => { } }, [playerState, ref.current]) + useEffect(() => { + if (playerState === AssetPlayerState.NORMAL) { + ref.current?.iFrameResizer.sendMessage({ loaded: true }) + } + }, [playerState, ref.current]) + const IframeResizerMemo = useMemo( () => hidden ? null : ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5036f662449b..d67aaf5c1783 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -636,6 +636,7 @@ importers: packages/plugins/DAO: specifiers: + '@masknet/configuration': workspace:* '@masknet/icons': workspace:* '@masknet/plugin-infra': workspace:* '@masknet/shared': workspace:* @@ -646,6 +647,7 @@ importers: react-use: ^17.3.2 urlcat: ^2.0.4 dependencies: + '@masknet/configuration': link:../../configuration '@masknet/icons': link:../../icons '@masknet/plugin-infra': link:../../plugin-infra '@masknet/shared': link:../../shared @@ -10070,7 +10072,7 @@ packages: resolution: {integrity: sha512-oagLNqpfNv7CvmyMoexMDNyVDSiq1rya0AEUgcLlNHdHgNl6U/hi8xY370n5y+ZIFEXOx0J4B1qF2NDjMRxklA==} engines: {node: '>=6.0.0'} dependencies: - pvutils: 1.0.17 + pvutils: 1.1.2 dev: false /assert-plus/1.0.0: @@ -21155,8 +21157,8 @@ packages: tslib: 2.3.1 dev: false - /pvutils/1.0.17: - resolution: {integrity: sha512-wLHYUQxWaXVQvKnwIDWFVKDJku9XDCvyhhxoq8dc5MFdIlRenyPI9eSfEtcvgHgD7FlvCyGAlWgOzRnZD99GZQ==} + /pvutils/1.1.2: + resolution: {integrity: sha512-wlo0BUInyP+ZgBJHV8PnJW8S2HubdQfMMip8B9yXr9aFlauJFuF1jZ/RWFmzGYitC7GxkxqXdwbY9/R97v+Cqg==} engines: {node: '>=6.0.0'} dev: false