Skip to content

Commit 39e263e

Browse files
committed
Broken card display when no DDNS configured (#199)
1 parent 50b20c3 commit 39e263e

7 files changed

+45
-35
lines changed

src/common/wanservices/www/lua/wanservices-ddns_helper.lua

+14-4
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,22 @@ if intfs_pn then
9595
end
9696
end
9797

98-
function M.get_services_status()
98+
function M.get_services_status(ddns_enabled)
9999
local status = {}
100100
local result = proxy.get("rpc.ddns.status")
101101
if result then
102102
local all = untaint(result[1].value)
103-
for v in gmatch(all,'([^%]]+)') do
104-
local paramindex,msg = match(v,'(.+)%[(.+)')
105-
status[paramindex] = msg
103+
if all == "No error received from server" then
104+
if ddns_enabled and #ddns_enabled > 0 then
105+
for k=1,#ddns_enabled do
106+
status[ddns_enabled[k]] = "Disabled"
107+
end
108+
end
109+
else
110+
for v in gmatch(all,'([^%]]+)') do
111+
local paramindex,msg = match(v,'(.+)%[(.+)')
112+
status[paramindex] = msg
113+
end
106114
end
107115
end
108116
return status
@@ -118,6 +126,8 @@ function M.to_status(services_status,paramindex)
118126
ddns_status = "updated"
119127
elseif rpc_ddns_status == "No error received from server" then
120128
ddns_status = "updating"
129+
elseif rpc_ddns_status == "Disabled" then
130+
ddns_status = "disabled"
121131
else
122132
ddns_status = "error"
123133
end

src/common/wanservices/www/lua/wanservicescard_helper.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function M.getWANServicesCardHTML()
2121
if #ddns_enabled == 0 then
2222
html[#html+1] = ui_helper.createSimpleLight("0",format(ddns_status,"disabled"))
2323
else
24-
local services_status = ddns_helper.get_services_status()
24+
local services_status = ddns_helper.get_services_status(ddns_enabled)
2525
local ddns = {
2626
updated = 0,
2727
updating = 0,

tch-gui-unhide-17.2

+6-6
Large diffs are not rendered by default.

tch-gui-unhide-18.1.c

+6-6
Large diffs are not rendered by default.

tch-gui-unhide-20.3.c

+6-6
Large diffs are not rendered by default.

tch-gui-unhide-20.4

+6-6
Large diffs are not rendered by default.

tch-gui-unhide-21.4

+6-6
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)