diff --git a/assets/css/default.css b/assets/css/default.css index 95c1f55c..8b2b3578 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -192,20 +192,24 @@ img.thumbnail { display: inline; } -.searchbar .pure-form input[type="search"] { - margin-bottom: 1px; +.searchbar .pure-form fieldset { padding: 0; } - border-top: 0; - border-left: 0; - border-right: 0; - border-bottom: 1px solid #ccc; - border-radius: 0; +.searchbar input[type="search"] { + width: 100%; + margin: 1px; - padding: initial 0; + border: 1px solid; + border-color: #0000 #0000 #CCC #0000; + border-radius: 0; - box-shadow: none; + box-shadow: none; + -webkit-appearance: none; +} - -webkit-appearance: none; +.searchbar input[type="search"]:focus { + margin: 0 0 0.5px 0; + border: 2px solid; + border-color: #0000 #0000 #FED #0000; } /* https://stackoverflow.com/a/55170420 */ @@ -217,16 +221,6 @@ input[type="search"]::-webkit-search-cancel-button { background-size: 14px; } -.searchbar .pure-form fieldset { - padding: 0; -} - -/* attract focus to the searchbar by adding a subtle transition */ -.searchbar .pure-form input[type="search"]:focus { - margin-bottom: 0px; - border-bottom: 2px solid #aaa; -} - .user-field { display: flex; flex-direction: row; @@ -546,7 +540,8 @@ p, } #descriptionWrapper { - max-width: 600px; + max-width: 600px; + white-space: pre-wrap; } /* Center the "invidious" logo on the search page */ diff --git a/spec/helpers_spec.cr b/spec/helpers_spec.cr index 4215b2bd..3319252f 100644 --- a/spec/helpers_spec.cr +++ b/spec/helpers_spec.cr @@ -41,16 +41,6 @@ describe "Helper" do end end - describe "#produce_playlist_continuation" do - it "correctly produces ctoken for requesting index `x` of a playlist" do - produce_playlist_continuation("UUCla9fZca4I7KagBtgRGnOw", 100).should eq("4qmFsgJNEhpWTFVVQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoUQ0FGNkJsQlVPa05IVVElM0QlM0SaAhhVVUNsYTlmWmNhNEk3S2FnQnRnUkduT3c%3D") - - produce_playlist_continuation("UCCla9fZca4I7KagBtgRGnOw", 200).should eq("4qmFsgJLEhpWTFVVQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoSQ0FKNkIxQlVPa05OWjBJJTNEmgIYVVVDbGE5ZlpjYTRJN0thZ0J0Z1JHbk93") - - produce_playlist_continuation("PL55713C70BA91BD6E", 100).should eq("4qmFsgJBEhRWTFBMNTU3MTNDNzBCQTkxQkQ2RRoUQ0FGNkJsQlVPa05IVVElM0QlM0SaAhJQTDU1NzEzQzcwQkE5MUJENkU%3D") - end - end - describe "#produce_search_params" do it "correctly produces token for searching with specified filters" do produce_search_params.should eq("CAASAhABSAA%3D") diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index c87c53e0..d93ee681 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -59,7 +59,7 @@ def get_about_info(ucid, locale) banner = banners.try &.[-1]?.try &.["url"].as_s? description = initdata["header"]["interactiveTabbedHeaderRenderer"]["description"]["simpleText"].as_s - description_html = HTML.escape(description).gsub("\n", "
") + description_html = HTML.escape(description) is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s) @@ -81,7 +81,7 @@ def get_about_info(ucid, locale) # end description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" - description_html = HTML.escape(description).gsub("\n", "
") + description_html = HTML.escape(description) is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 12a80bc4..5b7d63e0 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -550,12 +550,12 @@ end def parse_content(content : JSON::Any) : String content["simpleText"]?.try &.as_s.rchop('\ufeff').try { |b| HTML.escape(b) }.to_s || - content["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s } || "" + content["runs"]?.try &.as_a.try { |r| content_to_comment_html(r).try &.to_s.gsub("\n", "
") } || "" end def content_to_comment_html(content) comment_html = content.map do |run| - text = HTML.escape(run["text"].as_s).gsub("\n", "
") + text = HTML.escape(run["text"].as_s) if run["bold"]? text = "#{text}" diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index ee7e12aa..a09e6cdb 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -243,7 +243,7 @@ struct InvidiousPlaylist end def description_html - HTML.escape(self.description).gsub("\n", "
") + HTML.escape(self.description) end end @@ -300,16 +300,14 @@ def produce_playlist_continuation(id, index) .try { |i| Protodec::Any.from_json(i) } .try { |i| Base64.urlsafe_encode(i, padding: false) } - data_wrapper = {"1:varint" => request_count, "15:string" => "PT:#{data}"} - .try { |i| Protodec::Any.cast_json(i) } - .try { |i| Protodec::Any.from_json(i) } - .try { |i| Base64.urlsafe_encode(i) } - .try { |i| URI.encode_www_form(i) } - object = { "80226972:embedded" => { - "2:string" => plid, - "3:string" => data_wrapper, + "2:string" => plid, + "3:base64" => { + "1:varint" => request_count, + "15:string" => "PT:#{data}", + "104:embedded" => {"1:0:varint" => 0_i64}, + }, "35:string" => id, }, } @@ -347,7 +345,7 @@ def fetch_playlist(plid, locale) playlist_info = playlist_sidebar_renderer[0]["playlistSidebarPrimaryInfoRenderer"]? raise InfoException.new("Could not extract playlist info") if !playlist_info - title = playlist_info["title"]?.try &.["runs"][0]?.try &.["text"]?.try &.as_s || "" + title = playlist_info.dig?("title", "runs", 0, "text").try &.as_s || "" desc_item = playlist_info["description"]? diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 6c89b445..499ed94d 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -945,7 +945,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ # Description description_html = video_secondary_renderer.try &.dig?("description", "runs") - .try &.as_a.try { |t| content_to_comment_html(t).gsub("\n", "
") } + .try &.as_a.try { |t| content_to_comment_html(t) } params["descriptionHtml"] = JSON::Any.new(description_html || "

") diff --git a/src/invidious/views/components/search_box.ecr b/src/invidious/views/components/search_box.ecr new file mode 100644 index 00000000..4144d161 --- /dev/null +++ b/src/invidious/views/components/search_box.ecr @@ -0,0 +1,9 @@ +
+
+ " + title="<%= translate(locale, "search") %>" + value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>"> +
+
diff --git a/src/invidious/views/playlist.ecr b/src/invidious/views/playlist.ecr index 7825b1f0..b720bbc2 100644 --- a/src/invidious/views/playlist.ecr +++ b/src/invidious/views/playlist.ecr @@ -74,9 +74,7 @@
-
-

<%= playlist.description_html %>

-
+
<%= playlist.description_html %>
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %> diff --git a/src/invidious/views/search_homepage.ecr b/src/invidious/views/search_homepage.ecr index 7d2dab83..45561d1e 100644 --- a/src/invidious/views/search_homepage.ecr +++ b/src/invidious/views/search_homepage.ecr @@ -14,11 +14,7 @@
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 5b6e6ab8..efa434bf 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -35,11 +35,7 @@ Invidious <% end %> diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index fa4fe083..363f1262 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -140,7 +140,7 @@ we're going to need to do it here in order to allow for translations. <% if user %> <% playlists = Invidious::Database::Playlists.select_user_created_playlists(user.email) %> <% if !playlists.empty? %> -
+
+ "> + + @@ -254,14 +257,10 @@ we're going to need to do it here in order to allow for translations.
<% if video.description.size < 200 || params.extend_desc %> -
- <%= video.description_html %> -
+
<%= video.description_html %>
<% else %> -
- <%= video.description_html %> -
+
<%= video.description_html %>