- local _sys = require "luci.sys"
- local _verinst = _sys.exec([[opkg list-installed ]] .. "privoxy" .. [[ | cut -d " " -f 3 ]])
- local _cmd = [[opkg compare-versions "]] .. _verinst .. [[" ">=" "]] .. "3.0.22-0" .. [["]]
- local _verok = tonumber(_sys.call(_cmd))
-
- -- 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)
+ entry( {"admin", "services", "privoxy"}, cbi("privoxy"), _("Privoxy WEB proxy"), 59)
+ entry( {"admin", "services", "privoxy", "logview"}, call("logread") ).leaf = true
+ entry( {"admin", "services", "privoxy", "startstop"}, post("startstop") ).leaf = true
+ entry( {"admin", "services", "privoxy", "status"}, call("get_pid") ).leaf = true
+end
+
+-- Application specific information functions
+function app_description()
+ return I18N.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.")
+ .. [[<br /><strong>]]
+ .. I18N.translate("For help use link at the relevant option")
+ .. [[</strong>]]
+end
+
+-- Standardized application/service functions
+function app_title_main()
+ return [[<a href="javascript:alert(']]
+ .. I18N.translate("Version Information")
+ .. [[\n\n]] .. app_name
+ .. [[\n\t]] .. I18N.translate("Version") .. [[:\t]] .. app_version
+ .. [[\n\n]] .. srv_name .. [[ ]] .. I18N.translate("required") .. [[:]]
+ .. [[\n\t]] .. I18N.translate("Version") .. [[:\t]]
+ .. srv_ver_min .. [[ ]] .. I18N.translate("or higher")
+ .. [[\n\n]] .. srv_name .. [[ ]] .. I18N.translate("installed") .. [[:]]
+ .. [[\n\t]] .. I18N.translate("Version") .. [[:\t]]
+ .. (service_version() or I18N.translate("NOT installed"))
+ .. [[\n\n]]
+ .. [[')">]]
+ .. I18N.translate(app_title)
+ .. [[</a>]]
+end
+function service_version()
+ local ver = nil
+ IPKG.list_installed(srv_name, function(n, v, d)
+ if v and (#v > 0) then ver = v end
+ end
+ )
+ if not ver or (#ver == 0) then
+ ver = UTIL.exec(srv_ver_cmd)
+ if #ver == 0 then ver = nil end
+ end
+ return ver
+end
+function service_ok()
+ return IPKG.compare_versions((service_version() or "0"), ">=", srv_ver_min)
+end
+function service_update()
+ local url = DISP.build_url("admin", "system", "packages")
+ if not service_version() then
+ return [[<h3><strong><br /><font color="red"> ]]
+ .. I18N.translate("Software package '%s' is not installed." % srv_name)
+ .. [[</font><br /><br /> ]]
+ .. I18N.translate("required") .. [[: ]] .. srv_name .. [[ ]] .. srv_ver_min .. " " .. I18N.translate("or higher")
+ .. [[<br /><br /> ]]
+ .. [[<a href="]] .. url ..[[">]]
+ .. I18N.translate("Please install current version !")
+ .. [[</a><br /> </strong></h3>]]