From f4e8bb99ba72a35f42b23bec8deaa4b5bf1d4066 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 27 Oct 2021 22:39:02 -0700 Subject: [PATCH] Cherry-pick fixes --- assets/css/channel.css | 7 + assets/css/default.css | 13 +- src/invidious/routes/channels.cr | 10 +- src/invidious/views/channel/channel.ecr | 2 +- src/invidious/views/channel/community.ecr | 2 +- src/invidious/views/channel/playlists.ecr | 2 +- .../channels/channel-information.ecr | 60 +++----- .../channels/content-sorting-bar.ecr | 1 - .../views/components/search-filters.ecr | 130 ------------------ 9 files changed, 45 insertions(+), 182 deletions(-) delete mode 100644 src/invidious/views/components/search-filters.ecr diff --git a/assets/css/channel.css b/assets/css/channel.css index d4aefca8..db98dca8 100644 --- a/assets/css/channel.css +++ b/assets/css/channel.css @@ -50,3 +50,10 @@ #link-widget-primary a:hover { color: #e1e1e1 !important; } + +/* Center sorting options when screen is less than 640px*/ +@media screen and (max-width: 640px) { + #sort-options { + margin-right: auto; + } +} diff --git a/assets/css/default.css b/assets/css/default.css index 6c858646..e2c8a692 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -567,5 +567,16 @@ p, #content-navigation { - margin-bottom: 0.5em; + margin-bottom: 0.5em; + display: flex; + overflow-x: scroll; + overflow-y: hidden; + white-space: nowrap; + + -ms-overflow-style: none; + scrollbar-width: none; } + +#content-navigation::-webkit-scrollbar { + display: none; /* Safari and Chrome */ +} \ No newline at end of file diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index a797056f..e1f708c0 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -7,6 +7,7 @@ module Invidious::Routes::Channels def self.videos(env) data = self.fetch_basic_information(env) + if !data.is_a?(Tuple) return data end @@ -48,6 +49,7 @@ module Invidious::Routes::Channels end locale, user, subscriptions, continuation, ucid, channel = data + sort_options = {"last", "oldest", "newest"} sort_by = env.params.query["sort_by"]?.try &.downcase sort_by ||= "last" @@ -104,9 +106,9 @@ module Invidious::Routes::Channels begin channel = get_about_info(ucid, locale) rescue ex : ChannelRedirect - next env.redirect env.request.resource.gsub(ucid, ex.channel_id) + return env.redirect env.request.resource.gsub(ucid, ex.channel_id) rescue ex - next error_template(500, ex) + return error_template(500, ex) end templated "channel/about" @@ -157,11 +159,11 @@ module Invidious::Routes::Channels end end - private def search(env) + def self.search(env) return env.redirect "/search?#{env.params.query}&channel=#{env.params.url["ucid"]}" end - private def fetch_basic_information(env) + private def self.fetch_basic_information(env) locale = LOCALES[env.get("preferences").as(Preferences).locale]? user = env.get? "user" diff --git a/src/invidious/views/channel/channel.ecr b/src/invidious/views/channel/channel.ecr index 7a61acef..42e68d49 100644 --- a/src/invidious/views/channel/channel.ecr +++ b/src/invidious/views/channel/channel.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= channel.author %> - Invidious +<%= HTML.escape(channel.author) %> - Invidious <% end %> diff --git a/src/invidious/views/channel/community.ecr b/src/invidious/views/channel/community.ecr index 3bb778e8..636753f5 100644 --- a/src/invidious/views/channel/community.ecr +++ b/src/invidious/views/channel/community.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= channel.author %> - Invidious +<%= HTML.escape(channel.author) %> - Invidious <% end %> diff --git a/src/invidious/views/channel/playlists.ecr b/src/invidious/views/channel/playlists.ecr index 99732977..9ac16699 100644 --- a/src/invidious/views/channel/playlists.ecr +++ b/src/invidious/views/channel/playlists.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= channel.author %> - Invidious +<%= HTML.escape(channel.author) %> - Invidious <% end %> diff --git a/src/invidious/views/components/channels/channel-information.ecr b/src/invidious/views/components/channels/channel-information.ecr index 19b24d08..4827e511 100644 --- a/src/invidious/views/components/channels/channel-information.ecr +++ b/src/invidious/views/components/channels/channel-information.ecr @@ -1,3 +1,5 @@ +<% author = HTML.escape(channel.author) %> + <% if channel.banner %>