Merge pull request #5253 from selanf/x13
authorJo-Philipp Wich <jo@mein.io>
Wed, 11 Aug 2021 20:10:56 +0000 (22:10 +0200)
committerGitHub <noreply@github.com>
Wed, 11 Aug 2021 20:10:56 +0000 (22:10 +0200)
16 files changed:
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/custom.js
applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/graphs.js
applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/keys.js
applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js [deleted file]
applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/settings.js
applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/status.js
applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js [deleted file]
applications/luci-app-yggdrasil/root/usr/share/luci/menu.d/luci-app-yggdrasil.json
modules/luci-base/htdocs/luci-static/resources/cbi.js
modules/luci-base/htdocs/luci-static/resources/luci.js
modules/luci-compat/luasrc/view/cbi/tblsection.htm
modules/luci-compat/luasrc/view/cbi/tsection.htm
modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js
themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/cascade.css

index ca870552a6cef4810ada275a12bbcf5070d58d60..1997a720c6f051947f561f16c43190e8852d79b2 100644 (file)
@@ -24,7 +24,7 @@ return view.extend({
                return E([
                        E('h2', _('Firewall - Custom Rules')),
                        E('p', {}, _('Custom rules allow you to execute arbitrary iptables commands which are not otherwise covered by the firewall framework. The commands are executed after each firewall restart, right after the default ruleset has been loaded.')),
-                       E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 10 }, [ fwuser != null ? fwuser : '' ]))
+                       E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 25 }, [ fwuser != null ? fwuser : '' ]))
                ]);
        },
 
index fbe9d593372ce7d362b367349ff8f404ee2d7a1b..7ac3b3f7e779e239e3187ab961ffdab7976a97f3 100644 (file)
@@ -16,11 +16,11 @@ return view.extend({
                ]);
 
                ifaces.forEach(function(iface) {
-                       tab.appendChild(E('p', {}, E('img', { 'data-iface': iface, 'style': 'display:none' })));
+                       tab.appendChild(E('span', {}, E('img', { 'data-iface': iface, 'style': 'visibility:hidden; margin:5px 10px' })));
                        fs.exec_direct('/usr/bin/vnstati', [ '-'+style, '-i', iface, '-o', '-' ], 'blob').then(function(res) {
                                var img = tab.querySelector('img[data-iface="%s"]'.format(iface));
                                img.src = URL.createObjectURL(res);
-                               img.style.display = '';
+                               img.style.visibility = 'visible';
                                tab.firstElementChild.style.display = 'none';
                        });
                });
index 44acaa22d662d35a59514b59888b506a5286ddde..7e9bef46e4da7f3dc4c3f83a8b08e40dd8a02d14 100644 (file)
@@ -11,11 +11,8 @@ return view.extend({
                s = m.section(form.TypedSection, "yggdrasil", _("Encryption keys")); 
                s.anonymous = true;
 
-               s.option(form.Value, "EncryptionPublicKey", _("Encryption public key"));
-               s.option(form.Value, "EncryptionPrivateKey", _("Encryption private key"),
-                       _("Keep this private. When compromised, generate a new keypair and IPv6."));
-               s.option(form.Value, "SigningPublicKey", _("Signing public key"));
-               s.option(form.Value, "SigningPrivateKey", _("Signing private key"),
+               s.option(form.Value, "PublicKey", _("Encryption public key"));
+               s.option(form.Value, "PrivateKey", _("Encryption private key"),
                        _("Keep this private. When compromised, generate a new keypair and IPv6."));
 
                return m.render();
diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js
deleted file mode 100644 (file)
index 45fe220..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-'require view';
-'require form';
-
-return view.extend({
-       render: function() {
-               var m, s, o;
-
-               m = new form.Map('yggdrasil', 'Yggdrasil');
-
-               s = m.section(form.TypedSection, "yggdrasil", _("Session firewall settings"));
-               s.anonymous = true;
-
-               s.option(form.Flag, "SessionFirewall_Enable", _("Enable session firewall"),
-                       _("If disabled, network traffic from any node will be allowed. If enabled, the below rules apply"));
-               s.option(form.Flag, "SessionFirewall_AllowFromDirect", _("Allow from direct"), 
-                       _("Allow network traffic from directly connected peers"));
-               s.option(form.Flag, "SessionFirewall_AllowFromRemote", _("Allow from remote"), 
-                       _("Allow network traffic from remote nodes on the network that you are not directly peered with"));
-               s.option(form.Flag, "SessionFirewall_AlwaysAllowOutbound", 
-                       _("Always allow outbound"), _("Allow outbound network traffic regardless of AllowFromDirect or AllowFromRemote"));
-
-               s = m.section(form.TableSection, "whitelisted_encryption_public_key", 
-                       _("Whitelisted public keys"),
-                       _("Network traffic is always accepted from those peers, regardless of AllowFromDirect or AllowFromRemote"));
-               s.option(form.Value, "key", _("Public key"));
-               s.anonymous = true;
-               s.addremove = true;
-
-               s = m.section(form.TableSection, "blacklisted_encryption_public_key", 
-                       _("Blacklisted public keys"), 
-                       _("Network traffic is always rejected from those peers, regardless of AllowFromDirect or AllowFromRemote"));
-               s.option(form.Value, "key", _("Public key"));
-               s.anonymous = true;
-               s.addremove = true;
-
-               return m.render();
-       }
-});
index 4278386f53af1a885dd74211284cd60c3992c211..8bc63dadc25d5c6121ad094cc60fae001009c997 100644 (file)
@@ -12,12 +12,6 @@ return view.extend({
                s.anonymous = true;
 
                s.option(form.Value, "IfName", _("Yggdrasil's network interface name"));
-               s.option(form.Value, "LinkLocalTCPPort", _("Link-local TCP port"),
-                       _("The port number to be used for the link-local TCP listeners for the "+
-                               "configured MulticastInterfaces. This option does not affect listeners" +
-                               "specified in the Listen option. Unless you plan to firewall link-local" +
-                               "traffic, it is best to leave this as the default value of 0. This " +
-                               "option cannot currently be changed by reloading config during runtime."));
 
                s.option(form.Flag, "NodeInfoPrivacy", _("Enable NodeInfo privacy"),
                  _("By default, nodeinfo contains some defaults including the platform," +
@@ -35,17 +29,6 @@ return view.extend({
                }
 
                s.option(form.Value, "IfMTU", _("MTU size for the interface"));
-               s.option(form.Value, "SwitchOptions_MaxTotalQueueSize", 
-                       _("Maximum size of all switch queues combined"));
-
-               o = m.section(form.TableSection, "multicast_interface", _("Multicast interfaces"),
-                       _("Regular expressions for which interfaces multicast peer discovery " +
-                               "should be enabled on. If none specified, multicast peer discovery is " +
-                               "disabled. The default value is .* which uses all interfaces."));
-               o.option(form.Value, "name", _("Interface name"), 
-                       _("Set .* to multicast on all interfaces"));
-               o.anonymous = true;
-               o.addremove = true;
 
                o = m.section(form.TableSection, "listen_address", _("Listen addresses"), 
                        _("Listen addresses for incoming connections. You will need to add " +
@@ -53,12 +36,23 @@ return view.extend({
                                "Multicast peer discovery will work regardless of any listeners set " +
                                "here. Each listener should be specified in URI format as above, e.g. " +
                                "tcp://0.0.0.0:0 or tcp://[::]:0 to listen on all interfaces."));
-                       _("Address to listen for incoming connections"), 
                o.option(form.Value, "uri",
                        _("e.g. tcp://0.0.0.0:0 or tcp://[::]:0"));
                o.anonymous = true;
                o.addremove = true;
 
+               o = m.section(form.TableSection, "multicast_interface", _("Multicast interface"), 
+                       _("Configuration for which interfaces multicast peer discovery should be enabled on. " + 
+                               "Regex is a regular expression which is matched against an interface name, and interfaces use the first configuration that they match gainst. " +
+                               "Beacon configures whether or not the node should send link-local multicast beacons to advertise their presence, while listening for incoming connections on Port. " +
+                               "Listen controls whether or not the node listens for multicast beacons and opens outgoing connections."));
+               o.option(form.Value, "regex", _("Regular expression"));
+               o.option(form.Flag, "beacon", _("Send beacons"));
+               o.option(form.Flag, "listen", _("Listen for beacons"));
+               o.option(form.Value, "port", _("Link-local port"));
+               o.anonymous = true;
+               o.addremove = true;
+
                return m.render();
        }
 });
index 35078a511b9936d50ce7656c1442851726b57ca9..d47ccb2f5de22f315da567fa8fd17071f2cd1143 100644 (file)
@@ -11,7 +11,7 @@ function init_view() {
                "IPv6 address": "self-address",
                "IPv6 subnet": "self-subnet",
                "Coords": "self-coords",
-               "Public key": "self-boxpubkey",
+               "Public key": "self-key",
                "Build name": "self-buildname",
                "Build version": "self-version"
        };
@@ -37,7 +37,7 @@ function init_view() {
        peerings.setAttribute("class", "table"); peerings.id = "yggdrasil-peerings";
        var tr = document.createElement("tr");
        tr.setAttribute("class", "tr table-titles");
-       ["Endpoint", "Address", "Proto", "Uptime", "Received", "Transmitted"].forEach(function(t) {
+       ["Endpoint", "Address", "Coords", "Key", "Port"].forEach(function(t) {
                var th = document.createElement("th"); th.setAttribute("class", "th nowrap left");
                th.innerText = t;
                tr.appendChild(th);
@@ -55,14 +55,15 @@ function update_active_peers() {
                        while (table.rows.length > 1) { table.deleteRow(1); }
                        Object.keys(peers).forEach(function(address) {
                                var row = table.insertRow(-1);
-                               row.insertCell(-1).textContent = peers[address].endpoint;
+                               row.style.fontSize = "xx-small";
+                               row.insertCell(-1).textContent = peers[address].remote;
                                row.insertCell(-1).textContent = address;
-                               row.insertCell(-1).textContent = peers[address].proto;
-                               row.insertCell(-1).textContent = '%t'.format(peers[address].uptime);
-                               row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_recvd);
-                               row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_sent);
+                               row.insertCell(-1).textContent = "[" + peers[address].coords.toString() + "]";
+                               row.insertCell(-1).textContent = peers[address].key;
+                               row.insertCell(-1).textContent = peers[address].port;
                        });
                }
+               setTimeout(update_active_peers, 5000);
        });
 }
 
@@ -85,23 +86,12 @@ return view.extend({
                        var r = obj[address];
                        view.querySelector('#self-address').innerText = address;
                        view.querySelector('#self-subnet').innerText = r.subnet;
-                       view.querySelector('#self-coords').innerText = r.coords;
-                       view.querySelector('#self-boxpubkey').innerText = r.box_pub_key;
+                       view.querySelector('#self-coords').innerText = "[" + r.coords + "]";
+                       view.querySelector('#self-key').innerText = r.key;
                        view.querySelector('#self-buildname').innerText = r.build_name;
                        view.querySelector('#self-version').innerText = r.build_version;
 
-                       var table = view.querySelector('#yggdrasil-peerings');
-                       Object.keys(peers).forEach(function(address) {
-                               var row = table.insertRow(-1);
-                               row.insertCell(-1).textContent = peers[address].endpoint;
-                               row.insertCell(-1).textContent = address;
-                               row.insertCell(-1).textContent = peers[address].proto;
-                               row.insertCell(-1).textContent = '%t'.format(peers[address].uptime);
-                               row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_recvd);
-                               row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_sent);
-
-                       });
-                       setInterval(update_active_peers, 5000);
+                       update_active_peers();
                } else {
                        view.innerHTML = "<h2>Yggdrasil is not running</h2>";
                }
diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js
deleted file mode 100644 (file)
index 0b4ac6e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict';
-'require view';
-'require form';
-
-return view.extend({
-       render: function() {
-               var m, s, o;
-
-               m = new form.Map('yggdrasil', 'Yggdrasil');
-
-               s = m.section(form.TypedSection, "yggdrasil", _("Tunnel Routing")); 
-               s.anonymous = true;
-               s.option(form.Flag, "TunnelRouting_Enable", "Enable tunnel routing",
-                       _("Allow tunneling non-Yggdrasil traffic over Yggdrasil. This effectively " +
-                               "allows you to use Yggdrasil to route to, or to bridge other networks, " +
-                               "similar to a VPN tunnel. Tunnelling works between any two nodes and " +
-                               "does not require them to be directly peered."));
-
-               o = m.section(form.TableSection, "ipv4_remote_subnet", _("IPv4 remote subnet"),
-                       _("IPv4 subnets belonging to remote nodes, mapped to the node's public"));
-               o.option(form.Value, "key", _("Key"), _("Public encryption key"));
-               o.option(form.Value, "subnet", _("Subnet"), _("IPv4 subnet"));
-               o.anonymous = true;
-               o.addremove = true;
-
-               o = m.section(form.TableSection, "ipv4_local_subnet", _("IPv4 local subnet"),
-                       _("IPv4 subnets belonging to this node's end of the tunnels. Only traffic "  +
-                               "from these ranges will be tunnelled."));
-               o.option(form.Value, "subnet", _("Subnet"), _("IPv4 subnet"));
-               o.anonymous = true;
-               o.addremove = true;
-
-               o = m.section(form.TableSection, "ipv6_remote_subnet", _("IPv6 remote subnet"),
-                       _("IPv6 subnets belonging to remote nodes, mapped to the node's public"));
-               o.option(form.Value, "key", _("Key"), _("Public encryption key"));
-               o.option(form.Value, "subnet", _("Subnet"), _("IPv6 subnet"));
-               o.anonymous = true;
-               o.addremove = true;
-
-               o = m.section(form.TableSection, "ipv6_local_subnet", _("IPv6 local subnet"),
-                       _("IPv6 subnets belonging to this node's end of the tunnels. Only traffic " +
-                               "from these ranges (or the Yggdrasil node's IPv6 address/subnet) " +
-                               "will be tunnelled."));
-               o.option(form.Value, "subnet", _("Subnet"), _("IPv6 subnet"));
-               o.anonymous = true;
-               o.addremove = true;
-
-               return m.render();
-       }
-});
index 2947461e58f80245055d573313b978782e0f987b..da4e4acef9ea608dc01050d6e79d99141e6a9ef1 100644 (file)
                        "type": "view",
                        "path": "yggdrasil/keys"
                }
-       },
-
-       "admin/network/yggdrasil/session_firewall": {
-               "title": "Session firewall",
-               "order": 5,
-               "action": {
-                       "type": "view",
-                       "path": "yggdrasil/session_firewall"
-               }
-       },
-
-       "admin/network/yggdrasil/tunnel_routing": {
-               "title": "Tunnel routing",
-               "order": 6,
-               "action": {
-                       "type": "view",
-                       "path": "yggdrasil/tunnel_routing"
-               }
        }
 }
index 513256e4c9bfea559a54133e8950bc662972c095..9728e03e120fdcef153a1103065c14f3610fd3bd 100644 (file)
@@ -367,6 +367,17 @@ function cbi_validate_form(form, errmsg)
        return true;
 }
 
+function cbi_validate_named_section_add(input)
+{
+       var button = input.parentNode.parentNode.querySelector('.cbi-button-add');
+       if (input.value !== '') {
+               button.disabled = false;
+       }
+       else {
+               button.disabled = true;
+       }
+}
+
 function cbi_validate_reset(form)
 {
        window.setTimeout(
index 23853e2cc89eb3363c0ff6b8163a5a08944722c9..5699c9eb92651c0982d9b06f24fcd1031b20ad85 100644 (file)
                 * Provides a password for HTTP basic authentication.
                 *
                 * @property {number} [timeout]
-                * Specifies the request timeout in seconds.
+                * Specifies the request timeout in milliseconds.
                 *
                 * @property {boolean} [credentials=false]
                 * Whether to include credentials such as cookies in the request.
index 048eb22c417539e9209166c5ffca132e56e688b5..1cba66088473cc2beaf710253337f804a48c1215 100644 (file)
@@ -192,9 +192,9 @@ end
                                        <div class="cbi-section-error"><%:Invalid%></div>
                                <%- end %>
                                <div>
-                                       <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" />
+                                       <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" onkeyup="cbi_validate_named_section_add(this)"/>
                                </div>
-                               <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
+                               <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" disabled="" />
                        <% end %>
                </div>
                <%- end %>
index 45e51cc69f7230ee2311f7fb63ea7e8c91a2220a..703e1ff3285364432bfadfc064d952d71b552547 100644 (file)
@@ -42,9 +42,9 @@
                                        <div class="cbi-section-error"><%:Invalid%></div>
                                <%- end %>
                                <div>
-                                       <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" />
+                                       <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" onkeyup="cbi_validate_named_section_add(this)"/>
                                </div>
-                               <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
+                               <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" disabled=""/>
                        <%- end %>
                </div>
                <%- end %>
index 844f8cc752466de51c7ef8f41abfdfecfb06bb59..62e046e609fb49f78de5e7f06b10b397f79e1008 100644 (file)
@@ -55,6 +55,9 @@
                },
                "depends": {
                        "acl": [ "luci-mod-network-dhcp" ],
+                       "fs": {
+                               "/usr/sbin/dnsmasq": "executable"
+                       },
                        "uci": { "dhcp": true }
                }
        },
index 3e89578002080a462c9e26c01d91e4e71ab2548a..0a885c01c9b45e296f4fb1cacf0cde30fa2e086d 100644 (file)
@@ -34,9 +34,11 @@ return baseclass.extend({
                var fields = [
                        _('Total Available'), (mem.available) ? mem.available : (mem.total && mem.free && mem.buffered) ? mem.free + mem.buffered : null, mem.total,
                        _('Used'),            (mem.total && mem.free) ? (mem.total - mem.free) : null, mem.total,
-                       _('Buffered'),        (mem.total && mem.buffered) ? mem.buffered : null, mem.total
                ];
 
+               if (mem.buffered)
+                       fields.push(_('Buffered'), mem.buffered, mem.total);
+
                if (mem.cached)
                        fields.push(_('Cached'), mem.cached, mem.total);
 
index 079921a520e4de59556d682d04a46b6a0dabfabf..955fcee525de13a220ead51f1c98ffeb4ce965bc 100644 (file)
@@ -27,7 +27,7 @@ return view.extend({
                return E([
                        E('h2', _('Scheduled Tasks')),
                        E('p', { 'class': 'cbi-section-descr' }, _('This is the system crontab in which scheduled tasks can be defined.')),
-                       E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 10, 'disabled': isReadonlyView }, [ crontab != null ? crontab : '' ]))
+                       E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 25, 'disabled': isReadonlyView }, [ crontab != null ? crontab : '' ]))
                ]);
        },
 
index a46c6d56f444d0a8c408f90d80af8f64a4b95aea..724b262b8289c41f6dbc105c497c05e041a0ea2a 100644 (file)
@@ -148,7 +148,8 @@ body {
 }
 
 #mainmenu {
-       flex: 1 1 200px;
+       flex: 1 1 100px;
+       max-width: 250px;
        background: var(--main-dark-color);
        color: var(--main-bright-color);
        padding: 1em;