Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F325775
matcher.service.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
903 B
Referenced Files
None
Subscribers
None
matcher.service.js
View Options
export
const
mentionMatchesUrl
=
(
attention
,
url
)
=>
{
if
(
url
===
attention
.
statusnet_profile_url
)
{
return
true
}
const
[
namepart
,
instancepart
]
=
attention
.
screen_name
.
split
(
'@'
)
const
matchstring
=
new
RegExp
(
'://'
+
instancepart
+
'/.*'
+
namepart
+
'$'
,
'g'
)
return
!!
url
.
match
(
matchstring
)
}
/**
* Extract tag name from pleroma or mastodon url.
* i.e https://bikeshed.party/tag/photo or https://quey.org/tags/sky
* @param {string} url
*/
export
const
extractTagFromUrl
=
(
url
)
=>
{
const
decoded
=
decodeURI
(
url
)
// https://git.pleroma.social/pleroma/elixir-libraries/linkify/-/blob/master/lib/linkify/parser.ex
// https://www.pcre.org/original/doc/html/pcrepattern.html
const
regex
=
/tag[s]*\/([\p{L}\p{N}_]*[\p{Alphabetic}_·\u{200c}][\p{L}\p{N}_·\p{M}\u{200c}]*)$/ug
const
result
=
regex
.
exec
(
decoded
)
if
(
!
result
)
{
return
false
}
return
result
[
1
]
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 24, 4:23 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
95824
Default Alt Text
matcher.service.js (903 B)
Attached To
Mode
rPUFE pleroma-fe-upstream
Attached
Detach File
Event Timeline
Log In to Comment