X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-adblock%2Fluasrc%2Fmodel%2Fcbi%2Fadblock%2Fblacklist_tab.lua;h=8526a4b5eb8393ac483d694638dec872035ccd59;hp=7945aa154e639dbd18a4033bc9bbda3fd320a5f4;hb=b2cc7bf276e63b50b636b6d6f60bc2fec1aa2d26;hpb=3096af833bb38ed98ae1cf8926fa8889543e9298 diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua index 7945aa154..8526a4b5e 100644 --- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua +++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua @@ -4,15 +4,29 @@ local fs = require("nixio.fs") local util = require("luci.util") local uci = require("uci") -local adbinput = uci.get("adblock", "blacklist", "adb_src" or "/etc/adblock/adblock.blacklist") +local adbinput = uci:get("adblock", "blacklist", "adb_src") or "/etc/adblock/adblock.blacklist" if not nixio.fs.access(adbinput) then - m = SimpleForm("error", nil, translate("Input file not found, please check your configuration.")) + m = SimpleForm("error", nil, + translate("Input file not found, please check your configuration.")) + m.reset = false + m.submit = false + return m +end + +if nixio.fs.stat(adbinput).size > 524288 then + m = SimpleForm("error", nil, + translate("The file size is too large for online editing in LuCI (> 512 KB). ") + .. translate("Please edit this file directly in a terminal session.")) + m.reset = false + m.submit = false return m end m = SimpleForm("input", nil) m:append(Template("adblock/config_css")) +m.submit = translate("Save") +m.reset = false s = m:section(SimpleSection, nil, translatef("This form allows you to modify the content of the adblock blacklist (%s).
", adbinput)