liquid_feedback_frontend
diff app/main/api/application.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
author | bsw/jbe |
---|---|
date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
parents | |
children | fa82e72afdfe |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/api/application.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -0,0 +1,40 @@ 1.4 +slot.set_layout(nil, "application/json") 1.5 + 1.6 +local r = json.array() 1.7 + 1.8 +local system_applications = SystemApplication:get_all() 1.9 + 1.10 +r[#r+1] = json.object{ 1.11 + type = "system", 1.12 + name = "LiquidFeedback", 1.13 + base_url = request.get_absolute_baseurl(), 1.14 + manifest_url = request.get_absolute_baseurl() .. "api/1/info", 1.15 + cert_common_name = config.oauth2.cert_common_name 1.16 +} 1.17 + 1.18 +for i, system_application in ipairs(system_applications) do 1.19 + r[#r+1] = json.object{ 1.20 + type = "system", 1.21 + name = system_application.name, 1.22 + base_url = system_application.base_url, 1.23 + manifest_url = system_application.manifest_url, 1.24 + cert_common_name = system_application.cert_common_name 1.25 + } 1.26 +end 1.27 + 1.28 +if app.access_token then 1.29 + 1.30 + local member_applications = MemberApplication:by_member_id_with_domain(app.access_token.member_id) 1.31 + 1.32 + for i, member_application in ipairs(member_applications) do 1.33 + r[#r+1] = json.object{ 1.34 + type = "dynamic", 1.35 + name = "https://" .. member_application.domain .. "/", 1.36 + base_url = "https://" .. member_application.domain .. "/", 1.37 + manifest_url = "https://" .. member_application.domain .. "/" .. config.oauth2.manifest_magic 1.38 + } 1.39 + end 1.40 + 1.41 +end 1.42 + 1.43 +slot.put_into("data", json.export(json.object{ result = r }))