DEV: Remove lazy-yt and replace with lazy-videos (#20722)

- Refactors the old plugin to remove jquery usage
- Adds support for Vimeo videos (default on) and Tiktok (experimental and default off)
This commit is contained in:
Jan Cernik
2023-03-29 12:54:25 -03:00
committed by GitHub
parent 86f5abfa18
commit afe3e36363
41 changed files with 672 additions and 510 deletions

View File

@@ -45,6 +45,7 @@ class Plugin::Metadata
"discourse-graphviz",
"discourse-group-tracker",
"discourse-invite-tokens",
"discourse-lazy-videos",
"discourse-local-dates",
"discourse-login-with-amazon",
"discourse-logster-rate-limit-checker",
@@ -93,7 +94,6 @@ class Plugin::Metadata
"discourse-zendesk-plugin",
"docker_manager",
"chat",
"lazy-yt",
"poll",
"styleguide",
],

View File

@@ -433,13 +433,19 @@ module PrettyText
# extract Youtube links
doc
.css("div[data-youtube-id]")
.css("div[data-video-id]")
.each do |div|
if div["data-youtube-id"].present?
links << DetectedLink.new(
"https://www.youtube.com/watch?v=#{div["data-youtube-id"]}",
false,
)
if div["data-video-id"].present? && div["data-provider-name"].present?
base_url =
case div["data-provider-name"]
when "youtube"
"https://www.youtube.com/watch?v="
when "vimeo"
"https://vimeo.com/"
when "tiktok"
"https://m.tiktok.com/v/"
end
links << DetectedLink.new(base_url + div["data-video-id"], false)
end
end

View File

@@ -4,7 +4,7 @@ directory "plugins"
desc "install all official plugins (use GIT_WRITE=1 to pull with write access)"
task "plugin:install_all_official" do
skip = Set.new(%w[customer-flair lazy-yt poll])
skip = Set.new(%w[customer-flair poll])
map = { "Canned Replies" => "https://github.com/discourse/discourse-canned-replies" }