aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/utils/embed.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-06-21 02:21:08 +0300
committerGravatar Vitaly Takmazov2023-06-21 02:21:08 +0300
commitadff50b02bc1da905c6318975574b349aa99a441 (patch)
tree269d89ed74160586a94f1c8535ed4e2467ef5b28 /vnext/src/utils/embed.js
parent65f18e0d0732d761a1085cd293097d40d3b6e2a2 (diff)
Revert "embed: back to client-side Twitter embeds"
This reverts commit 6ec610fbdceaeadbbc184fb02e22a9c4dd13d0a9.
Diffstat (limited to 'vnext/src/utils/embed.js')
-rw-r--r--vnext/src/utils/embed.js22
1 files changed, 5 insertions, 17 deletions
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js
index b5b4d505..75985582 100644
--- a/vnext/src/utils/embed.js
+++ b/vnext/src/utils/embed.js
@@ -268,25 +268,13 @@ function getEmbeddableLinkTypes() {
name: 'Twitter',
id: 'embed_twitter_status',
className: 'twi compact',
- ctsDefault: false,
re: /^(?:https?:)?\/\/(?:www\.)?(?:mobile\.)?twitter\.com\/([\w-]+)\/status(?:es)?\/([\d]+)/i,
makeNode: function(aNode, reResult, div) {
- let [url, , ] = reResult
- url = url.replace('mobile.','')
-
- div.innerHTML = `<blockquote class="twitter-tweet" data-lang="en"><a href="${url}"></a></blockquote>`
-
- if (window.twttr) {
- // https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/scripting-loading-and-initialization
- window.twttr.widgets.load(div)
- } else {
- // innerHTML cannot insert scripts, so...
- let script = document.createElement('script')
- script.src = 'https://platform.twitter.com/widgets.js'
- script.charset = 'utf-8'
- div.appendChild(script)
- }
-
+ fetch('https://beta.juick.com/api/oembed?url=' + reResult[0])
+ .then(response => response.json())
+ .then(json => {
+ div.innerHTML = json.html
+ }).catch(console.log)
return div
}
},