Add embed link to watch page

This commit is contained in:
saltycrys 2020-12-08 02:28:44 +01:00
parent 68552b6d65
commit 30c92ce1b7
2 changed files with 11 additions and 0 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

@ -89,6 +89,9 @@
<span id="watch-on-youtube">
<a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></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">