diff --git a/routes/start.js b/routes/start.js index a0c3f30..8fa088f 100644 --- a/routes/start.js +++ b/routes/start.js @@ -5,16 +5,21 @@ var docker = require('../bin/dockerode'); router.get('/:id', (req, res, next) => { - getContainer(id).then(data => { - res.send(data); - }); + if (req.params.id.startsWith("mc") == true) { + startContainer(req.params.id).then(data => { + res.send(data); + }); + } + else { + res.send("not whitelisted"); + } }); -function getContainer(containername) { +function startContainer(containername) { return new Promise((resolve, reject) => { const container = docker.getContainer(containername); - container.inspect((err, data) => { + container.start((err, data) => { resolve({ err, data }); }); }) diff --git a/routes/status.js b/routes/status.js index a0c3f30..fc73041 100644 --- a/routes/status.js +++ b/routes/status.js @@ -5,9 +5,14 @@ var docker = require('../bin/dockerode'); router.get('/:id', (req, res, next) => { - getContainer(id).then(data => { - res.send(data); - }); + if (req.params.id.startsWith("mc") == true) { + getContainer(req.params.id).then(data => { + res.send(data); + }); + } + else { + res.send("not whitelisted"); + } });