Merge pull request #1551 from saltycrys/add-embed-link
Add embed link to watch page
This commit is contained in:
commit
5e8856e65b
@ -31,6 +31,11 @@ function get_playlist(plid, retries) {
|
||||
player.on('ended', function () {
|
||||
var url = new URL('https://example.com/embed/' + xhr.response.nextVideo);
|
||||
|
||||
url.searchParams.set('list', plid);
|
||||
if (!plid.startsWith('RD')) {
|
||||
url.searchParams.set('index', xhr.response.index);
|
||||
}
|
||||
|
||||
if (video_data.params.autoplay || video_data.params.continue_autoplay) {
|
||||
url.searchParams.set('autoplay', '1');
|
||||
}
|
||||
@ -47,10 +52,6 @@ function get_playlist(plid, retries) {
|
||||
url.searchParams.set('local', video_data.params.local);
|
||||
}
|
||||
|
||||
url.searchParams.set('list', plid);
|
||||
if (!plid.startsWith('RD')) {
|
||||
url.searchParams.set('index', xhr.response.index);
|
||||
}
|
||||
location.assign(url.pathname + url.search);
|
||||
});
|
||||
}
|
||||
|
@ -154,6 +154,11 @@ function get_playlist(plid, retries) {
|
||||
player.on('ended', function () {
|
||||
var url = new URL('https://example.com/watch?v=' + xhr.response.nextVideo);
|
||||
|
||||
url.searchParams.set('list', plid);
|
||||
if (!plid.startsWith('RD')) {
|
||||
url.searchParams.set('index', xhr.response.index);
|
||||
}
|
||||
|
||||
if (video_data.params.autoplay || video_data.params.continue_autoplay) {
|
||||
url.searchParams.set('autoplay', '1');
|
||||
}
|
||||
@ -170,10 +175,6 @@ function get_playlist(plid, retries) {
|
||||
url.searchParams.set('local', video_data.params.local);
|
||||
}
|
||||
|
||||
url.searchParams.set('list', plid);
|
||||
if (!plid.startsWith('RD')) {
|
||||
url.searchParams.set('index', xhr.response.index);
|
||||
}
|
||||
location.assign(url.pathname + url.search);
|
||||
});
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user