mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-30 02:32:56 +05:30
Strip '+' from '/watch' and '/embed'
This commit is contained in:
parent
baf4e7984b
commit
32036e7914
@ -175,6 +175,12 @@ get "/:id" do |env|
|
|||||||
end
|
end
|
||||||
|
|
||||||
get "/watch" do |env|
|
get "/watch" do |env|
|
||||||
|
if env.params.query.to_s.includes?("%20") || env.params.query.to_s.includes?("+")
|
||||||
|
puts env.params.query.to_s
|
||||||
|
url = "/watch?" + env.params.query.to_s.gsub("%20", "").delete("+")
|
||||||
|
next env.redirect url
|
||||||
|
end
|
||||||
|
|
||||||
if env.params.query["v"]?
|
if env.params.query["v"]?
|
||||||
id = env.params.query["v"]
|
id = env.params.query["v"]
|
||||||
|
|
||||||
@ -294,9 +300,20 @@ get "/watch" do |env|
|
|||||||
end
|
end
|
||||||
|
|
||||||
get "/embed/:id" do |env|
|
get "/embed/:id" do |env|
|
||||||
if env.params.url["id"]?
|
|
||||||
id = env.params.url["id"]
|
id = env.params.url["id"]
|
||||||
|
|
||||||
|
if id.includes?("%20") || id.includes?("+") || env.params.query.to_s.includes?("%20") || env.params.query.to_s.includes?("+")
|
||||||
|
id = env.params.url["id"].gsub("%20", "").delete("+")
|
||||||
|
|
||||||
|
url = "/embed/#{id}"
|
||||||
|
|
||||||
|
if env.params.query.size > 0
|
||||||
|
url += "?#{env.params.query.to_s.gsub("%20", "").delete("+")}"
|
||||||
|
end
|
||||||
|
|
||||||
|
next env.redirect url
|
||||||
|
end
|
||||||
|
|
||||||
if id.size > 11
|
if id.size > 11
|
||||||
url = "/embed/#{id[0, 11]}"
|
url = "/embed/#{id[0, 11]}"
|
||||||
|
|
||||||
@ -306,9 +323,6 @@ get "/embed/:id" do |env|
|
|||||||
|
|
||||||
next env.redirect url
|
next env.redirect url
|
||||||
end
|
end
|
||||||
else
|
|
||||||
next env.redirect "/"
|
|
||||||
end
|
|
||||||
|
|
||||||
autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay, controls = process_video_params(env.params.query, nil)
|
autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay, controls = process_video_params(env.params.query, nil)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user