* remove extra apperror.lua page * so no nore need for extra directory inside model/cbi * add option temporary_directory needed for external filters * remove special handling of bootstrap theme #298 #334 * modified version handling suggested in #335 Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
parent
de5ec52b87
commit
37cf3e0ef1
4 changed files with 217 additions and 172 deletions
|
@ -6,33 +6,33 @@
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=luci-app-privoxy
|
||||||
|
|
||||||
|
# Version == major.minor.patch
|
||||||
|
# increase "minor" on new functionality and "patch" on patches/optimization
|
||||||
|
PKG_VERSION:=1.0.3
|
||||||
|
|
||||||
|
# Release == build
|
||||||
|
# increase on changes of translation files
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_LICENSE:=Apache-2.0
|
||||||
|
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
||||||
|
|
||||||
# LuCI specific settings
|
# LuCI specific settings
|
||||||
LUCI_TITLE:=LuCI Support for Privoxy WEB proxy
|
LUCI_TITLE:=LuCI Support for Privoxy WEB proxy
|
||||||
LUCI_DEPENDS:=+luci-mod-admin-full +privoxy
|
LUCI_DEPENDS:=+luci-mod-admin-full +privoxy
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
PKG_NAME:=luci-app-privoxy
|
|
||||||
|
|
||||||
# Version == major.minor.patch
|
|
||||||
# increase "minor" on new functionality and "patch" on patches/optimization
|
|
||||||
PKG_VERSION:=1.0.2
|
|
||||||
|
|
||||||
# Release == build
|
|
||||||
# increase on changes of translation files
|
|
||||||
PKG_RELEASE:=0
|
|
||||||
|
|
||||||
PKG_LICENSE:=Apache-2.0
|
|
||||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/config
|
define Package/$(PKG_NAME)/config
|
||||||
# shown in make menuconfig <Help>
|
# shown in make menuconfig <Help>
|
||||||
help
|
help
|
||||||
$(LUCI_TITLE)
|
$(LUCI_TITLE)
|
||||||
|
.
|
||||||
Version : $(PKG_VERSION)-$(PKG_RELEASE)
|
Version: $(PKG_VERSION)-$(PKG_RELEASE)
|
||||||
Maintainer: $(PKG_MAINTAINER)
|
$(PKG_MAINTAINER)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
include ../../luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
# call BuildPackage - OpenWrt buildroot signature
|
||||||
|
|
|
@ -7,26 +7,16 @@ local NX = require "nixio"
|
||||||
local NXFS = require "nixio.fs"
|
local NXFS = require "nixio.fs"
|
||||||
local HTTP = require "luci.http"
|
local HTTP = require "luci.http"
|
||||||
local UCI = require "luci.model.uci"
|
local UCI = require "luci.model.uci"
|
||||||
|
local UTIL = require "luci.util"
|
||||||
local SYS = require "luci.sys"
|
local SYS = require "luci.sys"
|
||||||
|
|
||||||
PRIVOXY_MIN = "3.0.22-0" -- minimum version of service required
|
PRIVOXY_MIN = "3.0.22-0" -- minimum version of service required
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
local _sys = require "luci.sys"
|
entry( {"admin", "services", "privoxy"}, cbi("privoxy"), _("Privoxy WEB proxy"), 59)
|
||||||
local _verinst = _sys.exec([[opkg list-installed ]] .. "privoxy" .. [[ | cut -d " " -f 3 ]])
|
entry( {"admin", "services", "privoxy", "logview"}, call("logread") ).leaf = true
|
||||||
local _cmd = [[opkg compare-versions "]] .. _verinst .. [[" ">=" "]] .. "3.0.22-0" .. [["]]
|
entry( {"admin", "services", "privoxy", "startstop"}, call("startstop") ).leaf = true
|
||||||
local _verok = tonumber(_sys.call(_cmd))
|
entry( {"admin", "services", "privoxy", "status"}, call("get_pid") ).leaf = true
|
||||||
|
|
||||||
-- check config file and version
|
|
||||||
if not nixio.fs.access("/etc/config/privoxy") or (_verok == 0) then
|
|
||||||
entry( {"admin", "services", "privoxy"}, cbi("privoxy/apperror",
|
|
||||||
{hideapplybtn=true, hidesavebtn=true, hideresetbtn=true }), _("Privoxy WEB proxy"), 59)
|
|
||||||
else
|
|
||||||
entry( {"admin", "services", "privoxy"}, cbi("privoxy/detail"), _("Privoxy WEB proxy"), 59)
|
|
||||||
entry( {"admin", "services", "privoxy", "logview"}, call("logread") ).leaf = true
|
|
||||||
entry( {"admin", "services", "privoxy", "startstop"}, call("startstop") ).leaf = true
|
|
||||||
entry( {"admin", "services", "privoxy", "status"}, call("get_pid") ).leaf = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- called by XHR.get from detail_logview.htm
|
-- called by XHR.get from detail_logview.htm
|
||||||
|
@ -80,18 +70,71 @@ function get_pid(from_lua)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get the "name" of the current active theme
|
-- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>"
|
||||||
function get_theme()
|
function ipkg_ver_compare(ver1, comp, ver2)
|
||||||
local _uci = UCI.cursor()
|
if not ver1 or not (#ver1 > 0)
|
||||||
local _base = _uci:get("luci", "main", "mediaurlbase") -- only pathname
|
or not ver2 or not (#ver2 > 0)
|
||||||
_uci:unload("luci")
|
or not comp or not (#comp > 0) then return nil end
|
||||||
|
-- correct compare string
|
||||||
|
if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~="
|
||||||
|
elseif comp == "<=" or comp == "<" or comp == "=<" then comp = "<="
|
||||||
|
elseif comp == ">=" or comp == ">" or comp == "=>" then comp = ">="
|
||||||
|
elseif comp == "=" or comp == "==" then comp = "=="
|
||||||
|
elseif comp == "<<" then comp = "<"
|
||||||
|
elseif comp == ">>" then comp = ">"
|
||||||
|
else return nil end
|
||||||
|
|
||||||
for k, v in pairs(luci.config.themes) do
|
local av1 = UTIL.split(ver1, "[%.%-]", nil, true)
|
||||||
if k:sub(1, 1) ~= "." and v == _base then
|
local av2 = UTIL.split(ver2, "[%.%-]", nil, true)
|
||||||
return k
|
|
||||||
|
for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do
|
||||||
|
local s1 = av1[i] or ""
|
||||||
|
local s2 = av2[i] or ""
|
||||||
|
local n1 = tonumber(s1)
|
||||||
|
local n2 = tonumber(s2)
|
||||||
|
|
||||||
|
-- one numeric and other empty string then set other to 0
|
||||||
|
if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end
|
||||||
|
if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end
|
||||||
|
|
||||||
|
local nc = (n1 and n2) -- numeric compare
|
||||||
|
|
||||||
|
if nc then
|
||||||
|
-- first "not equal" found return true
|
||||||
|
if comp == "~=" and (n1 ~= n2) then return true end
|
||||||
|
-- first "lower" found return true
|
||||||
|
if (comp == "<" or comp == "<=") and (n1 < n2) then return true end
|
||||||
|
-- first "greater" found return true
|
||||||
|
if (comp == ">" or comp == ">=") and (n1 > n2) then return true end
|
||||||
|
-- not equal then return false
|
||||||
|
if (n1 ~= n2) then return false end
|
||||||
|
else
|
||||||
|
if comp == "~=" and (s1 ~= s2) then return true end
|
||||||
|
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
|
||||||
|
if (comp == ">" or comp == ">=") and (s1 > s2) then return true end
|
||||||
|
if (s1 ~= s2) then return false end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
-- all equal then true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- read version information for given package if installed
|
||||||
|
function ipkg_ver_installed(pkg)
|
||||||
|
local version = nil
|
||||||
|
local control = io.open("/usr/lib/opkg/info/%s.control" % pkg, "r")
|
||||||
|
if control then
|
||||||
|
local ln
|
||||||
|
repeat
|
||||||
|
ln = control:read("*l")
|
||||||
|
if ln and ln:match("^Version: ") then
|
||||||
|
version = ln:gsub("^Version: ", "")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
until not ln
|
||||||
|
control:close()
|
||||||
|
end
|
||||||
|
return version
|
||||||
end
|
end
|
||||||
|
|
||||||
-- replacement of build-in Flag.parse of cbi.lua
|
-- replacement of build-in Flag.parse of cbi.lua
|
||||||
|
|
|
@ -1,37 +1,69 @@
|
||||||
-- Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
-- Copyright 2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||||
-- Licensed under the Apache License, Version 2.0
|
-- Licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
local NXFS = require "nixio.fs"
|
local NXFS = require "nixio.fs"
|
||||||
local SYS = require "luci.sys"
|
local SYS = require "luci.sys"
|
||||||
local UTIL = require "luci.util"
|
local UTIL = require "luci.util"
|
||||||
|
local DISP = require "luci.dispatcher"
|
||||||
local DTYP = require "luci.cbi.datatypes"
|
local DTYP = require "luci.cbi.datatypes"
|
||||||
local CTRL = require "luci.controller.privoxy" -- this application's controller
|
local CTRL = require "luci.controller.privoxy" -- this application's controller
|
||||||
|
|
||||||
-- Bootstrap theme needs 2 or 3 additional linefeeds for tab description for better optic
|
-- Bootstrap theme needs 2 or 3 additional linefeeds for tab description for better optic
|
||||||
local LFLF = (CTRL.get_theme() == "Bootstrap") and [[<br /><br /><br />]] or [[]]
|
|
||||||
local HELP = [[<a href="http://www.privoxy.org/user-manual/config.html#%s" target="_blank">%s</a>]]
|
local HELP = [[<a href="http://www.privoxy.org/user-manual/config.html#%s" target="_blank">%s</a>]]
|
||||||
|
|
||||||
-- cbi-map -- ##################################################################
|
local VERINST = CTRL.ipkg_ver_installed("privoxy")
|
||||||
local m = Map("privoxy")
|
local VEROK = CTRL.ipkg_ver_compare(VERINST,">=",CTRL.PRIVOXY_MIN)
|
||||||
m.title = [[</a><a href="javascript:alert(']]
|
|
||||||
|
local TITLE = [[</a><a href="javascript:alert(']]
|
||||||
.. translate("Version Information")
|
.. translate("Version Information")
|
||||||
.. [[\n\nluci-app-privoxy]]
|
.. [[\n\nluci-app-privoxy]]
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]]
|
.. [[\n\t]] .. translate("Version") .. [[:\t]]
|
||||||
.. SYS.exec([[opkg list-installed ]] .. [[luci-app-privoxy]] .. [[ | cut -d " " -f 3 ]])
|
.. CTRL.ipkg_ver_installed("luci-app-privoxy")
|
||||||
.. [[\n\nprivoxy ]] .. translate("required") .. [[:]]
|
.. [[\n\nprivoxy ]] .. translate("required") .. [[:]]
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.PRIVOXY_MIN .. [[ ]] .. translate("or higher")
|
.. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.PRIVOXY_MIN .. [[ ]] .. translate("or higher")
|
||||||
.. [[\n\nprivoxy ]] .. translate("installed") .. [[:]]
|
.. [[\n\nprivoxy ]] .. translate("installed") .. [[:]]
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]]
|
.. [[\n\t]] .. translate("Version") .. [[:\t]] .. VERINST
|
||||||
.. SYS.exec([[opkg list-installed ]] .. [[privoxy]] .. [[ | cut -d " " -f 3 ]])
|
|
||||||
.. [[\n\n]]
|
.. [[\n\n]]
|
||||||
.. [[')">]]
|
.. [[')">]]
|
||||||
.. translate("Privoxy WEB proxy")
|
.. translate("Privoxy WEB proxy")
|
||||||
m.description = translate("Privoxy is a non-caching web proxy with advanced filtering "
|
|
||||||
|
local DESC = translate("Privoxy is a non-caching web proxy with advanced filtering "
|
||||||
.. "capabilities for enhancing privacy, modifying web page data and HTTP headers, "
|
.. "capabilities for enhancing privacy, modifying web page data and HTTP headers, "
|
||||||
.. "controlling access, and removing ads and other obnoxious Internet junk.")
|
.. "controlling access, and removing ads and other obnoxious Internet junk.")
|
||||||
.. [[<br /><strong>]]
|
.. [[<br /><strong>]]
|
||||||
.. translate("For help use link at the relevant option")
|
.. translate("For help use link at the relevant option")
|
||||||
.. [[</strong>]]
|
.. [[</strong>]]
|
||||||
|
|
||||||
|
-- Error handling if wrong privoxy version installed -- ########################
|
||||||
|
if not nixio.fs.access("/etc/config/privoxy") or not VEROK then
|
||||||
|
local f = SimpleForm("_no_config")
|
||||||
|
f.title = TITLE
|
||||||
|
f.description = DESC
|
||||||
|
f.submit = false
|
||||||
|
f.reset = false
|
||||||
|
|
||||||
|
local s = f:section(SimpleSection)
|
||||||
|
s.title = [[<font color="red">]] .. [[<strong>]]
|
||||||
|
.. translate("Software update required")
|
||||||
|
.. [[</strong>]] .. [[</font>]]
|
||||||
|
|
||||||
|
local v = s:option(DummyValue, "_update_needed")
|
||||||
|
v.titleref = DISP.build_url("admin", "system", "packages")
|
||||||
|
v.rawhtml = true
|
||||||
|
v.value = [[<h3><strong><br /><br /> ]]
|
||||||
|
.. translate("The currently installed 'privoxy' package is not supported by LuCI application.")
|
||||||
|
.. [[<br /><br /> ]]
|
||||||
|
.. translate("required") .. ": " .. CTRL.PRIVOXY_MIN .. " *** ".. translate("installed") .. ": " .. VERINST
|
||||||
|
.. [[<br /><br /> ]]
|
||||||
|
.. translate("Please update to the current version!")
|
||||||
|
.. [[<br /><br /></strong></h3>]]
|
||||||
|
return f
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cbi-map -- ##################################################################
|
||||||
|
local m = Map("privoxy")
|
||||||
|
m.title = TITLE
|
||||||
|
m.description = DESC
|
||||||
function m.commit_handler(self)
|
function m.commit_handler(self)
|
||||||
if self.changed then -- changes ?
|
if self.changed then -- changes ?
|
||||||
os.execute("/etc/init.d/privoxy reload &") -- reload configuration
|
os.execute("/etc/init.d/privoxy reload &") -- reload configuration
|
||||||
|
@ -45,8 +77,7 @@ ns:tab("local",
|
||||||
translate("Local Set-up"),
|
translate("Local Set-up"),
|
||||||
translate("If you intend to operate Privoxy for more users than just yourself, "
|
translate("If you intend to operate Privoxy for more users than just yourself, "
|
||||||
.. "it might be a good idea to let them know how to reach you, what you block "
|
.. "it might be a good idea to let them know how to reach you, what you block "
|
||||||
.. "and why you do that, your policies, etc.")
|
.. "and why you do that, your policies, etc.") )
|
||||||
.. LFLF )
|
|
||||||
local function err_tab_local(title, msg)
|
local function err_tab_local(title, msg)
|
||||||
return string.format(translate("Local Set-up") .. " - %s: %s", title, msg )
|
return string.format(translate("Local Set-up") .. " - %s: %s", title, msg )
|
||||||
end
|
end
|
||||||
|
@ -55,16 +86,14 @@ ns:tab("filter",
|
||||||
translate("Files and Directories"),
|
translate("Files and Directories"),
|
||||||
translate("Privoxy can (and normally does) use a number of other files "
|
translate("Privoxy can (and normally does) use a number of other files "
|
||||||
.. "for additional configuration, help and logging. This section of "
|
.. "for additional configuration, help and logging. This section of "
|
||||||
.. "the configuration file tells Privoxy where to find those other files.")
|
.. "the configuration file tells Privoxy where to find those other files.") )
|
||||||
.. LFLF )
|
|
||||||
local function err_tab_filter(title, msg)
|
local function err_tab_filter(title, msg)
|
||||||
return string.format(translate("Files and Directories") .. " - %s: %s", title, msg )
|
return string.format(translate("Files and Directories") .. " - %s: %s", title, msg )
|
||||||
end
|
end
|
||||||
|
|
||||||
ns:tab("access",
|
ns:tab("access",
|
||||||
translate("Access Control"),
|
translate("Access Control"),
|
||||||
translate("This tab controls the security-relevant aspects of Privoxy's configuration.")
|
translate("This tab controls the security-relevant aspects of Privoxy's configuration.") )
|
||||||
.. LFLF )
|
|
||||||
local function err_tab_access(title, msg)
|
local function err_tab_access(title, msg)
|
||||||
return string.format(translate("Access Control") .. " - %s: %s", title, msg )
|
return string.format(translate("Access Control") .. " - %s: %s", title, msg )
|
||||||
end
|
end
|
||||||
|
@ -73,8 +102,7 @@ ns:tab("forward",
|
||||||
translate("Forwarding"),
|
translate("Forwarding"),
|
||||||
translate("Configure here the routing of HTTP requests through a chain of multiple proxies. "
|
translate("Configure here the routing of HTTP requests through a chain of multiple proxies. "
|
||||||
.. "Note that parent proxies can severely decrease your privacy level. "
|
.. "Note that parent proxies can severely decrease your privacy level. "
|
||||||
.. "Also specified here are SOCKS proxies.")
|
.. "Also specified here are SOCKS proxies.") )
|
||||||
.. LFLF )
|
|
||||||
|
|
||||||
ns:tab("misc",
|
ns:tab("misc",
|
||||||
translate("Miscellaneous"),
|
translate("Miscellaneous"),
|
||||||
|
@ -175,7 +203,7 @@ piu.optional = true
|
||||||
piu.rmempty = true
|
piu.rmempty = true
|
||||||
|
|
||||||
-- trust-info-url --------------------------------------------------------------
|
-- trust-info-url --------------------------------------------------------------
|
||||||
local tiu = ns:taboption("local", DynamicList, "trust_info_url")
|
local tiu = ns:taboption("local", Value, "trust_info_url")
|
||||||
tiu.title = string.format(HELP, "TRUST-INFO-URL", "Trust Info URLs" )
|
tiu.title = string.format(HELP, "TRUST-INFO-URL", "Trust Info URLs" )
|
||||||
tiu.description = translate("A URL to be displayed in the error page that users will see if access to an untrusted page is denied.")
|
tiu.description = translate("A URL to be displayed in the error page that users will see if access to an untrusted page is denied.")
|
||||||
.. [[<br /><strong>]]
|
.. [[<br /><strong>]]
|
||||||
|
@ -240,15 +268,15 @@ function cd.validate(self, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- templdir --------------------------------------------------------------------
|
-- templdir --------------------------------------------------------------------
|
||||||
local td = ns:taboption("filter", Value, "templdir")
|
local tld = ns:taboption("filter", Value, "templdir")
|
||||||
td.title_base = "Template Directory"
|
tld.title_base = "Template Directory"
|
||||||
td.title = string.format(HELP, "TEMPLDIR", td.title_base )
|
tld.title = string.format(HELP, "TEMPLDIR", tld.title_base )
|
||||||
td.description = translate("An alternative directory where the templates are loaded from.")
|
tld.description = translate("An alternative directory where the templates are loaded from.")
|
||||||
.. [[<br />]]
|
.. [[<br />]]
|
||||||
.. translate("No trailing '/', please.")
|
.. translate("No trailing '/', please.")
|
||||||
td.placeholder = "/etc/privoxy/templates"
|
tld.placeholder = "/etc/privoxy/templates"
|
||||||
td.rmempty = true
|
tld.rmempty = true
|
||||||
function td.validate(self, value)
|
function tld.validate(self, value)
|
||||||
if not NXFS.access(value) then
|
if not NXFS.access(value) then
|
||||||
return nil, err_tab_filter(self.title_base, translate("Directory does not exist!") )
|
return nil, err_tab_filter(self.title_base, translate("Directory does not exist!") )
|
||||||
else
|
else
|
||||||
|
@ -256,6 +284,16 @@ function td.validate(self, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- temporary-directory ---------------------------------------------------------
|
||||||
|
local td = ns:taboption("filter", Value, "temporary_directory")
|
||||||
|
td.title_base = "Temporary Directory"
|
||||||
|
td.title = string.format(HELP, "TEMPORARY-DIRECTORY", td.title_base )
|
||||||
|
td.description = translate("A directory where Privoxy can create temporary files.")
|
||||||
|
.. [[<br /><strong>]]
|
||||||
|
.. translate("Only when using 'external filters', Privoxy has to create temporary files.")
|
||||||
|
.. [[</strong>]]
|
||||||
|
td.rmempty = true
|
||||||
|
|
||||||
-- actionsfile -----------------------------------------------------------------
|
-- actionsfile -----------------------------------------------------------------
|
||||||
local af = ns:taboption("filter", DynamicList, "actionsfile")
|
local af = ns:taboption("filter", DynamicList, "actionsfile")
|
||||||
af.title_base = "Action Files"
|
af.title_base = "Action Files"
|
||||||
|
@ -343,7 +381,7 @@ tf.description = translate("The trust mechanism is an experimental feature for b
|
||||||
.. [[<br /><strong>]]
|
.. [[<br /><strong>]]
|
||||||
.. translate("It is NOT recommended for the casual user.")
|
.. translate("It is NOT recommended for the casual user.")
|
||||||
.. [[</strong>]]
|
.. [[</strong>]]
|
||||||
tf.placeholder = "sites.trust"
|
tf.placeholder = "user.trust"
|
||||||
tf.rmempty = true
|
tf.rmempty = true
|
||||||
function tf.validate(self, value)
|
function tf.validate(self, value)
|
||||||
local confdir = cd:formvalue(ns.section)
|
local confdir = cd:formvalue(ns.section)
|
||||||
|
@ -767,133 +805,144 @@ function st.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 1 ---------------------------------------------------------------------
|
||||||
local d1 = ns:taboption("debug", Flag, "debug_1")
|
local d0 = ns:taboption("debug", Flag, "debug_1")
|
||||||
d1.title = string.format(HELP, "DEBUG", "Debug 1" )
|
d0.title = string.format(HELP, "DEBUG", "Debug 1" )
|
||||||
d1.description = translate("Log the destination for each request Privoxy let through. See also 'Debug 1024'.")
|
d0.description = translate("Log the destination for each request Privoxy let through. See also 'Debug 1024'.")
|
||||||
|
d0.rmempty = true
|
||||||
|
function d0.parse(self, section)
|
||||||
|
CTRL.flag_parse(self, section)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- debug 2 ---------------------------------------------------------------------
|
||||||
|
local d1 = ns:taboption("debug", Flag, "debug_2")
|
||||||
|
d1.title = string.format(HELP, "DEBUG", "Debug 2" )
|
||||||
|
d1.description = translate("Show each connection status")
|
||||||
d1.rmempty = true
|
d1.rmempty = true
|
||||||
function d1.parse(self, section)
|
function d1.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 4 ---------------------------------------------------------------------
|
||||||
local d2 = ns:taboption("debug", Flag, "debug_2")
|
local d2 = ns:taboption("debug", Flag, "debug_4")
|
||||||
d2.title = string.format(HELP, "DEBUG", "Debug 2" )
|
d2.title = string.format(HELP, "DEBUG", "Debug 4" )
|
||||||
d2.description = translate("Show each connection status")
|
d2.description = translate("Show I/O status")
|
||||||
d2.rmempty = true
|
d2.rmempty = true
|
||||||
function d2.parse(self, section)
|
function d2.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 8 ---------------------------------------------------------------------
|
||||||
local d3 = ns:taboption("debug", Flag, "debug_4")
|
local d3 = ns:taboption("debug", Flag, "debug_8")
|
||||||
d3.title = string.format(HELP, "DEBUG", "Debug 4" )
|
d3.title = string.format(HELP, "DEBUG", "Debug 8" )
|
||||||
d3.description = translate("Show I/O status")
|
d3.description = translate("Show header parsing")
|
||||||
d3.rmempty = true
|
d3.rmempty = true
|
||||||
function d3.parse(self, section)
|
function d3.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 16 --------------------------------------------------------------------
|
||||||
local d4 = ns:taboption("debug", Flag, "debug_8")
|
local d4 = ns:taboption("debug", Flag, "debug_16")
|
||||||
d4.title = string.format(HELP, "DEBUG", "Debug 8" )
|
d4.title = string.format(HELP, "DEBUG", "Debug 16" )
|
||||||
d4.description = translate("Show header parsing")
|
d4.description = translate("Log all data written to the network")
|
||||||
d4.rmempty = true
|
d4.rmempty = true
|
||||||
function d4.parse(self, section)
|
function d4.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 32 --------------------------------------------------------------------
|
||||||
local d5 = ns:taboption("debug", Flag, "debug_16")
|
local d5 = ns:taboption("debug", Flag, "debug_32")
|
||||||
d5.title = string.format(HELP, "DEBUG", "Debug 16" )
|
d5.title = string.format(HELP, "DEBUG", "Debug 32" )
|
||||||
d5.description = translate("Log all data written to the network")
|
d5.description = translate("Debug force feature")
|
||||||
d5.rmempty = true
|
d5.rmempty = true
|
||||||
function d5.parse(self, section)
|
function d5.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 64 --------------------------------------------------------------------
|
||||||
local d6 = ns:taboption("debug", Flag, "debug_32")
|
local d6 = ns:taboption("debug", Flag, "debug_64")
|
||||||
d6.title = string.format(HELP, "DEBUG", "Debug 32" )
|
d6.title = string.format(HELP, "DEBUG", "Debug 64" )
|
||||||
d6.description = translate("Debug force feature")
|
d6.description = translate("Debug regular expression filters")
|
||||||
d6.rmempty = true
|
d6.rmempty = true
|
||||||
function d6.parse(self, section)
|
function d6.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 128 -------------------------------------------------------------------
|
||||||
local d7 = ns:taboption("debug", Flag, "debug_64")
|
local d7 = ns:taboption("debug", Flag, "debug_128")
|
||||||
d7.title = string.format(HELP, "DEBUG", "Debug 64" )
|
d7.title = string.format(HELP, "DEBUG", "Debug 128" )
|
||||||
d7.description = translate("Debug regular expression filters")
|
d7.description = translate("Debug redirects")
|
||||||
d7.rmempty = true
|
d7.rmempty = true
|
||||||
function d7.parse(self, section)
|
function d7.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 256 -------------------------------------------------------------------
|
||||||
local d8 = ns:taboption("debug", Flag, "debug_128")
|
local d8 = ns:taboption("debug", Flag, "debug_256")
|
||||||
d8.title = string.format(HELP, "DEBUG", "Debug 128" )
|
d8.title = string.format(HELP, "DEBUG", "Debug 256" )
|
||||||
d8.description = translate("Debug redirects")
|
d8.description = translate("Debug GIF de-animation")
|
||||||
d8.rmempty = true
|
d8.rmempty = true
|
||||||
function d8.parse(self, section)
|
function d8.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 512 -------------------------------------------------------------------
|
||||||
local d9 = ns:taboption("debug", Flag, "debug_256")
|
local d9 = ns:taboption("debug", Flag, "debug_512")
|
||||||
d9.title = string.format(HELP, "DEBUG", "Debug 256" )
|
d9.title = string.format(HELP, "DEBUG", "Debug 512" )
|
||||||
d9.description = translate("Debug GIF de-animation")
|
d9.description = translate("Common Log Format")
|
||||||
d9.rmempty = true
|
d9.rmempty = true
|
||||||
function d9.parse(self, section)
|
function d9.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 1024 ------------------------------------------------------------------
|
||||||
local d10 = ns:taboption("debug", Flag, "debug_512")
|
local d10 = ns:taboption("debug", Flag, "debug_1024")
|
||||||
d10.title = string.format(HELP, "DEBUG", "Debug 512" )
|
d10.title = string.format(HELP, "DEBUG", "Debug 1024" )
|
||||||
d10.description = translate("Common Log Format")
|
d10.description = translate("Log the destination for requests Privoxy didn't let through, and the reason why.")
|
||||||
d10.rmempty = true
|
d10.rmempty = true
|
||||||
function d10.parse(self, section)
|
function d10.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 2048 ------------------------------------------------------------------
|
||||||
local d11 = ns:taboption("debug", Flag, "debug_1024")
|
local d11 = ns:taboption("debug", Flag, "debug_2048")
|
||||||
d11.title = string.format(HELP, "DEBUG", "Debug 1024" )
|
d11.title = string.format(HELP, "DEBUG", "Debug 2048" )
|
||||||
d11.description = translate("Log the destination for requests Privoxy didn't let through, and the reason why.")
|
d11.description = translate("CGI user interface")
|
||||||
d11.rmempty = true
|
d11.rmempty = true
|
||||||
function d11.parse(self, section)
|
function d11.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 4096 ------------------------------------------------------------------
|
||||||
local d12 = ns:taboption("debug", Flag, "debug_2048")
|
local d12 = ns:taboption("debug", Flag, "debug_4096")
|
||||||
d12.title = string.format(HELP, "DEBUG", "Debug 2048" )
|
d12.title = string.format(HELP, "DEBUG", "Debug 4096" )
|
||||||
d12.description = translate("CGI user interface")
|
d12.description = translate("Startup banner and warnings.")
|
||||||
d12.rmempty = true
|
d12.rmempty = true
|
||||||
function d12.parse(self, section)
|
function d12.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 8192 ------------------------------------------------------------------
|
||||||
local d13 = ns:taboption("debug", Flag, "debug_4096")
|
local d13 = ns:taboption("debug", Flag, "debug_8192")
|
||||||
d13.title = string.format(HELP, "DEBUG", "Debug 4096" )
|
d13.title = string.format(HELP, "DEBUG", "Debug 8192" )
|
||||||
d13.description = translate("Startup banner and warnings.")
|
d13.description = translate("Non-fatal errors - *we highly recommended enabling this*")
|
||||||
d13.rmempty = true
|
d13.rmempty = true
|
||||||
function d13.parse(self, section)
|
function d13.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 16384 -----------------------------------------------------------------
|
||||||
local d14 = ns:taboption("debug", Flag, "debug_8192")
|
--[[ TODO ???
|
||||||
d14.title = string.format(HELP, "DEBUG", "Debug 8192" )
|
local d14 = ns:taboption("debug", Flag, "debug_16384")
|
||||||
d14.description = translate("Non-fatal errors - *we highly recommended enabling this*")
|
d14.title = string.format(HELP, "DEBUG", "Debug 16384" )
|
||||||
|
d14.description = translate("")
|
||||||
d14.rmempty = true
|
d14.rmempty = true
|
||||||
function d14.parse(self, section)
|
function d14.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 32768 -----------------------------------------------------------------
|
||||||
local d15 = ns:taboption("debug", Flag, "debug_32768")
|
local d15 = ns:taboption("debug", Flag, "debug_32768")
|
||||||
d15.title = string.format(HELP, "DEBUG", "Debug 32768" )
|
d15.title = string.format(HELP, "DEBUG", "Debug 32768" )
|
||||||
d15.description = translate("Log all data read from the network")
|
d15.description = translate("Log all data read from the network")
|
||||||
|
@ -902,7 +951,7 @@ function d15.parse(self, section)
|
||||||
CTRL.flag_parse(self, section)
|
CTRL.flag_parse(self, section)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- debug -----------------------------------------------------------------------
|
-- debug 65536 -----------------------------------------------------------------
|
||||||
local d16 = ns:taboption("debug", Flag, "debug_65536")
|
local d16 = ns:taboption("debug", Flag, "debug_65536")
|
||||||
d16.title = string.format(HELP, "DEBUG", "Debug 65536" )
|
d16.title = string.format(HELP, "DEBUG", "Debug 65536" )
|
||||||
d16.description = translate("Log the applying actions")
|
d16.description = translate("Log the applying actions")
|
|
@ -1,47 +0,0 @@
|
||||||
-- Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
|
||||||
-- Licensed under the Apache License, Version 2.0
|
|
||||||
|
|
||||||
local CTRL = require "luci.controller.privoxy" -- this application's controller
|
|
||||||
local DISP = require "luci.dispatcher"
|
|
||||||
local SYS = require "luci.sys"
|
|
||||||
|
|
||||||
local HELP = [[<a href="http://www.privoxy.org/user-manual/config.html#%s" target="_blank">%s</a>]]
|
|
||||||
|
|
||||||
-- cbi-map -- ##################################################################
|
|
||||||
local m = Map("privoxy")
|
|
||||||
m.title = [[</a><a href="javascript:alert(']]
|
|
||||||
.. translate("Version Information")
|
|
||||||
.. [[\n\nluci-app-privoxy]]
|
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]]
|
|
||||||
.. SYS.exec([[opkg list-installed ]] .. [[luci-app-privoxy]] .. [[ | cut -d " " -f 3 ]])
|
|
||||||
.. [[\n\nprivoxy ]] .. translate("required") .. [[:]]
|
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.PRIVOXY_MIN .. [[ ]] .. translate("or higher")
|
|
||||||
.. [[\n\nprivoxy ]] .. translate("installed") .. [[:]]
|
|
||||||
.. [[\n\t]] .. translate("Version") .. [[:\t]]
|
|
||||||
.. SYS.exec([[opkg list-installed ]] .. [[privoxy]] .. [[ | cut -d " " -f 3 ]])
|
|
||||||
.. [[\n\n]]
|
|
||||||
.. [[')">]]
|
|
||||||
.. translate("Privoxy WEB proxy")
|
|
||||||
m.description = translate("Privoxy is a non-caching web proxy with advanced filtering "
|
|
||||||
.. "capabilities for enhancing privacy, modifying web page data and HTTP headers, "
|
|
||||||
.. "controlling access, and removing ads and other obnoxious Internet junk.")
|
|
||||||
|
|
||||||
-- cbi-section -- ##############################################################
|
|
||||||
local s = m:section(SimpleSection)
|
|
||||||
s.title = [[<font color="red">]] .. [[<strong>]]
|
|
||||||
.. translate("Software update required")
|
|
||||||
.. [[</strong>]] .. [[</font>]]
|
|
||||||
|
|
||||||
-- old privoxy sofware version --------------------------------------------------------------
|
|
||||||
local v = s:option(DummyValue, "_update_needed")
|
|
||||||
v.titleref = DISP.build_url("admin", "system", "packages")
|
|
||||||
v.rawhtml = true
|
|
||||||
--v.title = [[<h3>]] .. [[<font color="red">]] .. [[<strong>]]
|
|
||||||
-- .. translate("Software update required")
|
|
||||||
-- .. [[</strong>]] .. [[</font>]] .. [[</h3>]] .. [[<br />]]
|
|
||||||
v.value = [[<h3>]] .. [[<strong>]]
|
|
||||||
.. translate("The currently installed 'privoxy' package is not supported by LuCI application.")
|
|
||||||
.. [[<br />]]
|
|
||||||
.. translate("Please update to the current version!")
|
|
||||||
.. [[</strong>]] .. [[</h3>]]
|
|
||||||
return m
|
|
Loading…
Reference in a new issue