Use HTTP::Client directly in instance list job

The HTTP::Client created via `make_client` is affected by the
force_resolve configuration option. However, api.invidious.io
does not support ipv6 and as such any request with ipv6 to
api.invidious.io will instead raise.

Directly calling the HTTP::Client will ignore the force_resolve option
allowing requests to go through ipv4 when needed.
pull/4193/head
syeopite 2023-12-07 11:21:06 -08:00
rodzic cff25a7b25
commit 41c978d350
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A73C186DA3955A1A
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -58,7 +58,10 @@ class Invidious::Jobs::InstanceListRefreshJob < Invidious::Jobs::BaseJob
# Fetches information regarding instances from api.invidious.io or an otherwise configured URL
private def fetch_instances : Array(JSON::Any)
begin
instance_api_client = make_client(URI.parse("https://api.invidious.io"))
# We directly call the stdlib HTTP::Client here as it allows us to negate the effects
# of the force_resolve config option. This is needed as api.invidious.io does not support ipv6
# and as such the following request raises if we were to use force_resolve with the ipv6 value.
instance_api_client = HTTP::Client.new(URI.parse("https://api.invidious.io"))
# Timeouts
instance_api_client.connect_timeout = 10.seconds