Switch routing logic to use modules (#2298)

* Switch routing logic to use modules
* Add more macros for adding routes of different HTTP methods
This commit is contained in:
syeopite
2021-08-11 03:36:25 -07:00
committed by GitHub
parent 637a5cc14f
commit 7afa027b95
10 changed files with 52 additions and 58 deletions

View File

@@ -1,5 +1,5 @@
class Invidious::Routes::Watch < Invidious::Routes::BaseRoute
def handle(env)
module Invidious::Routes::Watch
def self.handle(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
region = env.params.query["region"]?
@@ -190,7 +190,7 @@ class Invidious::Routes::Watch < Invidious::Routes::BaseRoute
templated "watch"
end
def redirect(env)
def self.redirect(env)
url = "/watch?v=#{env.params.url["id"]}"
if env.params.query.size > 0
url += "&#{env.params.query}"