2021-10-03 01:34:02 +05:30
|
|
|
{% skip_file if flag?(:api_only) %}
|
|
|
|
|
2021-08-11 16:06:25 +05:30
|
|
|
module Invidious::Routes::Misc
|
|
|
|
def self.home(env)
|
2020-10-06 10:11:18 +05:30
|
|
|
preferences = env.get("preferences").as(Preferences)
|
|
|
|
locale = LOCALES[preferences.locale]?
|
|
|
|
user = env.get? "user"
|
|
|
|
|
|
|
|
case preferences.default_home
|
|
|
|
when "Popular"
|
2020-12-27 10:42:43 +05:30
|
|
|
env.redirect "/feed/popular"
|
2020-10-06 10:11:18 +05:30
|
|
|
when "Trending"
|
|
|
|
env.redirect "/feed/trending"
|
|
|
|
when "Subscriptions"
|
|
|
|
if user
|
|
|
|
env.redirect "/feed/subscriptions"
|
|
|
|
else
|
2020-12-27 10:42:43 +05:30
|
|
|
env.redirect "/feed/popular"
|
2020-10-06 10:11:18 +05:30
|
|
|
end
|
|
|
|
when "Playlists"
|
|
|
|
if user
|
2021-08-30 20:28:24 +05:30
|
|
|
env.redirect "/feed/playlists"
|
2020-10-06 10:11:18 +05:30
|
|
|
else
|
2020-12-27 10:42:43 +05:30
|
|
|
env.redirect "/feed/popular"
|
2020-10-06 10:11:18 +05:30
|
|
|
end
|
|
|
|
else
|
2021-04-17 17:48:58 +05:30
|
|
|
templated "search_homepage", navbar_search: false
|
2020-10-06 10:11:18 +05:30
|
|
|
end
|
|
|
|
end
|
2021-02-02 10:48:16 +05:30
|
|
|
|
2021-08-11 16:06:25 +05:30
|
|
|
def self.privacy(env)
|
2021-02-02 10:48:16 +05:30
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
templated "privacy"
|
|
|
|
end
|
|
|
|
|
2021-08-11 16:06:25 +05:30
|
|
|
def self.licenses(env)
|
2021-02-02 10:48:16 +05:30
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
rendered "licenses"
|
|
|
|
end
|
2021-03-27 07:06:40 +05:30
|
|
|
|
2021-08-11 16:06:25 +05:30
|
|
|
def self.cross_instance_redirect(env)
|
2021-03-29 11:35:54 +05:30
|
|
|
referer = get_referer(env)
|
2021-05-16 08:38:33 +05:30
|
|
|
instance_url = fetch_random_instance
|
2021-03-29 11:35:54 +05:30
|
|
|
env.redirect "https://#{instance_url}#{referer}"
|
2021-03-27 07:06:40 +05:30
|
|
|
end
|
2020-10-06 10:11:18 +05:30
|
|
|
end
|