luci-app-freifunk-widgets: switch to nixio.fs
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
2af6fac809
commit
7298099b02
3 changed files with 12 additions and 10 deletions
|
@ -11,7 +11,7 @@ You may obtain a copy of the License at
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local fs = require "luci.fs"
|
local fs = require "nixio.fs"
|
||||||
local utl = require "luci.util"
|
local utl = require "luci.util"
|
||||||
m = Map("freifunk-widgets", translate("Widgets"),
|
m = Map("freifunk-widgets", translate("Widgets"),
|
||||||
translate("Configure installed widgets."))
|
translate("Configure installed widgets."))
|
||||||
|
@ -37,9 +37,10 @@ function en.cfgvalue(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
local tmpl = wdg:option(ListValue, "template", translate("Template"))
|
local tmpl = wdg:option(ListValue, "template", translate("Template"))
|
||||||
for k, v in ipairs(fs.dir('/usr/lib/lua/luci/view/freifunk/widgets/')) do
|
local file
|
||||||
if v ~= "." and v ~= ".." then
|
for file in fs.dir("/usr/lib/lua/luci/view/freifunk/widgets/") do
|
||||||
tmpl:value(v)
|
if file ~= "." and file ~= ".." then
|
||||||
|
tmpl:value(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,10 +65,11 @@ function m.on_commit(self)
|
||||||
table.insert(active, s[".name"])
|
table.insert(active, s[".name"])
|
||||||
end
|
end
|
||||||
end )
|
end )
|
||||||
for k, v in ipairs(fs.dir(dir)) do
|
local file
|
||||||
filename = string.gsub(v, ".html", "")
|
for file in fs.dir(dir) do
|
||||||
|
local filename = string.gsub(file, ".html", "")
|
||||||
if not utl.contains(active, filename) then
|
if not utl.contains(active, filename) then
|
||||||
fs.unlink(dir .. v)
|
fs.unlink(dir .. file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ You may obtain a copy of the License at
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
--local utl = require "luci.util"
|
--local utl = require "luci.util"
|
||||||
local fs = require "luci.fs"
|
local fs = require "nixio.fs"
|
||||||
local title = data.title
|
local title = data.title
|
||||||
local name = data['.name']
|
local name = data['.name']
|
||||||
local file = "/usr/share/customtext/" .. name .. ".html"
|
local file = "/usr/share/customtext/" .. name .. ".html"
|
||||||
|
|
|
@ -14,7 +14,7 @@ You may obtain a copy of the License at
|
||||||
|
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local utl = require "luci.util"
|
local utl = require "luci.util"
|
||||||
local fs = require "luci.fs"
|
local fs = require "nixio.fs"
|
||||||
local i18n = require "luci.i18n"
|
local i18n = require "luci.i18n"
|
||||||
local url = data.url
|
local url = data.url
|
||||||
local title = data.title or i18n.translate("RSS")
|
local title = data.title or i18n.translate("RSS")
|
||||||
|
@ -37,7 +37,7 @@ cachefile = "/tmp/" .. name .. ".cache"
|
||||||
<% if not url then %>
|
<% if not url then %>
|
||||||
<%:No url found in config%>
|
<%:No url found in config%>
|
||||||
<% else
|
<% else
|
||||||
local mtime = luci.fs.mtime(cachefile) or 0
|
local mtime = fs.stat(cachefile, "mtime") or 0
|
||||||
local now = os.time()
|
local now = os.time()
|
||||||
expire = mtime + cachetime
|
expire = mtime + cachetime
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue