From c751cc5180196198f08e6e3aac019270b26ff1e7 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Sun, 18 Sep 2022 16:41:57 +0800 Subject: luci-app-smartdns: fix redirect error message issue Signed-off-by: Nick Peng --- .../htdocs/luci-static/resources/view/smartdns/smartdns.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'applications/luci-app-smartdns/htdocs') diff --git a/applications/luci-app-smartdns/htdocs/luci-static/resources/view/smartdns/smartdns.js b/applications/luci-app-smartdns/htdocs/luci-static/resources/view/smartdns/smartdns.js index 6f3f0ac16e..f44fd9b254 100644 --- a/applications/luci-app-smartdns/htdocs/luci-static/resources/view/smartdns/smartdns.js +++ b/applications/luci-app-smartdns/htdocs/luci-static/resources/view/smartdns/smartdns.js @@ -57,7 +57,6 @@ function smartdnsRenderStatus(res) { var autoSetDnsmasq = uci.get_first('smartdns', 'smartdns', 'auto_set_dnsmasq'); var smartdnsPort = uci.get_first('smartdns', 'smartdns', 'port'); var dnsmasqServer = uci.get_first('dhcp', 'dnsmasq', 'server'); - uci.unload('dhcp'); if (isRunning) { renderHTML += "SmartDNS - " + _("RUNNING") + ""; @@ -68,9 +67,10 @@ function smartdnsRenderStatus(res) { if (autoSetDnsmasq === '1' && smartdnsPort != '53') { var matchLine = "127.0.0.1#" + smartdnsPort; - var dnsmasqServer = uci.get_first('dhcp', 'dnsmasq', 'server') || ""; - if (dnsmasqServer.indexOf(matchLine) < 0) { + uci.unload('dhcp'); + uci.load('dhcp'); + if (dnsmasqServer == undefined || dnsmasqServer.indexOf(matchLine) < 0) { renderHTML += "
" + _("Dnsmasq Forwared To Smartdns Failure") + ""; } } @@ -106,8 +106,7 @@ return view.extend({ view.innerHTML = smartdnsRenderStatus(res); }); } - poll.add(renderStatus); - setTimeout(renderStatus, 1000); + poll.add(renderStatus, 1); return E('div', { class: 'cbi-map' }, E('div', { class: 'cbi-section' }, [ -- cgit v1.2.3