mirror of
https://github.com/iv-org/invidious.git
synced 2026-07-09 23:32:06 +00:00
A little code cleanup on places where `preferences` is used more than one time and rename `prefs` to `preferences` to maintain consistency.
15 lines
402 B
Crystal
15 lines
402 B
Crystal
module Invidious::Frontend::Misc
|
|
extend self
|
|
|
|
def redirect_url(env : HTTP::Server::Context)
|
|
preferences = env.get("preferences").as(Preferences)
|
|
|
|
if preferences.automatic_instance_redirect
|
|
current_page = env.get?("current_page").as(String)
|
|
return "/redirect?referer=#{current_page}"
|
|
else
|
|
return "https://redirect.invidious.io#{env.request.resource}"
|
|
end
|
|
end
|
|
end
|