fix(hls): add missing scheme to m3u8 list

This commit is contained in:
Fijxu 2025-01-01 02:16:40 -03:00
parent 3bb7924181
commit ebd89acf79
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -221,10 +221,16 @@ module Invidious::Routes::API::Manifest
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 +254,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