2020-10-05 23:41:18 -05:00
|
|
|
class Invidious::Routes::Home < Invidious::Routes::BaseRoute
|
|
|
|
def handle(env)
|
|
|
|
preferences = env.get("preferences").as(Preferences)
|
|
|
|
locale = LOCALES[preferences.locale]?
|
|
|
|
user = env.get? "user"
|
|
|
|
|
|
|
|
case preferences.default_home
|
|
|
|
when "Popular"
|
2020-12-27 06:12:43 +01:00
|
|
|
env.redirect "/feed/popular"
|
2020-10-05 23:41:18 -05:00
|
|
|
when "Trending"
|
|
|
|
env.redirect "/feed/trending"
|
|
|
|
when "Subscriptions"
|
|
|
|
if user
|
|
|
|
env.redirect "/feed/subscriptions"
|
|
|
|
else
|
2020-12-27 06:12:43 +01:00
|
|
|
env.redirect "/feed/popular"
|
2020-10-05 23:41:18 -05:00
|
|
|
end
|
|
|
|
when "Playlists"
|
|
|
|
if user
|
|
|
|
env.redirect "/view_all_playlists"
|
|
|
|
else
|
2020-12-27 06:12:43 +01:00
|
|
|
env.redirect "/feed/popular"
|
2020-10-05 23:41:18 -05:00
|
|
|
end
|
|
|
|
else
|
|
|
|
templated "empty"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|