mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Only use /redirect when automatically redirecting
This commit is contained in:
parent
2b81a82620
commit
66e7285108
8 changed files with 56 additions and 33 deletions
|
@ -42,7 +42,7 @@ module Invidious::Routes::Misc
|
||||||
referer = get_referer(env)
|
referer = get_referer(env)
|
||||||
|
|
||||||
if !env.get("preferences").as(Preferences).automatic_instance_redirect
|
if !env.get("preferences").as(Preferences).automatic_instance_redirect
|
||||||
return env.redirect("https://redirect.invidious.io#{referer}")
|
return env.redirect("https://redirect.invidious.io/#{referer}")
|
||||||
end
|
end
|
||||||
|
|
||||||
instance_url = fetch_random_instance
|
instance_url = fetch_random_instance
|
||||||
|
|
|
@ -45,7 +45,11 @@
|
||||||
<div class="pure-u-1-3">
|
<div class="pure-u-1-3">
|
||||||
<a href="https://www.youtube.com/channel/<%= ucid %>"><%= translate(locale, "View channel on YouTube") %></a>
|
<a href="https://www.youtube.com/channel/<%= ucid %>"><%= translate(locale, "View channel on YouTube") %></a>
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
|
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="https://redirect.invidious.io/<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if !channel.auto_generated %>
|
<% if !channel.auto_generated %>
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
|
|
|
@ -44,7 +44,11 @@
|
||||||
<div class="pure-u-1-3">
|
<div class="pure-u-1-3">
|
||||||
<a href="https://www.youtube.com/channel/<%= channel.ucid %>/community"><%= translate(locale, "View channel on YouTube") %></a>
|
<a href="https://www.youtube.com/channel/<%= channel.ucid %>/community"><%= translate(locale, "View channel on YouTube") %></a>
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
|
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="https://redirect.invidious.io/<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if !channel.auto_generated %>
|
<% if !channel.auto_generated %>
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
|
|
|
@ -79,19 +79,8 @@
|
||||||
<div class="flex-left"><a href="/channel/<%= item.ucid %>">
|
<div class="flex-left"><a href="/channel/<%= item.ucid %>">
|
||||||
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %></p>
|
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %></p>
|
||||||
</a></div>
|
</a></div>
|
||||||
<div class="flex-right">
|
<% endpoint_params = "?v=#{item.id}&list=#{item.plid}" %>
|
||||||
<div class="icon-buttons">
|
<%= rendered "components/video-context-buttons" %>
|
||||||
<a title="<%=translate(locale, "Watch on YouTube")%>" href="https://www.youtube.com/watch?v=<%= item.id %>&list=<%= item.plid %>">
|
|
||||||
<i class="icon ion-logo-youtube"></i>
|
|
||||||
</a>
|
|
||||||
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&list=<%= item.plid %>&listen=1">
|
|
||||||
<i class="icon ion-md-headset"></i>
|
|
||||||
</a>
|
|
||||||
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=URI.encode_www_form("watch?v=#{item.id}&list=#{item.plid}")%>">
|
|
||||||
<i class="icon ion-md-jet"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="video-card-row flexible">
|
<div class="video-card-row flexible">
|
||||||
|
@ -155,19 +144,9 @@
|
||||||
<div class="flex-left"><a href="/channel/<%= item.ucid %>">
|
<div class="flex-left"><a href="/channel/<%= item.ucid %>">
|
||||||
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %></p>
|
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %></p>
|
||||||
</a></div>
|
</a></div>
|
||||||
<div class="flex-right">
|
|
||||||
<div class="icon-buttons">
|
<% endpoint_params = "?v=#{item.id}" %>
|
||||||
<a title="<%=translate(locale, "Watch on YouTube")%>" href="https://www.youtube.com/watch?v=<%= item.id %>">
|
<%= rendered "components/video-context-buttons" %>
|
||||||
<i class="icon ion-logo-youtube"></i>
|
|
||||||
</a>
|
|
||||||
<a title="<%=translate(locale, "Audio mode")%>" href="/watch?v=<%= item.id %>&listen=1">
|
|
||||||
<i class="icon ion-md-headset"></i>
|
|
||||||
</a>
|
|
||||||
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=<%=URI.encode_www_form("watch?v=#{item.id}")%>">
|
|
||||||
<i class="icon ion-md-jet"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="video-card-row flexible">
|
<div class="video-card-row flexible">
|
||||||
|
|
21
src/invidious/views/components/video-context-buttons.ecr
Normal file
21
src/invidious/views/components/video-context-buttons.ecr
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<div class="flex-right">
|
||||||
|
<div class="icon-buttons">
|
||||||
|
<a title="<%=translate(locale, "Watch on YouTube")%>" href="https://www.youtube.com/watch<%=endpoint_params%>">
|
||||||
|
<i class="icon ion-logo-youtube"></i>
|
||||||
|
</a>
|
||||||
|
<a title="<%=translate(locale, "Audio mode")%>" href="/watch<%=endpoint_params%>&listen=1">
|
||||||
|
<i class="icon ion-md-headset"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
|
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="/redirect?referer=%2Fwatch<%=endpoint_params%>">
|
||||||
|
<i class="icon ion-md-jet"></i>
|
||||||
|
</a>
|
||||||
|
<% else %>
|
||||||
|
<a title="<%=translate(locale, "Switch Invidious Instance")%>" href="https://redirect.invidious.io/watch<%=endpoint_params%>">
|
||||||
|
<i class="icon ion-md-jet"></i>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -41,9 +41,16 @@
|
||||||
<%= translate(locale, "View playlist on YouTube") %>
|
<%= translate(locale, "View playlist on YouTube") %>
|
||||||
</a>
|
</a>
|
||||||
<span> | </span>
|
<span> | </span>
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>">
|
|
||||||
<%= translate(locale, "Switch Invidious Instance") %>
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
</a>
|
<a href="/redirect?referer=<%= env.get?("current_page") %>">
|
||||||
|
<%= translate(locale, "Switch Invidious Instance") %>
|
||||||
|
</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="https://redirect.invidious.io/<%= env.get?("current_page") %>">
|
||||||
|
<%= translate(locale, "Switch Invidious Instance") %>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
|
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="https://redirect.invidious.io/<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-u-1 pure-md-1-3">
|
<div class="pure-u-1 pure-md-1-3">
|
||||||
|
|
|
@ -116,7 +116,11 @@ we're going to need to do it here in order to allow for translations.
|
||||||
(<a href="https://www.youtube.com/embed/<%= video.id %>"><%= translate(locale, "Embed") %></a>)
|
(<a href="https://www.youtube.com/embed/<%= video.id %>"><%= translate(locale, "Embed") %></a>)
|
||||||
</span>
|
</span>
|
||||||
<p id="watch-on-another-invidious-instance">
|
<p id="watch-on-another-invidious-instance">
|
||||||
|
<% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
|
||||||
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="https://redirect.invidious.io/<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<p id="embed-link">
|
<p id="embed-link">
|
||||||
<a href="<%= embed_link %>"><%= translate(locale, "Embed Link") %></a>
|
<a href="<%= embed_link %>"><%= translate(locale, "Embed Link") %></a>
|
||||||
|
|
Loading…
Reference in a new issue