liquid_feedback_frontend

view env/request/router.lua @ 1498:50f5b8a97f91

Added support for embedding initiatives
author bsw
date Tue Mar 24 16:48:20 2020 +0100 (2020-03-24)
parents 32cc544d5a5b
children 71f54c43d7cb
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 embed_initiative = true
15 }
17 function request.router()
19 local api_prefix = "api/1/"
21 local path = request.get_path()
23 if path == api_prefix .. "register" then
24 return { module = "oauth2", view = "register" }
25 elseif path == api_prefix .. "authorization" then
26 return { module = "oauth2", view = "authorization" }
27 elseif path == api_prefix .. "token" then
28 return { module = "oauth2", view = "token" }
29 elseif path == api_prefix .. "validate" then
30 return { module = "oauth2", view = "validate" }
31 elseif path == api_prefix .. "session" then
32 return { module = "oauth2", view = "session" }
33 else
34 local endpoint = string.match(path, "^" .. api_prefix .. "(.*)$")
35 if api_endpoints[endpoint] then
36 return { module = "api", view = endpoint }
37 end
38 end
40 return request.default_router(path)
42 end

Impressum / About Us