liquid_feedback_frontend
view env/request/router.lua @ 1613:10fdd6713adb
Removed space left of admission info box
author | bsw |
---|---|
date | Mon Feb 01 21:49:51 2021 +0100 (2021-02-01) |
parents | 45fd259aa1ad |
children | bbb537ba81b2 |
line source
1 local api_endpoints = {
2 instance = true,
3 navigation = true,
4 style = true,
5 application = true,
6 info = true,
7 member = true,
8 notify_email = true,
9 profile_info = true,
10 profile = true,
11 settings_info = true,
12 settings = true,
13 event = true,
14 support = true,
15 embed_initiative = true,
16 login = true
17 }
19 function request.router()
21 local api_prefix = "api/1/"
23 local path = request.get_path()
25 if path == api_prefix .. "register" then
26 return { module = "oauth2", view = "register" }
27 elseif path == api_prefix .. "authorization" then
28 return { module = "oauth2", view = "authorization" }
29 elseif path == api_prefix .. "token" then
30 return { module = "oauth2", view = "token" }
31 elseif path == api_prefix .. "validate" then
32 return { module = "oauth2", view = "validate" }
33 elseif path == api_prefix .. "session" then
34 return { module = "oauth2", view = "session" }
35 else
36 local endpoint = string.match(path, "^" .. api_prefix .. "(.*)$")
37 if api_endpoints[endpoint] then
38 return { module = "api", view = endpoint }
39 end
40 end
42 return request.default_router(path)
44 end