From e8d90a94043c33c904c6385504ef94f9e94e561e Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 27 Jul 2022 00:02:47 -0700 Subject: [PATCH] Add a visual indicator when a service is not being published. --- files/www/cgi-bin/ports | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/files/www/cgi-bin/ports b/files/www/cgi-bin/ports index 3ebee4ab..43e9f64a 100755 --- a/files/www/cgi-bin/ports +++ b/files/www/cgi-bin/ports @@ -1100,6 +1100,17 @@ function print_forwarding() end function print_services() + local activesvc = nil + if nixio.fs.stat("/var/etc/olsrd.conf") then + activesvc = {} + for line in io.lines("/var/etc/olsrd.conf") + do + local plparam = line:match([[^%s*(PlParam "service" ".*")%s*$]]) + if plparam then + activesvc[plparam] = true + end + end + end html.print("") if not (dmz_mode ~= 0 or parms.port_num ~= 0 or parms.dmz_ip) then if dmz_mode ~= 0 then @@ -1192,11 +1203,15 @@ function print_services() html.print("") + local svc = string.format([[PlParam "service" "%s://%s:%s/%s|tcp|%s"]], _proto, _host, (_link == "1" and _port or "0"), _suffix, _name) + if val ~= "_add" and activesvc and not activesvc[svc] then + html.print("") + end + html.print("") -- display any errors while #serv_err > 0 and serv_err[1]:match("^" .. val .. " ")
Advertised Services
 ") else - html.print("serv" .. val .. "_del value=Del title='Remove this service'") + html.print("serv" .. val .. "_del value=Del title='Remove this service'>") end - html.print(">