@@ -56,27 +56,27 @@ const oEmbedProviders = [
56
56
url : "https://www.scribd.com/services/oembed"
57
57
} ,
58
58
{
59
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ \w { 1 , 15 } \/ s t a t u s ( e s ) ? \/ .* / ,
59
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ \w { 1 , 15 } \/ s t a t u s ( e s ) ? \/ .* / ,
60
60
url : "https://publish.twitter.com/oembed"
61
61
} ,
62
62
{
63
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ \w { 1 , 15 } $ / ,
63
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ \w { 1 , 15 } $ / ,
64
64
url : "https://publish.twitter.com/oembed"
65
65
} ,
66
66
{
67
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ \w { 1 , 15 } \/ l i k e s $ / ,
67
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ \w { 1 , 15 } \/ l i k e s $ / ,
68
68
url : "https://publish.twitter.com/oembed"
69
69
} ,
70
70
{
71
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ \w { 1 , 15 } \/ l i s t s \/ .* / ,
71
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ \w { 1 , 15 } \/ l i s t s \/ .* / ,
72
72
url : "https://publish.twitter.com/oembed"
73
73
} ,
74
74
{
75
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ \w { 1 , 15 } \/ t i m e l i n e s \/ .* / ,
75
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ \w { 1 , 15 } \/ t i m e l i n e s \/ .* / ,
76
76
url : "https://publish.twitter.com/oembed"
77
77
} ,
78
78
{
79
- regex : / h t t p s ? : \/ \/ ( w w w \. ) ? t w i t t e r \. c o m \/ i \/ m o m e n t s \/ .* / ,
79
+ regex : / h t t p s ? : \/ \/ ( w w w \. ) ? x \. c o m \/ i \/ m o m e n t s \/ .* / ,
80
80
url : "https://publish.twitter.com/oembed"
81
81
} ,
82
82
{
@@ -260,12 +260,13 @@ const urlTransforms = [
260
260
}
261
261
] ;
262
262
263
- async function getOembed ( url , maxwidth = 800 , maxheight = 600 ) {
263
+ async function getOembed ( url , maxwidth = 800 , maxheight = 600 , silent = false ) {
264
264
let oembedUrl ;
265
265
266
266
for ( const service of oEmbedProviders ) {
267
267
if ( service . regex . exec ( url ) ) {
268
- oembedUrl = service . url + `?url=${ url } &maxwidth=${ maxwidth } &maxheight=${ maxheight } &format=json` ;
268
+ let eurl = encodeURIComponent ( url ) ;
269
+ oembedUrl = service . url + `?url=${ eurl } &maxwidth=${ maxwidth } &maxheight=${ maxheight } &format=json` ;
269
270
}
270
271
}
271
272
@@ -289,8 +290,10 @@ async function getOembed(url, maxwidth = 800, maxheight = 600) {
289
290
return { html : transform } ;
290
291
}
291
292
292
- let message = 'Embed error: URL did not match any provider.' ;
293
- displayToast ( "bg-danger" , "Error" , message ) ;
293
+ if ( ! silent ) {
294
+ let message = 'Embed error: URL did not match any provider.' ;
295
+ displayToast ( "bg-danger" , "Error" , message ) ;
296
+ }
294
297
295
298
return ;
296
299
}
0 commit comments