mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Fix truncated thumbnails
This commit is contained in:
parent
6cb834a18d
commit
83ba4e2a4c
2 changed files with 5 additions and 6 deletions
|
@ -3011,7 +3011,6 @@ get "/vi/:id/:name" do |env|
|
||||||
|
|
||||||
client.get(url, headers) do |response|
|
client.get(url, headers) do |response|
|
||||||
env.response.status_code = response.status_code
|
env.response.status_code = response.status_code
|
||||||
puts response.headers.inspect
|
|
||||||
response.headers.each do |key, value|
|
response.headers.each do |key, value|
|
||||||
env.response.headers[key] = value
|
env.response.headers[key] = value
|
||||||
end
|
end
|
||||||
|
@ -3021,23 +3020,23 @@ get "/vi/:id/:name" do |env|
|
||||||
end
|
end
|
||||||
|
|
||||||
chunk_size = 4096
|
chunk_size = 4096
|
||||||
size = chunk_size
|
size = 1
|
||||||
if response.headers.includes_word?("Content-Encoding", "gzip")
|
if response.headers.includes_word?("Content-Encoding", "gzip")
|
||||||
Gzip::Writer.open(env.response) do |deflate|
|
Gzip::Writer.open(env.response) do |deflate|
|
||||||
until size < chunk_size
|
until size == 0
|
||||||
size = IO.copy(response.body_io, deflate)
|
size = IO.copy(response.body_io, deflate)
|
||||||
env.response.flush
|
env.response.flush
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif response.headers.includes_word?("Content-Encoding", "deflate")
|
elsif response.headers.includes_word?("Content-Encoding", "deflate")
|
||||||
Flate::Writer.open(env.response) do |deflate|
|
Flate::Writer.open(env.response) do |deflate|
|
||||||
until size < chunk_size
|
until size == 0
|
||||||
size = IO.copy(response.body_io, deflate)
|
size = IO.copy(response.body_io, deflate)
|
||||||
env.response.flush
|
env.response.flush
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
until size < chunk_size
|
until size == 0
|
||||||
size = IO.copy(response.body_io, env.response, chunk_size)
|
size = IO.copy(response.body_io, env.response, chunk_size)
|
||||||
env.response.flush
|
env.response.flush
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Config
|
||||||
end
|
end
|
||||||
|
|
||||||
class FilteredCompressHandler < Kemal::Handler
|
class FilteredCompressHandler < Kemal::Handler
|
||||||
exclude ["/videoplayback", "/videoplayback/*", "/api/*"]
|
exclude ["/videoplayback", "/videoplayback/*", "/vi/*", "/api/*"]
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
return call_next env if exclude_match? env
|
return call_next env if exclude_match? env
|
||||||
|
|
Loading…
Reference in a new issue