summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-wireguard/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-12-02 10:54:36 +0100
committerGitHub <noreply@github.com>2021-12-02 10:54:36 +0100
commitff4f52983e68244eac8cecee3a10c09b442bdb74 (patch)
tree34f51622c26b64071aa6dd8497b9f3aa182b3a8c /protocols/luci-proto-wireguard/htdocs/luci-static/resources
parent5f98f8cac4ebf7d952d71d44f6a2791c769ab907 (diff)
parentf2445a862eaeb80b70ac9840ff1c399af0de4feb (diff)
Merge pull request #5540 from jow-/wireguard-peer-gridsection
Implement nested grid section support and use it for wireguard peer config
Diffstat (limited to 'protocols/luci-proto-wireguard/htdocs/luci-static/resources')
-rw-r--r--protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
index 74327f3001..50080ca9b6 100644
--- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
+++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
@@ -163,13 +163,15 @@ return network.registerProtocol('wireguard', {
}
catch(e) {}
- o = s.taboption('peers', form.SectionValue, '_peers', form.TypedSection, 'wireguard_%s'.format(s.section));
+ o = s.taboption('peers', form.SectionValue, '_peers', form.GridSection, 'wireguard_%s'.format(s.section));
o.depends('proto', 'wireguard');
ss = o.subsection;
ss.anonymous = true;
ss.addremove = true;
ss.addbtntitle = _('Add peer');
+ ss.nodescriptions = true;
+ ss.modaltitle = _('Edit peer');
ss.renderSectionPlaceholder = function() {
return E([], [
@@ -180,6 +182,7 @@ return network.registerProtocol('wireguard', {
o = ss.option(form.Flag, 'disabled', _('Peer disabled'), _('Enable / Disable peer. Restart wireguard interface to apply changes.'));
o.optional = true;
+ o.editable = true;
o = ss.option(form.Value, 'description', _('Description'), _('Optional. Description of peer.'));
o.placeholder = 'My Peer';
@@ -187,6 +190,7 @@ return network.registerProtocol('wireguard', {
o.optional = true;
o = ss.option(form.Value, 'description', _('QR-Code'));
+ o.modalonly = true;
o.render = L.bind(function (view, section_id) {
var sections = uci.sections('network');
var client = findSection(sections, section_id);
@@ -259,10 +263,12 @@ return network.registerProtocol('wireguard', {
}, this);
o = ss.option(form.Value, 'public_key', _('Public Key'), _('Required. Base64-encoded public key of peer.'));
+ o.modalonly = true;
o.validate = validateBase64;
o.rmempty = false;
o = ss.option(form.Value, 'preshared_key', _('Preshared Key'), _('Optional. Base64-encoded preshared key. Adds in an additional layer of symmetric-key cryptography for post-quantum resistance.'));
+ o.modalonly = true;
o.password = true;
o.validate = validateBase64;
o.optional = true;
@@ -272,6 +278,7 @@ return network.registerProtocol('wireguard', {
o.optional = true;
o = ss.option(form.Flag, 'route_allowed_ips', _('Route Allowed IPs'), _('Optional. Create routes for Allowed IPs for this peer.'));
+ o.modalonly = true;
o = ss.option(form.Value, 'endpoint_host', _('Endpoint Host'), _('Optional. Host of peer. Names are resolved prior to bringing up the interface.'));
o.placeholder = 'vpn.example.com';
@@ -282,6 +289,7 @@ return network.registerProtocol('wireguard', {
o.datatype = 'port';
o = ss.option(form.Value, 'persistent_keepalive', _('Persistent Keep Alive'), _('Optional. Seconds between keep alive messages. Default is 0 (disabled). Recommended value if this device is behind a NAT is 25.'));
+ o.modalonly = true;
o.datatype = 'range(0,65535)';
o.placeholder = '0';
},