diff --git a/src/invidious/routes/misc.cr b/src/invidious/routes/misc.cr index d6bd9571..4f7f65a8 100644 --- a/src/invidious/routes/misc.cr +++ b/src/invidious/routes/misc.cr @@ -23,6 +23,12 @@ module Invidious::Routes::Misc else env.redirect "/feed/popular" end + when "Compilations" + if user + env.redirect "/feed/compilations" + else + env.redirect "/feed/popyular" + end else templated "search_homepage", navbar_search: false end diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index abe0f34e..6d410e87 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -99,7 +99,7 @@ module Invidious::Routes::PreferencesRoute default_home = env.params.body["default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home feed_menu = [] of String - 4.times do |index| + 5.times do |index| option = env.params.body["feed_menu[#{index}]"]?.try &.as(String) || "" if !option.empty? feed_menu << option diff --git a/src/invidious/views/compilation.ecr b/src/invidious/views/compilation.ecr new file mode 100644 index 00000000..de3ac1fa --- /dev/null +++ b/src/invidious/views/compilation.ecr @@ -0,0 +1,51 @@ +<% title = HTML.escape(compilation.title) %> +<% author = HTML.escape(compilation.author) %> + +<% content_for "header" do %> +<%= title %> - Invidious + +<% end %> + +
+
+

<%= title %>

+ <% if compilation.is_a? InvidiousCompilation %> + + <% if compilation.author == user.try &.email %> + <%= author %> | + <% else %> + <%= author %> | + <% end %> + <%= translate_count(locale, "generic_videos_count", compilation.video_count) %> | + <%= translate(locale, "Updated `x` ago", recode_date(compilation.updated, locale)) %> | + <% case compilation.as(InvidiousCompilation).privacy when %> + <% when CompilationPrivacy::Unlisted %> + <%= translate(locale, "Unlisted") %> + <% when CompilationPrivacy::Private %> + <%= translate(locale, "Private") %> + <% end %> + + <% else %> + + <%= author %> | + <%= translate_count(locale, "generic_videos_count", compilation.video_count) %> | + <%= translate(locale, "Updated `x` ago", recode_date(compilation.updated, locale)) %> + + <% end %> +
+
+

+
+ <% if compilation.is_a?(InvidiousCompilation) && compilation.author == user.try &.email %> +
+
+ <% else %> + <% if !Invidious::Database::Compilations.exists?(compilation.id) %> +
+ <% end %> + <% end %> +
+
+

+
+
\ No newline at end of file diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index dfda1434..1ef99cd2 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -165,7 +165,7 @@ <% if env.get?("user") %> - <% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists"} %> + <% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists", "Compilations"} %> <% else %> <% feed_options = {"", "Popular", "Trending"} %> <% end %>