Update twitter url regexs to match x.com or twitter.com (#454)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
This commit is contained in:
parent
61485d38b5
commit
1872d6a7ad
|
@ -68,7 +68,7 @@ function ItemEmbed ({ item }) {
|
|||
const [overflowing, setOverflowing] = useState(false)
|
||||
const [show, setShow] = useState(false)
|
||||
|
||||
const twitter = item.url?.match(/^https?:\/\/twitter\.com\/(?:#!\/)?\w+\/status(?:es)?\/(?<id>\d+)/)
|
||||
const twitter = item.url?.match(/^https?:\/\/(?:twitter|x)\.com\/(?:#!\/)?\w+\/status(?:es)?\/(?<id>\d+)/)
|
||||
if (twitter?.groups?.id) {
|
||||
return (
|
||||
<div className={`${styles.twitterContainer} ${show ? '' : styles.twitterContained}`}>
|
||||
|
|
|
@ -15,7 +15,7 @@ export function removeTracking (value) {
|
|||
if (!value) return value
|
||||
const exprs = [
|
||||
// twitter URLs
|
||||
/^(?<url>https?:\/\/twitter\.com\/(?:#!\/)?(?<user>\w+)\/status(?:es)?\/(?<id>\d+))/
|
||||
/^(?<url>https?:\/\/(?:twitter|x)\.com\/(?:#!\/)?(?<user>\w+)\/status(?:es)?\/(?<id>\d+))/
|
||||
]
|
||||
for (const expr of exprs) {
|
||||
value = expr.exec(value)?.groups.url ?? value
|
||||
|
|
Loading…
Reference in New Issue