Skip to content

Commit

Permalink
[Release] Hotfix 2.31.1 => 2.31.2 (patch) (#12091)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui authored Feb 5, 2025
1 parent deff5a6 commit c4b250e
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 53 deletions.
1 change: 1 addition & 0 deletions packages/injected-script/shared/twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export const TWITTER_RESERVED_SLUGS: readonly string[] = [
'404',
'account',
'jobs',
'download',
'explore',
'follower_requests',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function ProfileTab(props: ProfileTabProps) {
}, [])

return (
<div key="nfts" className={classes.root}>
<div key="web3" className={classes.root}>
<Typography
className={classes.button + ' ' + (active ? classes.selected : '')}
onClick={onClick}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Services from '#services'
import { MutationObserverWatcher } from '@dimensiondev/holoflows-kit'
import { TWITTER_RESERVED_SLUGS } from '@masknet/injected-script/shared'
import { useCollectionByTwitterHandle } from '@masknet/shared'
import { BooleanPreference, MaskMessages, PluginID, ProfileTabs } from '@masknet/shared-base'
import { makeStyles } from '@masknet/theme'
Expand Down Expand Up @@ -397,6 +398,9 @@ function InjectProfileTab() {
return () => ac.abort()
}, [windowSize, tabList, web3TabRef, nextArrow])

const [, slug, category] = location.pathname.split('/')
if (slug && (TWITTER_RESERVED_SLUGS.includes(slug) || category === 'communities')) return null

return (
<div ref={setWeb3TabRef} className={classes.bar}>
<ProfileTabForTokenAndPersona />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export function Terms() {
<Trans>
Web3 File Service is a decentralized storage service provided by Mask Network. It allows users
to store files in different decentralized networks. This feature is powered by Mask Network's
partner file storage protocols such as IPFS, Arweave and Meson Network. It supports files in
PDF, DOC, JPG, PNG, MP3, MP4 and other formats. At present, the maximum file size is 10 MB.
partner file storage protocols such as IPFS and Arweave. It supports files in PDF, DOC, JPG,
PNG, MP3, MP4 and other formats. At present, the maximum file size is 10 MB.
<br />
<br />
You can store files in multiple decentralized networks through the Web3 file service. When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const useStyles = makeStyles()((theme) => ({
export function UploadFile() {
const { classes, theme } = useStyles()
const [encrypted, setEncrypted] = useState(true)
const [useCDN, setUseCDN] = useState(false)
const [provider, setProvider] = useState<Provider>(Provider.Arweave)
const { recentFiles, uploadingFiles, uploadFile, attachToPost } = useFileManagement()

Expand All @@ -97,29 +96,11 @@ export function UploadFile() {

const onSelectFile = useCallback(
async (file: File) => {
await uploadFile(file, provider, useCDN, encrypted)
await uploadFile(file, provider, encrypted)
},
[encrypted, useCDN, provider],
[encrypted, provider],
)

const cdnButton =
provider === Provider.Arweave ?
<FormControlLabel
control={
<Checkbox
classes={{ root: classes.control, checked: classes.checked }}
color="primary"
checked={useCDN}
icon={<Icons.CheckboxBlank size={18} />}
checkedIcon={<Icons.Checkbox color={theme.palette.maskColor.primary} size={18} />}
onChange={(event) => setUseCDN(event.target.checked)}
/>
}
className={classes.label}
label={<Trans>Use Meson CDN</Trans>}
/>
: null

return (
<section className={classes.container}>
<UploadDropArea className={classes.uploadArea} maxFileSize={MAX_FILE_SIZE} onSelectFile={onSelectFile} />
Expand Down Expand Up @@ -158,7 +139,6 @@ export function UploadFile() {
className={classes.label}
label={<Trans>Make It Encrypted</Trans>}
/>
{cdnButton}
</section>
<Typography className={classes.heading}>
<Trans>Uploaded files</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface FileManagementContextOptions {
uploadStateMap: UploadStateMap
setUploadProgress: (id: string, progress: number) => void
setUploadingFiles: Dispatch<SetStateAction<FileInfo[]>>
uploadFile: (file: File, provider: Provider, useCDN: boolean, encrypted: boolean) => Promise<FileInfo>
uploadFile: (file: File, provider: Provider, encrypted: boolean) => Promise<FileInfo>
attachToPost: (info: FileInfo | FileInfo[]) => void
}

Expand Down Expand Up @@ -84,10 +84,10 @@ export const FileManagementProvider = memo(({ children, compositionType }: Props
}, [])

const uploadFile = useCallback(
async (file: File, provider: Provider, useCDN: boolean, encrypted: boolean) => {
async (file: File, provider: Provider, encrypted: boolean) => {
const key = encrypted ? makeFileKey() : undefined
const buffer = new Uint8Array(await file.arrayBuffer())
const id = await digest(file, [provider, useCDN, encrypted])
const id = await digest(file, [provider, encrypted])
const createdAt = Date.now()

const removeUnloadingFile = (id: string) => {
Expand Down Expand Up @@ -126,7 +126,6 @@ export const FileManagementProvider = memo(({ children, compositionType }: Props
txId: payloadTxID,
type: file.type,
key,
useCDN,
})

const fileInfo: FileInfo = {
Expand Down
7 changes: 2 additions & 5 deletions packages/plugins/FileService/src/Worker/arweave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { encodeText } from '@masknet/kit'
import type Transaction from 'arweave/web/lib/transaction.js'
import type { JWKInterface } from 'arweave/web/lib/wallet.js'
import { fetchText } from '@masknet/web3-providers/helpers'
import { LANDING_PAGE, MESON_PREFIX, Provider } from '../constants.js'
import { LANDING_PAGE, Provider } from '../constants.js'
import { sign } from './remote-signing.js'
import TOKEN from './arweave-token.json' with { type: 'json' }
import type { ProviderAgent, LandingPageMetadata, AttachmentOptions } from '../types.js'
Expand Down Expand Up @@ -41,10 +41,7 @@ class ArweaveAgent implements ProviderAgent {

async uploadLandingPage(metadata: LandingPageMetadata) {
this.init()
let linkPrefix = 'https://arweave.net'
if (metadata.useCDN) {
linkPrefix = MESON_PREFIX
}
const linkPrefix = 'https://arweave.net'
const encodedMetadata = JSON.stringify({
name: metadata.name,
size: metadata.size,
Expand Down
1 change: 0 additions & 1 deletion packages/plugins/FileService/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const MAX_FILE_SIZE = 10 * 1000 * 1000
export const LANDING_PAGE = 'https://files.r2d2.to/partner/arweave/landing-page.html'
export const RECOVERY_PAGE = 'https://fileservice.r2d2.to/recover'
export const ARWEAVE_SIGNING = 'https://service.r2d2.to/arweave-remote-signing'
export const MESON_PREFIX = 'https://pz-yyxfhb.meson.network'

export const enum RoutePaths {
Browser = '/browser',
Expand Down
3 changes: 3 additions & 0 deletions packages/plugins/FileService/src/locale/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions packages/plugins/FileService/src/locale/en-US.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/plugins/FileService/src/locale/ja-JP.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c4b250e

Please sign in to comment.