liquid_feedback_frontend

view env/request/router.lua @ 1635:bbb537ba81b2

Added new API endpoint avatar
author bsw
date Mon Feb 08 16:26:21 2021 +0100 (2021-02-08)
parents 45fd259aa1ad
children 09f275c1f606
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 avatar = true,
9 notify_email = true,
10 profile_info = true,
11 profile = true,
12 settings_info = true,
13 settings = true,
14 event = true,
15 support = true,
16 embed_initiative = true,
17 login = true
18 }
20 function request.router()
22 local api_prefix = "api/1/"
24 local path = request.get_path()
26 if path == api_prefix .. "register" then
27 return { module = "oauth2", view = "register" }
28 elseif path == api_prefix .. "authorization" then
29 return { module = "oauth2", view = "authorization" }
30 elseif path == api_prefix .. "token" then
31 return { module = "oauth2", view = "token" }
32 elseif path == api_prefix .. "validate" then
33 return { module = "oauth2", view = "validate" }
34 elseif path == api_prefix .. "session" then
35 return { module = "oauth2", view = "session" }
36 else
37 local endpoint = string.match(path, "^" .. api_prefix .. "(.*)$")
38 if api_endpoints[endpoint] then
39 return { module = "api", view = endpoint }
40 end
41 end
43 return request.default_router(path)
45 end

Impressum / About Us