From: Steven Barth Date: Tue, 22 Apr 2008 18:01:41 +0000 (+0000) Subject: * Fixed ffluci.util.trim, ffluci.util.split X-Git-Tag: 0.8.0~1113 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b15171305b5e6e9b1da4dc05c4d7e105980b9d9d;p=oweals%2Fluci.git * Fixed ffluci.util.trim, ffluci.util.split --- diff --git a/core/src/ffluci/util.lua b/core/src/ffluci/util.lua index 9cb1e1420..3ff7bc203 100644 --- a/core/src/ffluci/util.lua +++ b/core/src/ffluci/util.lua @@ -153,6 +153,10 @@ function split(str, pat, max, regex) local t = {} local c = 1 + if #str == 0 then + return {""} + end + if #pat == 0 then return nil end @@ -172,8 +176,9 @@ function split(str, pat, max, regex) end -- Removes whitespace from beginning and end of a string -function trim (string) - return string:gsub("^%s*(.-)%s*$", "%1") +function trim(string) + local s = string:gsub("^%s*(.-)%s*$", "%1") + return s end -- Updates given table with new values diff --git a/module/public-core/src/controller/public/status.lua b/module/public-core/src/controller/public/status.lua index a786eb2d7..8d2f7a303 100644 --- a/module/public-core/src/controller/public/status.lua +++ b/module/public-core/src/controller/public/status.lua @@ -10,7 +10,6 @@ function action_index() data.routes = {} for i, r in pairs(ffluci.sys.net.routes()) do if r.Destination == "00000000" then - r.Gateway = ffluci.sys.net.hexip4(r.Gateway) table.insert(data.routes, r) end end diff --git a/module/public-core/src/view/public_status/index.htm b/module/public-core/src/view/public_status/index.htm index d81125de2..381333107 100644 --- a/module/public-core/src/view/public_status/index.htm +++ b/module/public-core/src/view/public_status/index.htm @@ -63,9 +63,12 @@ <%:metric Metrik%> <%:iface Schnittstelle%> -<% for i, rt in pairs(routes) do%> +<% +local be = (routes[1] and routes[1].Mask:sub(-2) == "00") +for i, rt in pairs(routes) do +%> -<%=rt.Gateway%> +<%=ffluci.sys.net.hexip4(rt.Gateway, be)%> <%=rt.Metric%> <%=rt.Iface%>