From 752dfc514b2288f19206fc964ea47caeadbf1a76 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 18 Sep 2024 19:31:05 -0700 Subject: [PATCH] Improve and simplify WAN config (#1539) * Simplify WAN enable/disable * Improve --- files/app/main/status/e/network.ut | 84 ++++++++++++------------------ files/usr/local/bin/node-setup | 2 +- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/files/app/main/status/e/network.ut b/files/app/main/status/e/network.ut index 2f56604f..f32961ca 100755 --- a/files/app/main/status/e/network.ut +++ b/files/app/main/status/e/network.ut @@ -108,16 +108,11 @@ if (request.env.REQUEST_METHOD === "PUT") { configuration.setSetting("dhcp_end", request.args.lan_dhcp_end); } } - if ("wan_enable" in request.args) { - if (request.args.wan_enable === "off") { - configuration.setSetting("wan_proto", "disabled"); - } - else { - configuration.setSetting("wan_proto", "dhcp"); - } - } if ("wan_mode" in request.args) { if (request.args.wan_mode === "0") { + configuration.setSetting("wan_proto", "disabled"); + } + else if (request.args.wan_mode === "1") { configuration.setSetting("wan_proto", "dhcp"); } else { @@ -299,63 +294,52 @@ const gateway_altnet = dmz_mode === 1 ? dhcp.gateway : "";
-
+
-
WAN Enable
-
Allow node to directly access the Internet
+
WAN Mode
+
Disabled, static or DHCP mode
- {{_R("hideable-switch", { name: "wan_enable", value: wan_proto === "disabled" ? false : true })}} +
- {{_H("Enable the WAN interface on this node, to allow it to access the Internet directly.")}} -
+ {{_H("The WAN interface can either use DHCP to retrieve an IP address, or it can be set statically.")}} +
-
Mode
-
Static or DHCP mode
+
A‌ddress
+
WAN IP a‌ddress
- +
- {{_H("The WAN interface can either use DHCP to retrieve an IP address, or it can be set statically.")}} -
-
-
-
A‌ddress
-
WAN IP a‌ddress
-
-
- -
+ {{_H("A fixed IP address to assign to the WAN interace on this node.")}} +
+
+
Netmask
+
WAN netmask
- {{_H("A fixed IP address to assign to the WAN interace on this node.")}} -
-
-
Netmask
-
WAN netmask
-
-
- -
+
+
- {{_H("The netmask (e.g. 255.255.255.0) for this interface.")}} -
-
-
Gateway
-
Default gateway
-
-
- -
-
- {{_H("The default gateway his node should use to access the Internet.")}}
+ {{_H("The netmask (e.g. 255.255.255.0) for this interface.")}} +
+
+
Gateway
+
Default gateway
+
+
+ +
+
+ {{_H("The default gateway his node should use to access the Internet.")}}

diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index b43568cc..2f468213 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -237,7 +237,7 @@ end -- delete some config lines if necessary -if cfg.wan_proto == "dhcp" then +if cfg.wan_proto ~= "static" then deleteme.wan_ip = true deleteme.wan_gw = true deleteme.wan_mask = true