mirror of
https://github.com/iv-org/invidious.git
synced 2025-01-10 11:30:34 +05:30
feat: add confirm leaving Invidious view and route
This commit is contained in:
parent
c5fdd9ea65
commit
a02b55b2c0
@ -43,4 +43,14 @@ module Invidious::Routes::Misc
|
|||||||
instance_url = fetch_random_instance
|
instance_url = fetch_random_instance
|
||||||
env.redirect "https://#{instance_url}#{referer}"
|
env.redirect "https://#{instance_url}#{referer}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.confirm_leave(env)
|
||||||
|
locale = env.get("preferences").as(Preferences).locale
|
||||||
|
|
||||||
|
link = env.params.query["link"]?
|
||||||
|
|
||||||
|
referer = get_referer(env)
|
||||||
|
|
||||||
|
templated "confirm_leave"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,6 +21,7 @@ module Invidious::Routing
|
|||||||
get "/privacy", Routes::Misc, :privacy
|
get "/privacy", Routes::Misc, :privacy
|
||||||
get "/licenses", Routes::Misc, :licenses
|
get "/licenses", Routes::Misc, :licenses
|
||||||
get "/redirect", Routes::Misc, :cross_instance_redirect
|
get "/redirect", Routes::Misc, :cross_instance_redirect
|
||||||
|
get "/confirm_leave", Routes::Misc, :confirm_leave
|
||||||
|
|
||||||
self.register_channel_routes
|
self.register_channel_routes
|
||||||
self.register_watch_routes
|
self.register_watch_routes
|
||||||
|
24
src/invidious/views/confirm_leave.ecr
Normal file
24
src/invidious/views/confirm_leave.ecr
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<% content_for "header" do %>
|
||||||
|
<title><%= translate(locale, "Leave Invidious") %> - Invidious</title>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="h-box">
|
||||||
|
<div class="pure-form pure-form-aligned">
|
||||||
|
|
||||||
|
<legend><%= translate(locale, "You are leaving Invidious. Continue to external link?") %></legend>
|
||||||
|
|
||||||
|
<div class="pure-g">
|
||||||
|
<div class="pure-u-1-2">
|
||||||
|
<a value="confirm_leave" class="pure-button pure-button-primary" href="<%= link %>">
|
||||||
|
<%= translate(locale, "Yes") %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="pure-u-1-2">
|
||||||
|
<a class="pure-button" href="<%= referer %>">
|
||||||
|
<%= translate(locale, "No") %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user