forked from Fijxu/invidious
External Proxies: Proxyfi HD720
This commit is contained in:
parent
917cede8b7
commit
6587528ed9
3 changed files with 15 additions and 2 deletions
|
@ -21,6 +21,10 @@ module Invidious::HttpServer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_external_proxy
|
||||||
|
return @@proxy_alive
|
||||||
|
end
|
||||||
|
|
||||||
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
||||||
url = URI.parse(raw_url)
|
url = URI.parse(raw_url)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ module Invidious::Routes::BeforeAll
|
||||||
"font-src 'self' data:",
|
"font-src 'self' data:",
|
||||||
"connect-src 'self'" + EXT_VIDEOP_LIST,
|
"connect-src 'self'" + EXT_VIDEOP_LIST,
|
||||||
"manifest-src 'self'",
|
"manifest-src 'self'",
|
||||||
"media-src 'self' blob:" + extra_media_csp,
|
"media-src 'self' blob:" + extra_media_csp + EXT_VIDEOP_LIST,
|
||||||
"child-src 'self' blob:",
|
"child-src 'self' blob:",
|
||||||
"frame-src 'self'",
|
"frame-src 'self'",
|
||||||
"frame-ancestors " + frame_ancestors,
|
"frame-ancestors " + frame_ancestors,
|
||||||
|
|
|
@ -298,7 +298,16 @@ module Invidious::Routes::VideoPlayback
|
||||||
end
|
end
|
||||||
|
|
||||||
if local
|
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
|
url += "&title=#{URI.encode_www_form(title, space_to_plus: false)}" if title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue