liquid_feedback_frontend
view env/request/router.lua @ 1729:ae45894bbf08
Check for member before checking supporter status
| author | bsw | 
|---|---|
| date | Tue Sep 28 15:01:54 2021 +0200 (2021-09-28) | 
| parents | 09f275c1f606 | 
| children | 
 line source
     1 local api_endpoints = {
     2   instance = true,
     3   navigation = true,
     4   style = true,
     5   application = true,
     6   platform_config = true,
     7   info = true,
     8   member = true,
     9   avatar = true,
    10   notify_email = true,
    11   profile_info = true,
    12   profile = true,
    13   settings_info = true,
    14   settings = true,
    15   event = true,
    16   support = true,
    17   embed_initiative = true,
    18   login = true
    19 }
    21 function request.router()
    23   local api_prefix = "api/1/"
    25   local path = request.get_path()
    27   if path == api_prefix .. "register" then
    28     return { module = "oauth2", view = "register" }
    29   elseif path == api_prefix .. "authorization" then
    30     return { module = "oauth2", view = "authorization" }
    31   elseif path == api_prefix .. "token" then
    32     return { module = "oauth2", view = "token" }
    33   elseif path == api_prefix .. "validate" then
    34     return { module = "oauth2", view = "validate" }
    35   elseif path == api_prefix .. "session" then
    36     return { module = "oauth2", view = "session" }
    37   else
    38     local endpoint = string.match(path, "^" .. api_prefix .. "(.*)$")
    39     if api_endpoints[endpoint] then
    40       return { module = "api", view = endpoint }
    41     end
    42   end
    44   return request.default_router(path)
    46 end
