mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-19 03:18:50 +00:00
Adjust routes
Simple routes have been moved into a single `Misc` file. Embed routes have been moved into a single `Embed` file. The preferences route has been renamed to be more consistent with other parts of the codebase.
This commit is contained in:
38
src/invidious/routes/misc.cr
Normal file
38
src/invidious/routes/misc.cr
Normal file
@@ -0,0 +1,38 @@
|
||||
class Invidious::Routes::Misc < Invidious::Routes::BaseRoute
|
||||
def home(env)
|
||||
preferences = env.get("preferences").as(Preferences)
|
||||
locale = LOCALES[preferences.locale]?
|
||||
user = env.get? "user"
|
||||
|
||||
case preferences.default_home
|
||||
when "Popular"
|
||||
env.redirect "/feed/popular"
|
||||
when "Trending"
|
||||
env.redirect "/feed/trending"
|
||||
when "Subscriptions"
|
||||
if user
|
||||
env.redirect "/feed/subscriptions"
|
||||
else
|
||||
env.redirect "/feed/popular"
|
||||
end
|
||||
when "Playlists"
|
||||
if user
|
||||
env.redirect "/view_all_playlists"
|
||||
else
|
||||
env.redirect "/feed/popular"
|
||||
end
|
||||
else
|
||||
templated "empty"
|
||||
end
|
||||
end
|
||||
|
||||
def privacy(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
templated "privacy"
|
||||
end
|
||||
|
||||
def licenses(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
rendered "licenses"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user