diff --git a/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua b/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua index 470decf..9007c10 100755 --- a/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua +++ b/luci-app-oaf/luasrc/model/cbi/appfilter/appfilter.lua @@ -16,28 +16,11 @@ local m, s m = Map("appfilter", translate("App Filter"), translate("")) - + s = m:section(TypedSection, "global", translate("Basic Settings")) s:option(Flag, "enable", translate("Enable App Filter"),translate("")) s.anonymous = true -local rule_count=0 -local version="" -if nixio.fs.access("/tmp/feature.cfg") then - rule_count=tonumber(SYS.exec("cat /tmp/feature.cfg | wc -l")) - version=SYS.exec("cat /tmp/feature.cfg |grep \"#version\" | awk '{print $2}'") -end - - -local display_str=""..translate("Current Version")..": "..version.."
"..translate("App Feature Num")..": "..rule_count -s = m:section(TypedSection, "feature", translate("Update feature"), display_str ) - -fu = s:option(FileUpload, "") -fu.template = "cbi/oaf_upload" -s.anonymous = true - -um = s:option(DummyValue, "rule_data") - s=m:section(TypedSection,"time",translate("Time Setting")) s.anonymous = true hv = s:option(Value, "start_time", translate("Start Time")) hv.default="00:00" hv.optional=false @@ -173,56 +156,5 @@ if config_users~=nil and config_users~=false then end end m:section(SimpleSection).template = "admin_network/user_status" -local dir, fd -dir = "/tmp/upload/" -nixio.fs.mkdir(dir) -http.setfilehandler( - function(meta, chunk, eof) - if not fd then - if not meta then return end - if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end - if not fd then - return - end - end - if chunk and fd then - fd:write(chunk) - end - if eof and fd then - fd:close() - local fd2 = io.open("/tmp/upload/"..meta.file) - local line=fd2:read("*l"); - fd2:close() - local ret=string.match(line, "#version") - local lang=m.uci:get_all("luci.main.lang") - local feature_file="" - if "" == lang or "auto" == lang then - feature_file="/etc/appfilter/feature.cfg" - else - feature_file="/etc/appfilter/feature_"..lang..".cfg" - end - if ret ~= nil then - local cmd="cp /tmp/upload/"..meta.file.." "..feature_file; - os.execute(cmd); - os.execute("chmod 666 "..feature_file); - os.execute("rm /tmp/appfilter -fr"); - luci.sys.exec("/etc/init.d/appfilter restart &"); - um.value = translate("Update the feature file successfully, please refresh the page") - else - um.value = translate("Failed to update feature file, format error") - end - os.execute("rm /tmp/upload/* -fr"); - end - end -) - -if luci.http.formvalue("upload") then - local f = luci.http.formvalue("ulfile") - if #f <= 0 then - --um.value = translate("No specify upload file.") - end -elseif luci.http.formvalue("download") then - Download() -end return m diff --git a/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm b/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm deleted file mode 100755 index aadf01d..0000000 --- a/luci-app-oaf/luasrc/view/cbi/oaf_upload.htm +++ /dev/null @@ -1,5 +0,0 @@ -<%+cbi/valueheader%> - - - -<%+cbi/valuefooter%>