From 12c4b0e91fbaf9e224b0b61e92413c5cbf4a683a Mon Sep 17 00:00:00 2001 From: Derry Date: Fri, 5 Mar 2021 22:03:40 -0800 Subject: [PATCH] Fix upload file page error #97 #96 --- luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua | 7 +++---- luci-app-oaf/luasrc/view/cbi/oaf_upload.htm | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100755 luci-app-oaf/luasrc/view/cbi/oaf_upload.htm diff --git a/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua b/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua index 0977b9b..e1c7a02 100755 --- a/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua +++ b/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua @@ -31,11 +31,10 @@ local display_str="当前版本: "..version.."
特 s = m:section(TypedSection, "feature", translate("特征库更新"), display_str ) fu = s:option(FileUpload, "") -fu.template = "cbi/other_upload" +fu.template = "cbi/oaf_upload" s.anonymous = true um = s:option(DummyValue, "rule_data") -um.template = "cbi/other_dvalue" --um.value =rule_count .. " " .. translate("Records").. " "..version s = m:section(TypedSection, "appfilter", translate("App Filter Rules")) @@ -172,7 +171,6 @@ http.setfilehandler( if not meta then return end if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end if not fd then - --um.value = translate("Create upload file error.") return end end @@ -182,7 +180,8 @@ http.setfilehandler( if eof and fd then fd:close() local fd2 = io.open("/tmp/upload/"..meta.file) - local line=fd2:read("*l"); + local line=fd2:read("*l"); + fd2:close() local ret=string.match(line, "#version") if ret ~= nil then local cmd="cp /tmp/upload/"..meta.file.." /etc/appfilter/feature.cfg"; diff --git a/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm b/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm new file mode 100755 index 0000000..0fe8150 --- /dev/null +++ b/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm @@ -0,0 +1,5 @@ +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%>