mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-19 23:25:52 -04:00
Make force_resolve false by default in make_client
This commit is contained in:
parent
815a1c2cc4
commit
583a5fce64
@ -256,13 +256,13 @@ module Invidious::Routes::API::V1::Videos
|
||||
|
||||
file = URI.encode_www_form("#{id[0, 3]}/#{id}.xml")
|
||||
|
||||
location = make_client(ARCHIVE_URL, force_resolve: false, &.get("/download/youtubeannotations_#{index}/#{id[0, 2]}.tar/#{file}"))
|
||||
location = make_client(ARCHIVE_URL, &.get("/download/youtubeannotations_#{index}/#{id[0, 2]}.tar/#{file}"))
|
||||
|
||||
if !location.headers["Location"]?
|
||||
env.response.status_code = location.status_code
|
||||
end
|
||||
|
||||
response = make_client(URI.parse(location.headers["Location"]), force_resolve: false, &.get(location.headers["Location"]))
|
||||
response = make_client(URI.parse(location.headers["Location"]), &.get(location.headers["Location"]))
|
||||
|
||||
if response.body.empty?
|
||||
haltf env, 404
|
||||
|
@ -42,7 +42,7 @@ module Invidious::Routes::VideoPlayback
|
||||
headers["Range"] = "bytes=#{range_for_head}"
|
||||
end
|
||||
|
||||
client = make_client(URI.parse(host), region)
|
||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
||||
response = HTTP::Client::Response.new(500)
|
||||
error = ""
|
||||
5.times do
|
||||
@ -57,7 +57,7 @@ module Invidious::Routes::VideoPlayback
|
||||
if new_host != host
|
||||
host = new_host
|
||||
client.close
|
||||
client = make_client(URI.parse(new_host), region)
|
||||
client = make_client(URI.parse(new_host), region, force_resolve = true)
|
||||
end
|
||||
|
||||
url = "#{location.request_target}&host=#{location.host}#{region ? "®ion=#{region}" : ""}"
|
||||
@ -71,7 +71,7 @@ module Invidious::Routes::VideoPlayback
|
||||
fvip = "3"
|
||||
|
||||
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
||||
client = make_client(URI.parse(host), region)
|
||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
||||
rescue ex
|
||||
error = ex.message
|
||||
end
|
||||
@ -196,7 +196,7 @@ module Invidious::Routes::VideoPlayback
|
||||
break
|
||||
else
|
||||
client.close
|
||||
client = make_client(URI.parse(host), region)
|
||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,7 @@ struct Invidious::User
|
||||
end
|
||||
|
||||
def generate_text(key)
|
||||
response = make_client(TEXTCAPTCHA_URL, force_resolve: false, &.get("/github.com/iv.org/invidious.json").body)
|
||||
response = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body)
|
||||
response = JSON.parse(response)
|
||||
|
||||
tokens = response["a"].as_a.map do |answer|
|
||||
|
@ -26,7 +26,7 @@ struct YoutubeConnectionPool
|
||||
|
||||
def client(region = nil, &block)
|
||||
if region
|
||||
conn = make_client(url, region)
|
||||
conn = make_client(url, region, force_resolve = true)
|
||||
response = yield conn
|
||||
else
|
||||
conn = pool.checkout
|
||||
@ -59,7 +59,7 @@ struct YoutubeConnectionPool
|
||||
end
|
||||
end
|
||||
|
||||
def make_client(url : URI, region = nil, force_resolve : Bool = true)
|
||||
def make_client(url : URI, region = nil, force_resolve : Bool = false)
|
||||
client = HTTPClient.new(url, OpenSSL::SSL::Context::Client.insecure)
|
||||
|
||||
# Some services do not support IPv6.
|
||||
@ -85,7 +85,7 @@ def make_client(url : URI, region = nil, force_resolve : Bool = true)
|
||||
return client
|
||||
end
|
||||
|
||||
def make_client(url : URI, region = nil, force_resolve : Bool = true, &block)
|
||||
def make_client(url : URI, region = nil, force_resolve : Bool = false, &block)
|
||||
client = make_client(url, region, force_resolve)
|
||||
begin
|
||||
yield client
|
||||
|
Loading…
x
Reference in New Issue
Block a user