From cf9931e2a1752455a55ff3e6b4063a66d089d26f Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 3 Mar 2018 18:18:03 -0600 Subject: [PATCH] Add support for redirect in URL description --- src/invidious.cr | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/invidious.cr b/src/invidious.cr index dbd21adf..943259f2 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -334,6 +334,14 @@ get "/search" do |env| templated "search" end +get "/redirect" do |env| + if env.params.query["q"]? + env.redirect env.params.query["q"] + else + env.redirect "/" + end +end + error 404 do |env| error_message = "404 Page not found" templated "error"