Issue #5: Create a public network
This commit is contained in:
parent
4e2fb9c1eb
commit
b49cd75b1d
@ -350,6 +350,28 @@ exports.ipAssignmentPool_delete = async function (req, res) {
|
||||
}
|
||||
}
|
||||
|
||||
// private POST
|
||||
exports.private = async function (req, res) {
|
||||
const nav =
|
||||
{
|
||||
active: 'networks',
|
||||
whence: ''
|
||||
}
|
||||
|
||||
const private =
|
||||
{
|
||||
private: req.body.private
|
||||
};
|
||||
|
||||
try {
|
||||
const network = await zt.network_object(req.params.nwid, private);
|
||||
nav.whence = '/controller/network/' + network.nwid;
|
||||
res.render('private', {title: 'private', nav: nav, network: network});
|
||||
} catch (err) {
|
||||
res.render('private', {title: 'private', nav: nav, error: 'Error applying private for network ' + req.params.nwid + ': ' + err});
|
||||
}
|
||||
}
|
||||
|
||||
// v4AssignMode POST
|
||||
exports.v4AssignMode = async function (req, res) {
|
||||
const nav =
|
||||
|
@ -43,6 +43,9 @@ router.get('/network/:nwid/routes/:target_ip/:target_prefix/delete', restrict, n
|
||||
// POST request for routes
|
||||
router.post('/network/:nwid/routes', restrict, networkController.routes);
|
||||
|
||||
// POST request for private
|
||||
router.post('/network/:nwid/private', restrict, networkController.private);
|
||||
|
||||
// POST request for v4AssignMode
|
||||
router.post('/network/:nwid/v4AssignMode', restrict, networkController.v4AssignMode);
|
||||
|
||||
|
26
src/views/private.pug
Normal file
26
src/views/private.pug
Normal file
@ -0,0 +1,26 @@
|
||||
//-
|
||||
ztncui - ZeroTier network controller UI
|
||||
Copyright (C) 2017-2018 Key Networks (https://key-networks.com)
|
||||
Licensed under GPLv3 - see LICENSE for details.
|
||||
|
||||
extends network_layout
|
||||
|
||||
block net_content
|
||||
script.
|
||||
$(function() {
|
||||
$('.checkbox').on('click', function() {
|
||||
$.post('', {'private': $('#privateCheckBox').is(':checked')});
|
||||
});
|
||||
});
|
||||
|
||||
form(method='POST' action='')
|
||||
table.table.table-responsive.table-striped.table-hover
|
||||
tr
|
||||
td(width='3%')
|
||||
input#privateCheckBox.checkbox(type='checkbox' checked=(network.private? true : false))
|
||||
td Enable access control. Warning: if you disable this, you will not be able to de-authorize members of the network. Disable this only if you know what you are doing.
|
||||
|
||||
if errors
|
||||
ul
|
||||
for err in errors
|
||||
li!= err.msg
|
Loading…
Reference in New Issue
Block a user