diff --git a/nodejs/models/hosts.js b/nodejs/models/hosts.js index 7eb18f2..9477d12 100755 --- a/nodejs/models/hosts.js +++ b/nodejs/models/hosts.js @@ -25,7 +25,10 @@ async function add(data){ await client.SADD('hosts', data.host); await client.HSET('host_' + data.host, 'ip', data.ip); await client.HSET('host_' + data.host, 'updated', (new Date).getTime()); - await client.HSET('host_' + data.host, 'username', data.username); + await client.HSET('host_' + data.host, 'username', data.username); + if(data.forceSSL !== undefined){ + await client.HSET('host_' + data.host, 'force_ssl', !!data.forceSSL); + } } catch (error){ return new Error(error); diff --git a/nodejs/routes/routes.js b/nodejs/routes/routes.js index 74649c4..2ee23a8 100755 --- a/nodejs/routes/routes.js +++ b/nodejs/routes/routes.js @@ -35,7 +35,10 @@ router.post('/', async function(req, res){ } try{ - Host.add({host, ip, username: req.user.username}); + await Host.add({host, ip, + username: req.user.username, + forceSSL: req.body.forceSSL + }); return res.json({ message: `Host ${host} Added`