Fetch chapter thumbnails for selector in desc

This commit is contained in:
syeopite 2023-08-21 00:18:23 -07:00
parent 48ba6373df
commit ddd931573a
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
2 changed files with 12 additions and 2 deletions

View File

@ -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]?

View File

@ -10,7 +10,7 @@
<a href="/watch?v=<%= video.id %>&t=<%=chapter.start_ms.milliseconds.total_seconds %>">
<div class="thumbnail">
<% if !env.get("preferences").as(Preferences).thin_mode %>
<img loading="lazy" class="thumbnail" src="/vi/" alt="" />
<img loading="lazy" class="thumbnail" src="<%=URI.parse(chapter.thumbnails[-1]["url"].to_s).request_target %>" alt="" />
<%- else -%>
<div class="thumbnail-placeholder"></div>
<%- end -%>