From: Jan Pazdziora Date: Fri, 10 Jan 2025 14:06:19 +0000 (+0100) Subject: luci-app-ddns: avoid Absent Interface: "wan" when it does not exist X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9e10f25c18f889a5387f512ee6e46b6fe842b60a;p=project%2Fluci.git luci-app-ddns: avoid Absent Interface: "wan" when it does not exist and the Alias Interface is likely what we want for the default. Signed-off-by: Jan Pazdziora --- diff --git a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js index 46f05a3fc8..1ccb5d69ad 100644 --- a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js +++ b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js @@ -7,6 +7,7 @@ 'require rpc'; 'require fs'; 'require form'; +'require network'; 'require tools.widgets as widgets'; return view.extend({ @@ -100,6 +101,16 @@ return view.extend({ }, this)) }, + /* + * Figure out what the wan interface on the device is. + * Determine if the physical device exist, or if we should use an alias. + */ + callGetWanInterface: function(m, ev) { + return network.getDevice('wan').then(dev => dev.getName()) + .catch(err => network.getNetwork('wan').then(net => '@' + net.getName())) + .catch(err => null); + }, + /* * Check whether or not the service is supported. * If the script doesn't find any JSON, assume a 'service on demand' install. @@ -243,7 +254,8 @@ return view.extend({ this.callDDnsGetStatus(), this.callDDnsGetEnv(), this.callGenServiceList(), - uci.load('ddns') + uci.load('ddns'), + this.callGetWanInterface() ]); }, @@ -252,6 +264,7 @@ return view.extend({ var status = data[1] || []; var env = data[2] || []; var logdir = uci.get('ddns', 'global', 'ddns_logdir') || "/var/log/ddns"; + var wan_interface = data[5]; var _this = this; @@ -865,7 +878,7 @@ return view.extend({ o.modalonly = true; o.depends("ip_source", "interface") o.multiple = false; - o.default = 'wan'; + o.default = wan_interface; o = s.taboption('advanced', form.Value, 'ip_script', _("Script"),