mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add workaround for crystal 1.0.0
This commit is contained in:
parent
ad043a75f1
commit
36b837c927
1 changed files with 11 additions and 4 deletions
|
@ -1,9 +1,11 @@
|
||||||
require "lsquic"
|
require "lsquic"
|
||||||
require "db"
|
require "db"
|
||||||
|
|
||||||
# Alias of DB::Pool for easier debugging
|
{% unless Crystal::VERSION == "1.0.0" %}
|
||||||
class YTPool(T) < DB::Pool(T)
|
# Alias of DB::Pool for easier debugging
|
||||||
end
|
class YTPool(T) < DB::Pool(T)
|
||||||
|
end
|
||||||
|
{% end %}
|
||||||
|
|
||||||
def add_yt_headers(request)
|
def add_yt_headers(request)
|
||||||
request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
|
request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
|
||||||
|
@ -24,7 +26,12 @@ struct YoutubeConnectionPool
|
||||||
property! url : URI
|
property! url : URI
|
||||||
property! capacity : Int32
|
property! capacity : Int32
|
||||||
property! timeout : Float64
|
property! timeout : Float64
|
||||||
property pool : YTPool(QUIC::Client | HTTP::Client)
|
|
||||||
|
{% unless Crystal::VERSION == "1.0.0" %}
|
||||||
|
property pool : YTPool(QUIC::Client | HTTP::Client)
|
||||||
|
{% else %}
|
||||||
|
property pool : DB::Pool(QUIC::Client | HTTP::Client)
|
||||||
|
{% end %}
|
||||||
|
|
||||||
def initialize(url : URI,
|
def initialize(url : URI,
|
||||||
@initial_pool_size = 1,
|
@initial_pool_size = 1,
|
||||||
|
|
Loading…
Reference in a new issue