From 0dcbc17552e4f99692ad9daa793b78909e497b32 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Thu, 24 Oct 2019 14:40:41 +0000 Subject: [groups] Add first implementation of the new config path ui --- server/api/configloader.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'server/api') diff --git a/server/api/configloader.js b/server/api/configloader.js index 4059e5b..f6c4597 100644 --- a/server/api/configloader.js +++ b/server/api/configloader.js @@ -9,8 +9,21 @@ const url = config.https.host + ':' + config.https.port const configHelper = require(path.join(__appdir, 'lib', 'confighelper')) -// if client in db -> load script (default if none is found), else load registration script -noAuthRouter.getAsync('/test/:uuid', async (req, res) => { + +noAuthRouter.getAsync(['/test/group/:id', '/test/group/'], async (req, res) => { + const list = req.query.list !== undefined && req.query.list !== 'false' + const config = await configHelper.getGroupConfig(req.params.id, list) + if (!config) return res.status(404).end() + if (!list) { + res.set('Content-Type', 'text/plain') + res.send(config.script) + } else { + res.send(config) + } +}) + + +noAuthRouter.getAsync(['/test/:uuid', '/test/'], async (req, res) => { const list = req.query.list !== undefined && req.query.list !== 'false' const config = await configHelper.getConfig(req.params.uuid, list) if (!list) { @@ -21,6 +34,7 @@ noAuthRouter.getAsync('/test/:uuid', async (req, res) => { } }) + // if client in db -> load script (default if none is found), else load registration script noAuthRouter.getAsync('/:uuid', async (req, res) => { const uuid = req.params.uuid -- cgit v1.2.3-55-g7522