Add route to redirect to another instance

pull/1940/head
syeopite 4 years ago
parent 5b47438b71
commit 31fa3dfd59
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82

@ -314,6 +314,7 @@ Invidious::Routing.get "/shorts/:id", Invidious::Routes::Watch, :redirect
Invidious::Routing.get "/w/:id", Invidious::Routes::Watch, :redirect Invidious::Routing.get "/w/:id", Invidious::Routes::Watch, :redirect
Invidious::Routing.get "/v/:id", Invidious::Routes::Watch, :redirect Invidious::Routing.get "/v/:id", Invidious::Routes::Watch, :redirect
Invidious::Routing.get "/e/:id", Invidious::Routes::Watch, :redirect Invidious::Routing.get "/e/:id", Invidious::Routes::Watch, :redirect
Invidious::Routing.get "/redirect", Invidious::Routes::Misc, :cross_instance_redirect
Invidious::Routing.get "/embed/", Invidious::Routes::Embed, :redirect Invidious::Routing.get "/embed/", Invidious::Routes::Embed, :redirect
Invidious::Routing.get "/embed/:id", Invidious::Routes::Embed, :show Invidious::Routing.get "/embed/:id", Invidious::Routes::Embed, :show

@ -35,4 +35,10 @@ class Invidious::Routes::Misc < Invidious::Routes::BaseRoute
locale = LOCALES[env.get("preferences").as(Preferences).locale]? locale = LOCALES[env.get("preferences").as(Preferences).locale]?
rendered "licenses" rendered "licenses"
end end
def cross_instance_redirect(env)
id = env.params.query["id"]
instance_url = fetch_random_instance
env.redirect "https://#{instance_url}/watch?v=#{id}"
end
end end

Loading…
Cancel
Save