External Proxies: Proxyfi HD720
This commit is contained in:
parent
41977eb7c1
commit
9d71ce050a
3 changed files with 15 additions and 2 deletions
|
@ -21,6 +21,10 @@ module Invidious::HttpServer
|
|||
end
|
||||
end
|
||||
|
||||
def get_external_proxy
|
||||
return @@proxy_alive
|
||||
end
|
||||
|
||||
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
||||
url = URI.parse(raw_url)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ module Invidious::Routes::BeforeAll
|
|||
"font-src 'self' data:",
|
||||
"connect-src 'self'" + EXT_VIDEOP_LIST,
|
||||
"manifest-src 'self'",
|
||||
"media-src 'self' blob:" + extra_media_csp,
|
||||
"media-src 'self' blob:" + extra_media_csp + EXT_VIDEOP_LIST,
|
||||
"child-src 'self' blob:",
|
||||
"frame-src 'self'",
|
||||
"frame-ancestors " + frame_ancestors,
|
||||
|
|
|
@ -298,7 +298,16 @@ module Invidious::Routes::VideoPlayback
|
|||
end
|
||||
|
||||
if local
|
||||
url = URI.parse(url).request_target.not_nil!
|
||||
external_proxy = Invidious::HttpServer::Utils.get_external_proxy
|
||||
if !external_proxy.empty?
|
||||
url = URI.parse(url)
|
||||
external_proxy = URI.parse(external_proxy)
|
||||
url.host = external_proxy.host
|
||||
url.port = external_proxy.port
|
||||
url = url.to_s
|
||||
else
|
||||
url = URI.parse(url).request_target.not_nil!
|
||||
end
|
||||
url += "&title=#{URI.encode_www_form(title, space_to_plus: false)}" if title
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue