aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-08-25 09:49:02 +0300
committerGravatar Vitaly Takmazov2023-08-25 10:23:47 +0300
commit65c5e96c1f4ed987f0631ace8c8af1e394a2eeeb (patch)
tree5774b307b2e7934a98cb253a85be1f075e1c220a /vnext
parent3441a88c867bebf3b0daa14d4143ae03dd19de59 (diff)
embed: handle x.com links
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/utils/embed.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js
index 3020058a..514ce1ce 100644
--- a/vnext/src/utils/embed.js
+++ b/vnext/src/utils/embed.js
@@ -268,9 +268,14 @@ function getEmbeddableLinkTypes() {
name: 'Twitter',
id: 'embed_twitter_status',
className: 'twi compact',
- re: /^(?:https?:)?\/\/(?:www\.)?(?:mobile\.)?twitter\.com\/([\w-]+)\/status(?:es)?\/([\d]+)/i,
+ re: /^(?:https?:)?\/\/(?:www\.)?(?:mobile\.)?(twitter|x)\.com\/([\w-]+)\/status(?:es)?\/([\d]+)/i,
makeNode: function(aNode, reResult, div) {
- fetch('https://x.juick.com/oembed?url=' + reResult[0])
+ const wrong_prefix = 'https://x.com'
+ const correct_prefix = 'https://twitter.com'
+ const twitter_url = reResult[0].startsWith(wrong_prefix) ?
+ reResult[0].replace(wrong_prefix, correct_prefix)
+ : reResult[0]
+ fetch('https://x.juick.com/oembed?url=' + twitter_url)
.then(response => response.json())
.then(json => {
div.innerHTML = json.html