mirror of https://github.com/iv-org/invidious.git
Fetch chapter thumbnails for selector in desc
This commit is contained in:
parent
48ba6373df
commit
ddd931573a
|
@ -160,6 +160,16 @@ module Invidious::Routes::Images
|
||||||
id = env.params.url["id"]
|
id = env.params.url["id"]
|
||||||
name = env.params.url["name"]
|
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
|
headers = HTTP::Headers.new
|
||||||
|
|
||||||
if name == "maxres.jpg"
|
if name == "maxres.jpg"
|
||||||
|
@ -173,7 +183,7 @@ module Invidious::Routes::Images
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
url = "/vi/#{id}/#{name}"
|
url = "/vi/#{id}/#{name}?#{query_params}"
|
||||||
|
|
||||||
REQUEST_HEADERS_WHITELIST.each do |header|
|
REQUEST_HEADERS_WHITELIST.each do |header|
|
||||||
if env.request.headers[header]?
|
if env.request.headers[header]?
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<a href="/watch?v=<%= video.id %>&t=<%=chapter.start_ms.milliseconds.total_seconds %>">
|
<a href="/watch?v=<%= video.id %>&t=<%=chapter.start_ms.milliseconds.total_seconds %>">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<% if !env.get("preferences").as(Preferences).thin_mode %>
|
<% 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 -%>
|
<%- else -%>
|
||||||
<div class="thumbnail-placeholder"></div>
|
<div class="thumbnail-placeholder"></div>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
Loading…
Reference in New Issue