mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Fix storyboards
This commit is contained in:
parent
138f38aade
commit
9a8b81fcbe
2 changed files with 9 additions and 10 deletions
|
@ -3661,7 +3661,10 @@ get "/api/v1/storyboards/:id" do |env|
|
||||||
end_time = storyboard[:interval].milliseconds
|
end_time = storyboard[:interval].milliseconds
|
||||||
|
|
||||||
storyboard[:storyboard_count].times do |i|
|
storyboard[:storyboard_count].times do |i|
|
||||||
url = storyboard[:url].gsub("$M", i).gsub("https://i9.ytimg.com", HOST_URL)
|
url = storyboard[:url]
|
||||||
|
authority = /(i\d?).ytimg.com/.match(url).not_nil![1]?
|
||||||
|
url = storyboard[:url].gsub("$M", i).gsub(%r(https://i\d?.ytimg.com/sb/), "")
|
||||||
|
url = "#{HOST_URL}/sb/#{authority}/#{url}"
|
||||||
|
|
||||||
storyboard[:storyboard_height].times do |j|
|
storyboard[:storyboard_height].times do |j|
|
||||||
storyboard[:storyboard_width].times do |k|
|
storyboard[:storyboard_width].times do |k|
|
||||||
|
@ -5527,14 +5530,14 @@ get "/ggpht/*" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
options "/sb/:id/:storyboard/:index" do |env|
|
options "/sb/:authority/:id/:storyboard/:index" do |env|
|
||||||
env.response.headers.delete("Content-Type")
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
env.response.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS"
|
env.response.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS"
|
||||||
env.response.headers["Access-Control-Allow-Headers"] = "Content-Type, Range"
|
env.response.headers["Access-Control-Allow-Headers"] = "Content-Type, Range"
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/sb/:id/:storyboard/:index" do |env|
|
get "/sb/:authority/:id/:storyboard/:index" do |env|
|
||||||
|
authority = env.params.url["authority"]
|
||||||
id = env.params.url["id"]
|
id = env.params.url["id"]
|
||||||
storyboard = env.params.url["storyboard"]
|
storyboard = env.params.url["storyboard"]
|
||||||
index = env.params.url["index"]
|
index = env.params.url["index"]
|
||||||
|
@ -5543,11 +5546,7 @@ get "/sb/:id/:storyboard/:index" do |env|
|
||||||
|
|
||||||
headers = HTTP::Headers.new
|
headers = HTTP::Headers.new
|
||||||
|
|
||||||
if storyboard.starts_with? "storyboard_live"
|
headers[":authority"] = "#{authority}.ytimg.com"
|
||||||
headers[":authority"] = "i.ytimg.com"
|
|
||||||
else
|
|
||||||
headers[":authority"] = "i9.ytimg.com"
|
|
||||||
end
|
|
||||||
|
|
||||||
REQUEST_HEADERS_WHITELIST.each do |header|
|
REQUEST_HEADERS_WHITELIST.each do |header|
|
||||||
if env.request.headers[header]?
|
if env.request.headers[header]?
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Kemal::ExceptionHandler
|
||||||
end
|
end
|
||||||
|
|
||||||
class FilteredCompressHandler < Kemal::Handler
|
class FilteredCompressHandler < Kemal::Handler
|
||||||
exclude ["/videoplayback", "/videoplayback/*", "/vi/*", "/ggpht/*", "/api/v1/auth/notifications"]
|
exclude ["/videoplayback", "/videoplayback/*", "/vi/*", "/sb/*", "/ggpht/*", "/api/v1/auth/notifications"]
|
||||||
exclude ["/api/v1/auth/notifications", "/data_control"], "POST"
|
exclude ["/api/v1/auth/notifications", "/data_control"], "POST"
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
|
|
Loading…
Reference in a new issue