Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.33.1",
"version": "2.33.2",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface ConnectedAccountsProps {
localProfile?: ProfileIdentifier
}

export const ConnectedAccounts = memo<ConnectedAccountsProps>(function ({
export const ConnectedAccounts = memo<ConnectedAccountsProps>(function ConnectedAccounts({
avatar,
nextId,
profiles,
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/popups/pages/Friends/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const PlatformUrlMap: Record<SupportedPlatforms, string> = {
[NextIDPlatform.Unstoppable]: 'https://ud.me/',
[NextIDPlatform.GitHub]: 'https://github.com/',
[NextIDPlatform.SpaceId]: 'https://bscscan.com/address/',
[NextIDPlatform.Farcaster]: 'https://firefly.mask.social/profile/farcaster/',
[NextIDPlatform.LENS]: 'https://firefly.mask.social/profile/lens/',
[NextIDPlatform.Farcaster]: 'https://firefly.social/profile/farcaster/',
[NextIDPlatform.LENS]: 'https://firefly.social/profile/lens/',
[NextIDPlatform.Ethereum]: 'https://etherscan.io/address/',
[NextIDPlatform.Keybase]: 'https://keybase.io/',
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
import { EthereumBlockie, Image } from '@masknet/shared'
import { EthereumBlockie } from '@masknet/shared'
import { makeStyles } from '@masknet/theme'
import { RSS3 } from '@masknet/web3-providers'
import { resolveIPFS_URL } from '@masknet/web3-shared-base'
import { isValidAddress } from '@masknet/web3-shared-evm'
import { useQuery } from '@tanstack/react-query'
import { memo, type HTMLProps } from 'react'

const useStyles = makeStyles<{ size: number }>()((theme, { size }) => ({
container: {
display: 'inline-block !important',
width: size,
height: size,
borderRadius: '50%',
overflow: 'hidden',
},
fallbackImage: {
width: size,
height: size,
},
blockie: {
width: size,
height: size,
Expand All @@ -32,33 +17,5 @@ interface Props extends HTMLProps<HTMLImageElement> {
}
export const UserAvatar = memo(function UserAvatar({ identity, size = 20, ...rest }: Props) {
const { classes } = useStyles({ size })
const { data: profile } = useQuery({
queryKey: ['rss3-profiles', identity],
queryFn: async () => {
if (!identity || isValidAddress(identity)) return null
const profiles = await RSS3.getProfiles(identity)
if (!profiles.length) return null
return profiles.find((x) => x.handle === identity)
},
})
const url = profile?.profile_uri?.[0]
if (!url) {
return (
<EthereumBlockie
address={identity || profile?.address || ''}
classes={{ icon: classes.blockie }}
style={rest.style}
/>
)
}
return (
<Image
classes={{ container: classes.container, fallbackImage: classes.fallbackImage }}
src={resolveIPFS_URL(url)}
width={size}
height={size}
{...rest}
containerProps={{ style: rest.style }}
/>
)
return <EthereumBlockie address={identity || ''} classes={{ icon: classes.blockie }} style={rest.style} />
})
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const RedPacket = memo(function RedPacket({ payload, currentPluginID }: R
{card}
<Link
className={classes.footer}
href={`https://firefly.mask.social/post/twitter/${postId}`}
href={`https://firefly.social/post/twitter/${postId}`}
target="_blank"
rel="noreferrer noopener">
<Icons.LinkOut size={18} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ interface FarcasterListItemProps {

const FarcasterListItem = memo<FarcasterListItemProps>(function FarcasterListItem({ account }) {
const { classes } = useStyles()
const profileUri = `https://firefly.mask.social/profile/farcaster/${account.fid}`
const profileUri = `https://firefly.social/profile/farcaster/${account.username}`
const farcasterIcon = <Icons.Farcaster size={30} />

return (
<ListItem className={classes.listItem} key={account.fid}>
<ListItem className={classes.listItem} key={account.username}>
<div className={classes.avatarContainer}>
{profileUri.length ?
<Image
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Web3Profile/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { FireflyConfigAPI, NextIDBaseAPI } from '@masknet/web3-providers/ty
import urlcat from 'urlcat'

export function getFireflyLensProfileLink(handle: string) {
return urlcat('https://firefly.mask.social/profile/lens/:handle', { handle })
return urlcat('https://firefly.social/profile/lens/:handle', { handle })
}

export const NextIdLensToFireflyLens = (account: NextIDBaseAPI.LensAccount): FireflyConfigAPI.LensAccount => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-base/src/Site/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export enum EnhanceableSite {
Instagram = 'instagram.com',
OpenSea = 'opensea.io',
Mirror = 'mirror.xyz',
Firefly = 'firefly.mask.social',
Firefly = 'firefly.social',
}

export enum ExtensionSite {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const FireflyLensToWeb3BioProfile = (account: FireflyConfigAPI.LensAccount): Web
const FireflyFarcasterToWeb3bioProfile = (account: FireflyConfigAPI.FarcasterProfile): Web3BioProfile => {
return {
platform: NextIDPlatform.Farcaster,
identity: account.fid.toString(),
identity: account.username,
address: account.signer_address,
displayName: account.display_name,
avatar: account.avatar.url,
Expand Down
72 changes: 0 additions & 72 deletions packages/vitest-setup/handlers/DSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,76 +135,4 @@ export const DSearchHandlers = [
{ status: 200 },
)
}),

http.get(`${rss3BaseURL}/datasets/domains/profiles`, () => {
return HttpResponse.json([
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'crossbell',
platform: 'Crossbell',
source: 'Crossbell',
name: 'Suji Yan',
handle: 'suji.csb',
bio: 'Founder Mask Network $Mask; maintain mstdn.jp mastodon.cloud ; Engineer; Journalist; 💪FOSS/Anti996; 中文/日本語 mask.io',
url: 'https://crossbell.io/@suji',
profile_uri: ['https://ipfs.io/ipfs/QmeYWaMUekPthkMnb5FMkiPLBTfu1PLkQFvZM3a7oftzNu/'],
},
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'farcaster',
platform: 'Farcaster',
source: 'Farcaster',
name: 'Suji Yan',
handle: 'suji',
bio: 'Mask.io / suji_yan.twitter',
url: 'https://www.discove.xyz/@suji',
},
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'ethereum',
platform: 'ENS Registrar',
source: 'ENS Registrar',
name: 'sujiyan',
handle: 'sujiyan.eth',
bio: '',
url: 'https://mask.io',
expire_at: '2027-01-30T04:49:54Z',
profile_uri: ['https://i.imgur.com/rkMlngS_d.webp?maxwidth=640&shape=thumb&fidelity=medium'],
},
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'crossbell',
platform: 'Crossbell',
source: 'Crossbell',
name: '',
handle: 'sujiyan.csb',
bio: '',
url: 'https://crossbell.io/@sujiyan',
},
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'binance_smart_chain',
platform: 'Space ID',
source: 'Space ID',
name: 'sujiyan',
handle: 'sujiyan.bnb',
bio: '',
expire_at: '2023-09-18T03:44:56Z',
profile_uri: [
'https://meta.image.space.id/image/mainnet/1724643242156410158978553366859696090187901297468846704390299624367871799562.svg',
],
},
{
address: '0x934b510d4c9103e6a87aef13b816fb080286d649',
network: 'polygon',
platform: 'Lens',
source: 'Lens',
name: 'Suji Yan',
handle: 'sujiyan.lens',
bio: 'Mask.io',
url: 'https://lenster.xyz/u/sujiyan.lens',
profile_uri: ['https://ipfs.io/ipfs/QmeYWaMUekPthkMnb5FMkiPLBTfu1PLkQFvZM3a7oftzNu'],
},
])
}),
]
28 changes: 0 additions & 28 deletions packages/web3-providers/src/DSearch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { CoinGeckoSearchAPI } from '../CoinGecko/apis/DSearchAPI.js'
import { CoinGeckoTrending } from '../CoinGecko/apis/TrendingAPI.js'
import { ENS } from '../ENS/index.js'
import { NFTScanCollectionSearchAPI, NFTScanSearchAPI } from '../NFTScan/apis/DSearchAPI.js'
import { PlatformToChainIdMap } from '../RSS3/constants.js'
import { RSS3 } from '../RSS3/index.js'
import { SpaceID } from '../SpaceID/index.js'
import { DSEARCH_BASE_URL } from './constants.js'
Expand Down Expand Up @@ -140,25 +139,6 @@ class DSearchAPI<ChainId = Web3Helper.ChainIdAll, SchemaType = Web3Helper.Schema
]
}

private async searchRSS3Handle(handle: string): Promise<Array<DomainResult<ChainId>>> {
const profiles = await RSS3.getProfiles(handle)
return profiles
.filter((x) => x.handle === handle)
.map((profile) => {
const chainId = PlatformToChainIdMap[profile.network] as ChainId
if (!chainId) console.error(`Not chain id configured for network ${profile.network}`)

return {
type: SearchResultType.Domain,
pluginID: NetworkPluginID.PLUGIN_EVM,
chainId,
keyword: handle,
domain: profile.handle,
address: profile.address,
}
})
}

private async searchRSS3NameService(handle: string): Promise<Array<DomainResult<ChainId>>> {
const result = await RSS3.getNameService(handle)
if (!result) return []
Expand Down Expand Up @@ -457,14 +437,6 @@ class DSearchAPI<ChainId = Web3Helper.ChainIdAll, SchemaType = Web3Helper.Schema
const { word, field } = this.parseKeyword(lowerKeyword)
if (word && ['token', 'twitter'].includes(field ?? '')) return this.searchTokenByName(word) as Promise<T[]>

// vitalik.lens, vitalik.bit, etc. including ENS BNB
// Can't get .bit domain via RSS3 profile API.
if (isValidHandle(lowerKeyword) && !lowerKeyword.endsWith('.bit')) {
if (lowerKeyword.endsWith('.eth')) Telemetry.captureEvent(EventType.Access, EventID.EntryTimelineDsearchEns)
else Telemetry.captureEvent(EventType.Access, EventID.EntryTimelineDsearchName)
const domains = (await this.searchRSS3Handle(lowerKeyword)) as T[]
if (domains.length) return domains
}
if (lowerKeyword.endsWith('.bit')) {
Telemetry.captureEvent(EventType.Access, EventID.EntryTimelineDsearchName)
return this.searchRSS3NameService(lowerKeyword) as Promise<T[]>
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-providers/src/Firefly/RedPacket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { fetchJSON } from '../entry-helpers.js'
import { FireflyRedPacketAPI, type FireflyResponse } from '../entry-types.js'

const siteType = getSiteType()
const SITE_URL = siteType === EnhanceableSite.Firefly ? location.origin : 'https://firefly.mask.social'
const SITE_URL = siteType === EnhanceableSite.Firefly ? location.origin : 'https://firefly.social'
const FIREFLY_ROOT_URL =
process.env.NEXT_PUBLIC_FIREFLY_API_URL ||
(process.env.NODE_ENV === 'development' ? 'https://api-dev.firefly.land' : 'https://api.firefly.land')
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-providers/src/Firefly/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const FIREFLY_BASE_URL = 'https://api.firefly.land'
export const FIREFLY_SITE_URL = 'https://firefly.mask.social'
export const FIREFLY_SITE_URL = 'https://firefly.social'

export const EMAIL_REGEX =
/(([^\s"(),./:;<>@[\\\]]+(\.[^\s"(),./:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z-]+\.)+[A-Za-z]{2,}))$/
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-providers/src/LensV3/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const LENS_ROOT_API = 'https://api.lens.xyz/'
export const FIREFLY_SITE_URL = 'https://firefly.mask.social'
export const FIREFLY_SITE_URL = 'https://firefly.social'
export const LENS_MEDIA_SNAPSHOT_URL = 'https://ik.imagekit.io/lens/media-snapshot'
15 changes: 1 addition & 14 deletions packages/web3-providers/src/RSS3/apis/RSS3API.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createIndicator, createNextIndicator, createPageable } from '@masknet/shared-base'
import { queryClient } from '@masknet/shared-base-ui'
import { isValidAddress, type ChainId } from '@masknet/web3-shared-evm'
import { type ChainId } from '@masknet/web3-shared-evm'
import { Telemetry } from '@masknet/web3-telemetry'
import { ExceptionID, ExceptionType } from '@masknet/web3-telemetry/types'
import * as RSS3Next from /* webpackDefer: true */ 'rss3-next'
Expand Down Expand Up @@ -127,19 +127,6 @@ export class RSS3 {
)
}

static async getProfiles(account: string | undefined) {
if (!account) return []
if (!account.includes('.') && !isValidAddress(account)) return []
const url = urlcat(RSS3_ENDPOINT, '/datasets/domains/profiles', {
account,
})

const response = await fetchFromRSS3<RSS3BaseAPI.ProfilesResponse | { error: string }>(url)
if ('error' in response) return []

return response
}

static async getNameService(handle: string) {
const url = urlcat(RSS3_ENDPOINT, '/ns/:handle', {
handle,
Expand Down
22 changes: 6 additions & 16 deletions packages/web3-providers/src/Web3Bio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ type Response<T> =
error: string
}

function patchProfile(profile: Web3BioProfile): Web3BioProfile {
if (profile.platform === NextIDPlatform.Farcaster && profile.social?.uid) {
return {
...profile,
identity: profile.social.uid.toString(),
}
}
return profile
}

export class Web3Bio {
static fetchFromWeb3Bio<T>(request: Request | RequestInfo, init?: RequestInit) {
return fetchCachedJSON<T>(request, {
Expand All @@ -34,21 +24,21 @@ export class Web3Bio {

static async getProfilesByTwitterId(handle: string) {
const url = urlcat(WEB3_BIO_HOST, `/profile/twitter,${handle.toLowerCase()}`)
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(res) ? res.map(patchProfile) : []
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(profiles) ? profiles : []
}

/** Get profiles by address or domain */
static async getProfilesBy(domainOrAddress: string) {
const url = urlcat(WEB3_BIO_HOST, '/profile/:id', { id: domainOrAddress })
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(res) ? res.map(patchProfile) : []
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(profiles) ? profiles : []
}

static async getProfilesByNextId(pubkey: string) {
const url = urlcat(WEB3_BIO_HOST, '/profile/nextid,:pubkey', { pubkey })
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(res) ? res.map(patchProfile) : []
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
return Array.isArray(profiles) ? profiles : []
}

static async getAllLens(twitterId: string) {
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-shared/base/src/helpers/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const resolveNextIDPlatformLink = (networkPlatform: NextIDPlatform, ident
case NextIDPlatform.RSS3:
return `https://rss3.io/result?search=${identifier}`
case NextIDPlatform.LENS:
return `https://firefly.mask.social/profile/lens/${identifier}`
return `https://firefly.social/profile/lens/${identifier}`
case NextIDPlatform.REDDIT:
return `https://www.reddit.com/user/${identifier}`
case NextIDPlatform.SYBIL:
Expand All @@ -197,7 +197,7 @@ export const resolveNextIDPlatformLink = (networkPlatform: NextIDPlatform, ident
case NextIDPlatform.SpaceId:
return `https://bscscan.com/address/${identifier}`
case NextIDPlatform.Farcaster:
return `https://firefly.mask.social/profile/farcaster/${identifier}`
return `https://firefly.social/profile/farcaster/${identifier}`
case NextIDPlatform.Bit:
return `https://bit.cc/${name}`
case NextIDPlatform.Unstoppable:
Expand Down
Loading