Compare commits

...

2 commits

Author SHA1 Message Date
4a8fffac26
fix(hls): revert changes made on fb3ecdad9a
All checks were successful
Invidious CI / build (push) Successful in 4m49s
2025-01-01 02:17:33 -03:00
ebd89acf79
fix(hls): add missing scheme to m3u8 list 2025-01-01 02:16:40 -03:00

View file

@ -186,9 +186,8 @@ module Invidious::Routes::API::Manifest
manifest = response.body
if local
manifest = manifest.gsub(/^https:\/\/[^\n"]*/m) do |match|
uri = URI.parse(match)
path = uri.path
manifest = manifest.gsub(/^https:\/\/\w+---.{11}\.c\.youtube\.com[^\n]*/m) do |match|
path = URI.parse(match).path
path = path.lchop("/videoplayback/")
path = path.rchop("/")
@ -217,14 +216,20 @@ module Invidious::Routes::API::Manifest
raw_params["fvip"] = fvip["fvip"]
end
raw_params["host"] = uri.host.not_nil!
raw_params["local"] = "true"
proxy = Invidious::HttpServer::Utils.get_external_proxy
if !proxy.empty?
"#{proxy}/videoplayback?#{raw_params}"
if CONFIG.https_only
scheme = "https://"
else
"#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
scheme = "http://"
end
if !proxy.empty?
"#{scheme}#{proxy}/videoplayback?#{raw_params}"
else
"#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
end
end
end
@ -248,7 +253,12 @@ module Invidious::Routes::API::Manifest
manifest = response.body
if local
manifest = manifest.gsub("https://www.youtube.com", env.request.headers["Host"])
if CONFIG.https_only
scheme = "https://"
else
scheme = "http://"
end
manifest = manifest.gsub("https://www.youtube.com", "#{scheme}#{env.request.headers["Host"]}")
manifest = manifest.gsub("index.m3u8", "index.m3u8?local=true")
end