Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build MFA Plugin
name: Build MTBlockEditor Plugin
on:
push:
branches:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object-assign
* Available under MIT license
*/

/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */

/** @license
# Movable Type Block Editor (C) 2020 Six Apart Ltd. All Rights Reserved.
Expand Down

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/App/Oembed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,31 @@ sub get_oembed_url {

# youtube
return "https://www.youtube.com/oembed?url=${url}"
if $url =~ /youtube|youtu\.be/i;
if $url =~ m{^https?://(?:www\.)?(?:youtube\.com|youtu\.be)/}i;

# soundcloud
return "https://soundcloud.com/oembed?url=${url}"
if $url =~ /soundcloud/i;
if $url =~ m{^https?://(?:www\.)?soundcloud\.com/}i;

# mixcloud
return "https://www.mixcloud.com/oembed/?url=${url}"
if $url =~ /mixcloud/i;
if $url =~ m{^https?://(?:www\.)?mixcloud\.com/}i;

# vimeo
return "https://vimeo.com/api/oembed.json?url=${url}"
if $url =~ /vimeo/i;
if $url =~ m{^https?://(?:www\.)?vimeo\.com/}i;

# slideshare
return "https://www.slideshare.net/api/oembed/2?url=${url}"
if $url =~ /slideshare/i;
if $url =~ m{^https?://(?:www\.)?slideshare\.net/}i;

# twitter
# x (twitter)
return "https://publish.twitter.com/oembed?url=${url}"
if $url =~ /twitter/i;
if $url =~ m{^https?://(?:www\.)?(?:twitter|x)\.com/[^/]+/status/\d+}i;

# tiktok
return "https://www.tiktok.com/oembed?url=${url}"
if $url =~ m{^https?://(?:www\.)?tiktok\.com/.*\/video\/.*}i;

# FIXME: access token is required
# instagram
Expand All @@ -55,10 +59,6 @@ sub get_oembed_url {
# return "https://graph.facebook.com/v10.0/instagram_oembed?url=${url}";
# }

# tiktok
return "https://www.tiktok.com/oembed?url=${url}"
if $url =~ /tiktok\.com\/.*\/video\/.*/i;

return "";
}

Expand Down
4 changes: 4 additions & 0 deletions plugins/MTBlockEditor/t/08-app-oembed.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ my $admin = $objs->{author}{admin};
my ($app, $out);

my @services = ({
name => "x",
url => "https://x.com/sixapartkk/status/1225330880022896640",
},
{
name => "twitter",
url => "https://twitter.com/sixapartkk/status/1225330880022896640",
},
Expand Down
6 changes: 3 additions & 3 deletions plugins/MTBlockEditor/tmpl/script.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/locales/<$mt:var name="local_lang_id"$>.js?v=<mt:Var name="mt_block_editor_version" />"></script>
</mt:if>

<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.5/mt-block-editor.js?v=<mt:Var name="mt_block_editor_version" />" type="module"></script>
<link rel="stylesheet" href="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.5/mt-block-editor.css?v=<mt:Var name="mt_block_editor_version" />" />
<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.7/mt-block-editor.js?v=<mt:Var name="mt_block_editor_version" />" type="module"></script>
<link rel="stylesheet" href="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.7/mt-block-editor.css?v=<mt:Var name="mt_block_editor_version" />" />

<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.7/mt-block-editor-block-oembed.js?v=<mt:Var name="mt_block_editor_version" />" type="module"></script>
<link rel="stylesheet" href="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.7/mt-block-editor-block-oembed.css?v=<mt:Var name="mt_block_editor_version" />" />

<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor-block-form-element/1.0.5/mt-block-editor-block-form-element.js?v=<mt:Var name="mt_block_editor_version" />" type="module"></script>

<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/block.min.js?v=<mt:Var name="mt_block_editor_version" />" type="module"></script>
<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.5/register-boilerplate-blocks.js?v=<mt:Var name="mt_block_editor_version" />" type="module" data-blocks="<mt:var name="custom_block_types_json" encode_html="1">" data-block-types="<mt:var name="block_type_ids" to_json="1" encode_html="1">"></script>
<script src="<$mt:var name="static_uri"$>plugins/MTBlockEditor/dist/mt-block-editor/1.2.7/register-boilerplate-blocks.js?v=<mt:Var name="mt_block_editor_version" />" type="module" data-blocks="<mt:var name="custom_block_types_json" encode_html="1">" data-block-types="<mt:var name="block_type_ids" to_json="1" encode_html="1">"></script>
</mt:setvarblock>

<mt:var name="block_editor_extensions{extensions}" setvar="e">
Expand Down