mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Add shortened video redirect
This commit is contained in:
parent
829ffdd466
commit
ab4b533183
1 changed files with 16 additions and 4 deletions
|
@ -2296,10 +2296,22 @@ get "/videoplayback*" do |env|
|
|||
end
|
||||
end
|
||||
|
||||
# get "/:id" do |env|
|
||||
# id = env.params.url["id"]
|
||||
# env.redirect "/watch?v=#{id}"
|
||||
# end
|
||||
get "/:id" do |env|
|
||||
id = env.params.url["id"]
|
||||
|
||||
params = [] of String
|
||||
env.params.query.each do |k, v|
|
||||
params << "#{k}=#{v}"
|
||||
end
|
||||
params = params.join("&")
|
||||
|
||||
url = "/watch?v=#{id}"
|
||||
if params
|
||||
url += "&#{params}"
|
||||
end
|
||||
|
||||
env.redirect url
|
||||
end
|
||||
|
||||
error 404 do |env|
|
||||
error_message = "404 Page not found"
|
||||
|
|
Loading…
Reference in a new issue