mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-09 15:02:14 +05:30
refactor: replace all youtube external links with confirmation page
This commit is contained in:
parent
01e9fa3af7
commit
0fd38e52ef
@ -157,8 +157,10 @@ module Invidious::Frontend::Comments
|
|||||||
|
|
|
|
||||||
END_HTML
|
END_HTML
|
||||||
elsif comments["authorId"]?
|
elsif comments["authorId"]?
|
||||||
|
permalink = "https://www.youtube.com/channel/#{comments["authorId"]}/community?lb=#{child["commentId"]}"
|
||||||
|
permalink_confirm = "/confirm_leave?link=#{URI.encode_path(permalink)}"
|
||||||
html << <<-END_HTML
|
html << <<-END_HTML
|
||||||
<a rel="noreferrer noopener" href="https://www.youtube.com/channel/#{comments["authorId"]}/community?lb=#{child["commentId"]}" title="#{translate(locale, "YouTube comment permalink")}">[YT]</a>
|
<a href="#{permalink_confirm}" title="#{translate(locale, "YouTube comment permalink")}">[YT]</a>
|
||||||
|
|
|
|
||||||
END_HTML
|
END_HTML
|
||||||
end
|
end
|
||||||
|
@ -180,6 +180,9 @@ def error_redirect_helper(env : HTTP::Server::Context)
|
|||||||
go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube")
|
go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube")
|
||||||
switch_instance = translate(locale, "Switch Invidious Instance")
|
switch_instance = translate(locale, "Switch Invidious Instance")
|
||||||
|
|
||||||
|
youtube_link = "https://youtube.com#{env.request.resource}"
|
||||||
|
youtube_link_confirm = "/confirm_leave?link=#{URI.encode_path(youtube_link)}"
|
||||||
|
|
||||||
return <<-END_HTML
|
return <<-END_HTML
|
||||||
<p style="margin-bottom: 4px;">#{next_steps_text}</p>
|
<p style="margin-bottom: 4px;">#{next_steps_text}</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -190,7 +193,7 @@ def error_redirect_helper(env : HTTP::Server::Context)
|
|||||||
<a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>
|
<a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a rel="noreferrer noopener" href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>
|
<a href="#{youtube_link_confirm}">#{go_to_youtube}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
END_HTML
|
END_HTML
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<div class="flex-right flexible">
|
<div class="flex-right flexible">
|
||||||
<div class="icon-buttons">
|
<div class="icon-buttons">
|
||||||
<a title="<%=translate(locale, "videoinfo_watch_on_youTube")%>" rel="noreferrer noopener" href="https://www.youtube.com/watch<%=endpoint_params%>">
|
<%-
|
||||||
|
watch_yt = "https://www.youtube.com/watch#{endpoint_params}"
|
||||||
|
confirm_watch_yt = "/confirm_leave?link=#{URI.encode_path(watch_yt)}"
|
||||||
|
-%>
|
||||||
|
<a title="<%=translate(locale, "videoinfo_watch_on_youTube")%>" href="<%= confirm_watch_yt %>">
|
||||||
<i class="icon ion-logo-youtube"></i>
|
<i class="icon ion-logo-youtube"></i>
|
||||||
</a>
|
</a>
|
||||||
<a title="<%=translate(locale, "Audio mode")%>" href="/watch<%=endpoint_params%>&listen=1">
|
<a title="<%=translate(locale, "Audio mode")%>" href="/watch<%=endpoint_params%>&listen=1">
|
||||||
|
@ -83,7 +83,11 @@
|
|||||||
|
|
||||||
<% if !playlist.is_a? InvidiousPlaylist %>
|
<% if !playlist.is_a? InvidiousPlaylist %>
|
||||||
<div class="pure-u-2-3">
|
<div class="pure-u-2-3">
|
||||||
<a rel="noreferrer noopener" href="https://www.youtube.com/playlist?list=<%= playlist.id %>">
|
<%-
|
||||||
|
view_yt = "https://www.youtube.com/playlist?list=#{playlist.id}"
|
||||||
|
confirm_view_yt = "/confirm_leave?link=#{URI.encode_path(view_yt)}"
|
||||||
|
-%>
|
||||||
|
<a href="<%= confirm_view_yt %>">
|
||||||
<%= translate(locale, "View playlist on YouTube") %>
|
<%= translate(locale, "View playlist on YouTube") %>
|
||||||
</a>
|
</a>
|
||||||
<span> | </span>
|
<span> | </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user