mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-30 02:32:56 +05:30
Add redirect for local DASH urls
This commit is contained in:
parent
ce506d3928
commit
a3a826e52c
@ -2535,6 +2535,15 @@ get "/api/v1/search" do |env|
|
|||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/api/manifest/dash/id/videoplayback" do |env|
|
||||||
|
env.redirect "/videoplayback?#{env.params.query}"
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/api/manifest/dash/id/videoplayback/*" do |env|
|
||||||
|
puts env.request.path
|
||||||
|
env.redirect env.request.path.lchop("/api/manifest/dash/id")
|
||||||
|
end
|
||||||
|
|
||||||
get "/api/manifest/dash/id/:id" do |env|
|
get "/api/manifest/dash/id/:id" do |env|
|
||||||
env.response.headers.add("Access-Control-Allow-Origin", "*")
|
env.response.headers.add("Access-Control-Allow-Origin", "*")
|
||||||
env.response.content_type = "application/dash+xml"
|
env.response.content_type = "application/dash+xml"
|
||||||
@ -2557,12 +2566,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
url = url.rchop("</BaseURL>")
|
url = url.rchop("</BaseURL>")
|
||||||
|
|
||||||
if local
|
if local
|
||||||
if Kemal.config.ssl || CONFIG.https_only
|
url = URI.parse(url).full_path
|
||||||
scheme = "https://"
|
|
||||||
end
|
|
||||||
scheme ||= "http://"
|
|
||||||
|
|
||||||
url = scheme + env.request.headers["Host"] + URI.parse(url).full_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
"<BaseURL>#{url}</BaseURL>"
|
"<BaseURL>#{url}</BaseURL>"
|
||||||
@ -2575,13 +2579,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
|
|
||||||
if local
|
if local
|
||||||
adaptive_fmts.each do |fmt|
|
adaptive_fmts.each do |fmt|
|
||||||
if Kemal.config.ssl || CONFIG.https_only
|
fmt["url"] = URI.parse(fmt["url"]).full_path
|
||||||
scheme = "https://"
|
|
||||||
else
|
|
||||||
scheme = "http://"
|
|
||||||
end
|
|
||||||
|
|
||||||
fmt["url"] = scheme + env.request.headers["Host"] + URI.parse(fmt["url"]).full_path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user