Merge pull request #1551 from saltycrys/add-embed-link

Add embed link to watch page
This commit is contained in:
TheFrenchGhosty 2020-12-08 21:30:13 +00:00 committed by GitHub
commit 5e8856e65b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View file

@ -28,6 +28,14 @@ class Invidious::Routes::Watch < Invidious::Routes::BaseRoute
return env.redirect "/"
end
embed_link = "/embed/#{id}"
if env.params.query.size > 1
embed_params = env.params.query.dup
embed_params.delete_all("v")
embed_link += "?"
embed_link += embed_params.to_s
end
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
continuation = process_continuation(PG_DB, env.params.query, plid, id)

View file

@ -88,7 +88,11 @@
<div class="h-box">
<span id="watch-on-youtube">
<a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></a>
(<a href="https://www.youtube.com/embed/<%= video.id %>"><%= translate(locale, "Embed") %></a>)
</span>
<p id="embed-link">
<a href="<%= embed_link %>"><%= translate(locale, "Embed Link") %></a>
</p>
<p id="annotations">
<% if params.annotations %>
<a href="/watch?<%= env.params.query %>&iv_load_policy=3">