From ddd931573a45aa9d72e30c36aa6c79e5d05a092a Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 21 Aug 2023 00:18:23 -0700 Subject: [PATCH] Fetch chapter thumbnails for selector in desc --- src/invidious/routes/images.cr | 12 +++++++++++- .../views/components/description_chapters_widget.ecr | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/images.cr b/src/invidious/routes/images.cr index b6a2e110..b26e37d9 100644 --- a/src/invidious/routes/images.cr +++ b/src/invidious/routes/images.cr @@ -160,6 +160,16 @@ module Invidious::Routes::Images id = env.params.url["id"] name = env.params.url["name"] + # Sometimes required to fetch image. IE for chapter thumbnails + query_params = HTTP::Params.new + if sqp = env.params.query["sqp"]? + query_params["sqp"] = sqp + end + + if rs = env.params.query["rs"]? + query_params["rs"] = rs + end + headers = HTTP::Headers.new if name == "maxres.jpg" @@ -173,7 +183,7 @@ module Invidious::Routes::Images end end - url = "/vi/#{id}/#{name}" + url = "/vi/#{id}/#{name}?#{query_params}" REQUEST_HEADERS_WHITELIST.each do |header| if env.request.headers[header]? diff --git a/src/invidious/views/components/description_chapters_widget.ecr b/src/invidious/views/components/description_chapters_widget.ecr index e5ecdb99..3c9d67ff 100644 --- a/src/invidious/views/components/description_chapters_widget.ecr +++ b/src/invidious/views/components/description_chapters_widget.ecr @@ -10,7 +10,7 @@
<% if !env.get("preferences").as(Preferences).thin_mode %> - + " alt="" /> <%- else -%>
<%- end -%>