@@ -20,8 +20,7 @@ import { Web3StateSettings } from '../settings/index.js'
20
20
const ENS_RE = / [ ^ \s ( ) [ \] ] { 1 , 256 } \. ( e t h | k r e d | x y z | l u x e ) \b / gi
21
21
const SID_RE = / [ ^ \t \n \v ( ) [ \] ] { 1 , 256 } \. b n b \b / gi
22
22
const ADDRESS_FULL = / 0 x \w { 40 , } / i
23
- const RSS3_URL_RE = / h t t p s ? : \/ \/ (?< name > [ \w . ] + ) \. ( r s s 3 | c h e e r s ) \. b i o /
24
- const RSS3_RNS_RE = / (?< name > [ \w . ] + ) \. r s s 3 /
23
+ const CROSSBELL_HANDLE_RE = / (?< name > [ \w . ] + ) \. c s b /
25
24
const LENS_RE = / [ ^ \s ( ) [ \] ] { 1 , 256 } \. l e n s \b / i
26
25
const LENS_URL_RE = / h t t p s ? : \/ \/ .+ \/ ( \w + \. l e n s ) /
27
26
const LENS_DOMAIN_RE = / [ a - z ] [ \d _ a - z ] { 4 , 25 } \. l e n s /
@@ -40,10 +39,10 @@ function getSIDNames(userId: string, nickname: string, bio: string) {
40
39
return [ userId . match ( SID_RE ) , nickname . match ( SID_RE ) , bio . match ( SID_RE ) ] . flatMap ( ( result ) => result ?? [ ] )
41
40
}
42
41
43
- function getRSS3Ids ( nickname : string , profileURL : string , bio : string ) {
44
- return [ nickname . match ( RSS3_RNS_RE ) , profileURL . match ( RSS3_URL_RE ) , bio . match ( RSS3_URL_RE ) , bio . match ( RSS3_RNS_RE ) ]
45
- . map ( ( result ) => result ?. groups ?. name ?? '' )
46
- . filter ( Boolean )
42
+ function getCrossBellHandles ( nickname : string , bio : string ) {
43
+ return [ nickname . match ( CROSSBELL_HANDLE_RE ) , bio . match ( CROSSBELL_HANDLE_RE ) ]
44
+ . map ( ( result ) => result ?. groups ?. name )
45
+ . filter ( Boolean ) as string [ ]
47
46
}
48
47
49
48
function getAddress ( text : string ) {
@@ -120,15 +119,16 @@ export class IdentityService extends IdentityServiceState<ChainId> {
120
119
return this . createSocialAddress ( SocialAddressType . Address , address )
121
120
}
122
121
123
- /** Read a social address from bio when it contains a RSS3 ID . */
124
- private async getSocialAddressFromRSS3 ( { nickname = '' , homepage = '' , bio = '' } : SocialIdentity ) {
125
- const ids = getRSS3Ids ( nickname , homepage , bio )
126
- if ( ! ids . length ) return
122
+ /** Read a social address from bio when it contains a csb handle . */
123
+ private async getSocialAddressFromCrossbell ( { nickname = '' , bio = '' } : SocialIdentity ) {
124
+ const handles = getCrossBellHandles ( nickname , bio )
125
+ if ( ! handles . length ) return
127
126
128
127
const allSettled = await Promise . allSettled (
129
- ids . map ( async ( id ) => {
130
- const info = await RSS3 . getNameInfo ( id )
131
- return this . createSocialAddress ( SocialAddressType . RSS3 , info ?. address ?? '' , `${ id } .rss3` )
128
+ handles . map ( async ( handle ) => {
129
+ const info = await RSS3 . getNameInfo ( handle )
130
+ if ( ! info ?. crossbell ) return
131
+ return this . createSocialAddress ( SocialAddressType . Crossbell , info . address , info . crossbell )
132
132
} ) ,
133
133
)
134
134
return compact ( allSettled . map ( ( x ) => ( x . status === 'fulfilled' ? x . value : undefined ) ) . filter ( Boolean ) )
@@ -279,7 +279,7 @@ export class IdentityService extends IdentityServiceState<ChainId> {
279
279
this . getSocialAddressFromENS ( identity ) ,
280
280
this . getSocialAddressFromSpaceID ( identity ) ,
281
281
this . getSocialAddressFromAvatarNextID ( identity ) ,
282
- this . getSocialAddressFromRSS3 ( identity ) ,
282
+ this . getSocialAddressFromCrossbell ( identity ) ,
283
283
this . getSocialAddressFromTwitterBlue ( identity ) ,
284
284
this . getSocialAddressesFromNextID ( identity ) ,
285
285
this . getSocialAddressesFromMaskX ( identity ) ,
0 commit comments