|
|
@ -37,8 +37,13 @@ class Invidious::Routes::Misc < Invidious::Routes::BaseRoute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def cross_instance_redirect(env)
|
|
|
|
def cross_instance_redirect(env)
|
|
|
|
id = env.params.query["id"]
|
|
|
|
|
|
|
|
instance_url = fetch_random_instance
|
|
|
|
instance_url = fetch_random_instance
|
|
|
|
|
|
|
|
if env.params.query["id"]?
|
|
|
|
|
|
|
|
id = env.params.query["id"]
|
|
|
|
env.redirect "https://#{instance_url}/watch?v=#{id}"
|
|
|
|
env.redirect "https://#{instance_url}/watch?v=#{id}"
|
|
|
|
|
|
|
|
elsif env.params.query["q"]?
|
|
|
|
|
|
|
|
query, page = env.params.query["q"], env.params.query["page"]
|
|
|
|
|
|
|
|
env.redirect "https://#{instance_url}/search?q=#{query}&page=#{page}"
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|