|
@@ -0,0 +1,940 @@
|
|
1
|
+--[[
|
|
2
|
+LuCI - Lua Configuration Interface
|
|
3
|
+
|
|
4
|
+Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
|
5
|
+
|
|
6
|
+Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+you may not use this file except in compliance with the License.
|
|
8
|
+You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+ http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+$Id$
|
|
13
|
+]]--
|
|
14
|
+
|
|
15
|
+local NXFS = require "nixio.fs"
|
|
16
|
+local LUFS = require "luci.fs"
|
|
17
|
+local SYS = require "luci.sys"
|
|
18
|
+local UTIL = require "luci.util"
|
|
19
|
+local DTYP = require "luci.cbi.datatypes"
|
|
20
|
+local CTRL = require "luci.controller.privoxy" -- privoxy multiused functions
|
|
21
|
+
|
|
22
|
+-- Bootstrap theme needs 2 or 3 additional linefeeds for tab description for better optic
|
|
23
|
+local LFLF = (CTRL.get_theme() == "Bootstrap") and [[<br /><br /><br />]] or [[]]
|
|
24
|
+-- Build javascript string to be displayed as version information
|
|
25
|
+local VERSION = translate("Version Information")
|
|
26
|
+ .. [[\n\nluci-app-privoxy]]
|
|
27
|
+ .. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.version_luci_app
|
|
28
|
+ .. [[\n\t]] .. translate("Build") .. [[:\t]] .. CTRL.ipkg_version("luci-app-privoxy").version
|
|
29
|
+ .. [[\n\nprivoxy ]] .. translate("required") .. [[:]]
|
|
30
|
+ .. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.version_required .. [[ ]] .. translate("or greater")
|
|
31
|
+ .. [[\n\nprivoxy ]] .. translate("installed") .. [[:]]
|
|
32
|
+ .. [[\n\t]] .. translate("Version") .. [[:\t]] .. CTRL.ipkg_version("privoxy").version
|
|
33
|
+ .. [[\n\n]]
|
|
34
|
+local HELP = [[<a href="http://www.privoxy.org/user-manual/config.html#%s" target="_blank">%s</a>]]
|
|
35
|
+
|
|
36
|
+-- cbi-map -- ##################################################################
|
|
37
|
+local m = Map("privoxy")
|
|
38
|
+m.title = [[</a><a href="javascript:alert(']]
|
|
39
|
+ .. VERSION
|
|
40
|
+ .. [[')">]]
|
|
41
|
+ .. translate("Privoxy WEB proxy")
|
|
42
|
+m.description = translate("Privoxy is a non-caching web proxy with advanced filtering "
|
|
43
|
+ .. "capabilities for enhancing privacy, modifying web page data and HTTP headers, "
|
|
44
|
+ .. "controlling access, and removing ads and other obnoxious Internet junk.")
|
|
45
|
+ .. [[<br /><strong>]]
|
|
46
|
+ .. translate("For help use link at the relevant option")
|
|
47
|
+ .. [[</strong>]]
|
|
48
|
+function m.commit_handler(self)
|
|
49
|
+ if self.changed then -- changes ?
|
|
50
|
+ os.execute("/etc/init.d/privoxy reload &") -- reload configuration
|
|
51
|
+ end
|
|
52
|
+end
|
|
53
|
+
|
|
54
|
+-- cbi-section -- ##############################################################
|
|
55
|
+local ns = m:section( NamedSection, "privoxy", "privoxy")
|
|
56
|
+
|
|
57
|
+ns:tab("local",
|
|
58
|
+ translate("Local Set-up"),
|
|
59
|
+ translate("If you intend to operate Privoxy for more users than just yourself, "
|
|
60
|
+ .. "it might be a good idea to let them know how to reach you, what you block "
|
|
61
|
+ .. "and why you do that, your policies, etc.")
|
|
62
|
+ .. LFLF )
|
|
63
|
+local function err_tab_local(self, msg)
|
|
64
|
+ return string.format(translate("Local Set-up") .. " - %s: %s", self.title_base, msg )
|
|
65
|
+end
|
|
66
|
+
|
|
67
|
+ns:tab("filter",
|
|
68
|
+ translate("Files and Directories"),
|
|
69
|
+ translate("Privoxy can (and normally does) use a number of other files "
|
|
70
|
+ .. "for additional configuration, help and logging. This section of "
|
|
71
|
+ .. "the configuration file tells Privoxy where to find those other files.")
|
|
72
|
+ .. LFLF )
|
|
73
|
+local function err_tab_filter(self, msg)
|
|
74
|
+ return string.format(translate("Files and Directories") .. " - %s: %s", self.title_base, msg )
|
|
75
|
+end
|
|
76
|
+
|
|
77
|
+ns:tab("access",
|
|
78
|
+ translate("Access Control"),
|
|
79
|
+ translate("This tab controls the security-relevant aspects of Privoxy's configuration.")
|
|
80
|
+ .. LFLF )
|
|
81
|
+local function err_tab_access(self, msg)
|
|
82
|
+ return string.format(translate("Access Control") .. " - %s: %s", self.title_base, msg )
|
|
83
|
+end
|
|
84
|
+
|
|
85
|
+ns:tab("forward",
|
|
86
|
+ translate("Forwarding"),
|
|
87
|
+ translate("Configure here the routing of HTTP requests through a chain of multiple proxies. "
|
|
88
|
+ .. "Note that parent proxies can severely decrease your privacy level. "
|
|
89
|
+ .. "Also specified here are SOCKS proxies.")
|
|
90
|
+ .. LFLF )
|
|
91
|
+
|
|
92
|
+ns:tab("misc",
|
|
93
|
+ translate("Miscellaneous"),
|
|
94
|
+ nil)
|
|
95
|
+local function err_tab_misc(self, msg)
|
|
96
|
+ return string.format(translate("Miscellaneous") .. " - %s: %s", self.title_base, msg )
|
|
97
|
+end
|
|
98
|
+
|
|
99
|
+ns:tab("debug",
|
|
100
|
+ translate("Logging"),
|
|
101
|
+ nil )
|
|
102
|
+
|
|
103
|
+ns:tab("logview",
|
|
104
|
+ translate("Log File Viewer"),
|
|
105
|
+ nil )
|
|
106
|
+
|
|
107
|
+-- tab: local -- ###############################################################
|
|
108
|
+
|
|
109
|
+-- start/stop button -----------------------------------------------------------
|
|
110
|
+local btn = ns:taboption("local", Button, "_startstop")
|
|
111
|
+btn.title = translate("Start / Stop")
|
|
112
|
+btn.description = translate("Start/Stop Privoxy WEB Proxy")
|
|
113
|
+btn.template = "privoxy/detail_startstop"
|
|
114
|
+function btn.cfgvalue(self, section)
|
|
115
|
+ local pid = CTRL.get_pid(true)
|
|
116
|
+ if pid > 0 then
|
|
117
|
+ btn.inputtitle = "PID: " .. pid
|
|
118
|
+ btn.inputstyle = "reset"
|
|
119
|
+ btn.disabled = false
|
|
120
|
+ else
|
|
121
|
+ btn.inputtitle = translate("Start")
|
|
122
|
+ btn.inputstyle = "apply"
|
|
123
|
+ btn.disabled = false
|
|
124
|
+ end
|
|
125
|
+ return true
|
|
126
|
+end
|
|
127
|
+
|
|
128
|
+-- enabled ---------------------------------------------------------------------
|
|
129
|
+local ena = ns:taboption("local", Flag, "_enabled")
|
|
130
|
+ena.title = translate("Enabled")
|
|
131
|
+ena.description = translate("Enable/Disable autostart of Privoxy on system startup and interface events")
|
|
132
|
+ena.orientation = "horizontal" -- put description under the checkbox
|
|
133
|
+ena.rmempty = false
|
|
134
|
+function ena.cfgvalue(self, section)
|
|
135
|
+ return (SYS.init.enabled("privoxy")) and "1" or "0"
|
|
136
|
+end
|
|
137
|
+function ena.validate(self, value)
|
|
138
|
+ error("Validate " .. value)
|
|
139
|
+end
|
|
140
|
+function ena.write(self, section, value)
|
|
141
|
+ --error("Write " .. value)
|
|
142
|
+ if value == "1" then
|
|
143
|
+ return SYS.init.enable("privoxy")
|
|
144
|
+ else
|
|
145
|
+ return SYS.init.disable("privoxy")
|
|
146
|
+ end
|
|
147
|
+end
|
|
148
|
+
|
|
149
|
+-- hostname --------------------------------------------------------------------
|
|
150
|
+local hn = ns:taboption("local", Value, "hostname")
|
|
151
|
+hn.title = string.format(HELP, "HOSTNAME", "Hostname" )
|
|
152
|
+hn.description = translate("The hostname shown on the CGI pages.")
|
|
153
|
+hn.placeholder = SYS.hostname()
|
|
154
|
+hn.optional = true
|
|
155
|
+hn.rmempty = true
|
|
156
|
+
|
|
157
|
+-- user-manual -----------------------------------------------------------------
|
|
158
|
+local um = ns:taboption("local", Value, "user_manual")
|
|
159
|
+um.title = string.format(HELP, "USER-MANUAL", "User Manual" )
|
|
160
|
+um.description = translate("Location of the Privoxy User Manual.")
|
|
161
|
+um.placeholder = "http://www.privoxy.org/user-manual/"
|
|
162
|
+um.optional = true
|
|
163
|
+um.rmempty = true
|
|
164
|
+
|
|
165
|
+-- admin-address ---------------------------------------------------------------
|
|
166
|
+local aa = ns:taboption("local", Value, "admin_address")
|
|
167
|
+aa.title_base = "Admin Email"
|
|
168
|
+aa.title = string.format(HELP, "ADMIN-ADDRESS", aa.title_base )
|
|
169
|
+aa.description = translate("An email address to reach the Privoxy administrator.")
|
|
170
|
+aa.placeholder = "privoxy.admin@example.com"
|
|
171
|
+aa.optional = true
|
|
172
|
+aa.rmempty = true
|
|
173
|
+function aa.validate(self, value)
|
|
174
|
+ if not value or #value == 0 then
|
|
175
|
+ return ""
|
|
176
|
+ end
|
|
177
|
+ if not (value:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then
|
|
178
|
+ return nil, err_tab_local(self, translate("Invalid email address") )
|
|
179
|
+ end
|
|
180
|
+ return value
|
|
181
|
+end
|
|
182
|
+
|
|
183
|
+-- proxy-info-url --------------------------------------------------------------
|
|
184
|
+local piu = ns:taboption("local", Value, "proxy_info_url")
|
|
185
|
+piu.title = string.format(HELP, "PROXY-INFO-URL", "Proxy Info URL" )
|
|
186
|
+piu.description = translate("A URL to documentation about the local Privoxy setup, configuration or policies.")
|
|
187
|
+piu.optional = true
|
|
188
|
+piu.rmempty = true
|
|
189
|
+
|
|
190
|
+-- trust-info-url --------------------------------------------------------------
|
|
191
|
+local tiu = ns:taboption("local", DynamicList, "trust_info_url")
|
|
192
|
+tiu.title = string.format(HELP, "TRUST-INFO-URL", "Trust Info URLs" )
|
|
193
|
+tiu.description = translate("A URL to be displayed in the error page that users will see if access to an untrusted page is denied.")
|
|
194
|
+ .. [[<br /><strong>]]
|
|
195
|
+ .. translate("The value of this option only matters if the experimental trust mechanism has been activated.")
|
|
196
|
+ .. [[</strong>]]
|
|
197
|
+tiu.optional = true
|
|
198
|
+tiu.rmepty = true
|
|
199
|
+
|
|
200
|
+-- tab: filter -- ##############################################################
|
|
201
|
+
|
|
202
|
+-- logdir ----------------------------------------------------------------------
|
|
203
|
+local ld = ns:taboption("filter", Value, "logdir")
|
|
204
|
+ld.title_base = "Log Directory"
|
|
205
|
+ld.title = string.format(HELP, "LOGDIR", ld.title_base )
|
|
206
|
+ld.description = translate("The directory where all logging takes place (i.e. where the logfile is located).")
|
|
207
|
+ .. [[<br />]]
|
|
208
|
+ .. translate("No trailing '/', please.")
|
|
209
|
+ld.default = "/var/log"
|
|
210
|
+ld.rmempty = false
|
|
211
|
+function ld.validate(self, value)
|
|
212
|
+ if not value or #value == 0 then
|
|
213
|
+ return nil, err_tab_filter(self, translate("Mandatory Input: No Directory given!") )
|
|
214
|
+ elseif not LUFS.isdirectory(value) then
|
|
215
|
+ return nil, err_tab_filter(self, translate("Directory does not exist!") )
|
|
216
|
+ else
|
|
217
|
+ return value
|
|
218
|
+ end
|
|
219
|
+end
|
|
220
|
+
|
|
221
|
+-- logfile ---------------------------------------------------------------------
|
|
222
|
+local lf = ns:taboption("filter", Value, "logfile")
|
|
223
|
+lf.title_base = "Log File"
|
|
224
|
+lf.title = string.format(HELP, "LOGFILE", lf.title_base )
|
|
225
|
+lf.description = translate("The log file to use. File name, relative to log directory.")
|
|
226
|
+lf.default = "privoxy.log"
|
|
227
|
+lf.rmempty = false
|
|
228
|
+function lf.validate(self, value)
|
|
229
|
+ if not value or #value == 0 then
|
|
230
|
+ return nil, err_tab_filter(self, translate("Mandatory Input: No File given!") )
|
|
231
|
+ else
|
|
232
|
+ return value
|
|
233
|
+ end
|
|
234
|
+end
|
|
235
|
+
|
|
236
|
+-- confdir ---------------------------------------------------------------------
|
|
237
|
+local cd = ns:taboption("filter", Value, "confdir")
|
|
238
|
+cd.title = string.format(HELP, "CONFDIR", "Configuration Directory" )
|
|
239
|
+cd.description = translate("The directory where the other configuration files are located.")
|
|
240
|
+ .. [[<br />]]
|
|
241
|
+ .. translate("No trailing '/', please.")
|
|
242
|
+cd.default = "/etc/privoxy"
|
|
243
|
+cd.rmempty = false
|
|
244
|
+function cd.validate(self, value)
|
|
245
|
+ if not value or #value == 0 then
|
|
246
|
+ return nil, err_tab_filter(self, translate("Mandatory Input: No Directory given!") )
|
|
247
|
+ elseif not LUFS.isdirectory(value) then
|
|
248
|
+ return nil, err_tab_filter(self, translate("Directory does not exist!") )
|
|
249
|
+ else
|
|
250
|
+ return value
|
|
251
|
+ end
|
|
252
|
+end
|
|
253
|
+
|
|
254
|
+-- templdir --------------------------------------------------------------------
|
|
255
|
+local td = ns:taboption("filter", Value, "templdir")
|
|
256
|
+td.title_base = "Template Directory"
|
|
257
|
+td.title = string.format(HELP, "TEMPLDIR", td.title_base )
|
|
258
|
+td.description = translate("An alternative directory where the templates are loaded from.")
|
|
259
|
+ .. [[<br />]]
|
|
260
|
+ .. translate("No trailing '/', please.")
|
|
261
|
+td.placeholder = "/etc/privoxy/templates"
|
|
262
|
+td.rmempty = true
|
|
263
|
+function td.validate(self, value)
|
|
264
|
+ if not LUFS.isdirectory(value) then
|
|
265
|
+ return nil, err_tab_filter(self, translate("Directory does not exist!") )
|
|
266
|
+ else
|
|
267
|
+ return value
|
|
268
|
+ end
|
|
269
|
+end
|
|
270
|
+
|
|
271
|
+-- actionsfile -----------------------------------------------------------------
|
|
272
|
+local af = ns:taboption("filter", DynamicList, "actionsfile")
|
|
273
|
+af.title_base = "Action Files"
|
|
274
|
+af.title = string.format(HELP, "ACTIONSFILE", af.title_base)
|
|
275
|
+af.description = translate("The actions file(s) to use. Multiple actionsfile lines are permitted, and are in fact recommended!")
|
|
276
|
+ .. [[<br /><strong>match-all.action := </strong>]]
|
|
277
|
+ .. translate("Actions that are applied to all sites and maybe overruled later on.")
|
|
278
|
+ .. [[<br /><strong>default.action := </strong>]]
|
|
279
|
+ .. translate("Main actions file")
|
|
280
|
+ .. [[<br /><strong>user.action := </strong>]]
|
|
281
|
+ .. translate("User customizations")
|
|
282
|
+af.rmempty = false
|
|
283
|
+function af.validate(self, value)
|
|
284
|
+ if not value or #value == 0 then
|
|
285
|
+ return nil, err_tab_access(self, translate("Mandatory Input: No files given!") )
|
|
286
|
+ end
|
|
287
|
+ local confdir = cd:formvalue(ns.section)
|
|
288
|
+ local err = false
|
|
289
|
+ local file = ""
|
|
290
|
+ if type(value) == "table" then
|
|
291
|
+ local x
|
|
292
|
+ for _, x in ipairs(value) do
|
|
293
|
+ if x and #x > 0 then
|
|
294
|
+ if not LUFS.isfile(confdir .."/".. x) then
|
|
295
|
+ err = true
|
|
296
|
+ file = x
|
|
297
|
+ break -- break/leave for on error
|
|
298
|
+ end
|
|
299
|
+ end
|
|
300
|
+ end
|
|
301
|
+ else
|
|
302
|
+ if not LUFS.isfile(confdir .."/".. value) then
|
|
303
|
+ err = true
|
|
304
|
+ file = value
|
|
305
|
+ end
|
|
306
|
+ end
|
|
307
|
+ if err then
|
|
308
|
+ return nil, string.format(err_tab_filter(self, translate("File '%s' not found inside Configuration Directory") ), file)
|
|
309
|
+ end
|
|
310
|
+ return value
|
|
311
|
+end
|
|
312
|
+
|
|
313
|
+-- filterfile ------------------------------------------------------------------
|
|
314
|
+local ff = ns:taboption("filter", DynamicList, "filterfile")
|
|
315
|
+ff.title_base = "Filter files"
|
|
316
|
+ff.title = string.format(HELP, "FILTERFILE", ff.title_base )
|
|
317
|
+ff.description = translate("The filter files contain content modification rules that use regular expressions.")
|
|
318
|
+ff.rmempty = false
|
|
319
|
+function ff.validate(self, value)
|
|
320
|
+ if not value or #value == 0 then
|
|
321
|
+ return nil, err_tab_access(self, translate("Mandatory Input: No files given!") )
|
|
322
|
+ end
|
|
323
|
+ local confdir = cd:formvalue(ns.section)
|
|
324
|
+ local err = false
|
|
325
|
+ local file = ""
|
|
326
|
+ if type(value) == "table" then
|
|
327
|
+ local x
|
|
328
|
+ for _, x in ipairs(value) do
|
|
329
|
+ if x and #x > 0 then
|
|
330
|
+ if not LUFS.isfile(confdir .."/".. x) then
|
|
331
|
+ err = true
|
|
332
|
+ file = x
|
|
333
|
+ break -- break/leave for on error
|
|
334
|
+ end
|
|
335
|
+ end
|
|
336
|
+ end
|
|
337
|
+ else
|
|
338
|
+ if not LUFS.isfile(confdir .."/".. value) then
|
|
339
|
+ err = true
|
|
340
|
+ file = value
|
|
341
|
+ end
|
|
342
|
+ end
|
|
343
|
+ if err then
|
|
344
|
+ return nil, string.format(err_tab_filter(self, translate("File '%s' not found inside Configuration Directory") ), file )
|
|
345
|
+ end
|
|
346
|
+ return value
|
|
347
|
+end
|
|
348
|
+
|
|
349
|
+-- trustfile -------------------------------------------------------------------
|
|
350
|
+local tf = ns:taboption("filter", Value, "trustfile")
|
|
351
|
+tf.title_base = "Trust file"
|
|
352
|
+tf.title = string.format(HELP, "TRUSTFILE", tf.title_base )
|
|
353
|
+tf.description = translate("The trust mechanism is an experimental feature for building white-lists "
|
|
354
|
+ .."and should be used with care.")
|
|
355
|
+ .. [[<br /><strong>]]
|
|
356
|
+ .. translate("It is NOT recommended for the casual user.")
|
|
357
|
+ .. [[</strong>]]
|
|
358
|
+tf.placeholder = "sites.trust"
|
|
359
|
+tf.rmempty = true
|
|
360
|
+function tf.validate(self, value)
|
|
361
|
+ local confdir = cd:formvalue(ns.section)
|
|
362
|
+ local err = false
|
|
363
|
+ local file = ""
|
|
364
|
+ if type(value) == "table" then
|
|
365
|
+ local x
|
|
366
|
+ for _, x in ipairs(value) do
|
|
367
|
+ if x and #x > 0 then
|
|
368
|
+ if not LUFS.isfile(confdir .."/".. x) then
|
|
369
|
+ err = true
|
|
370
|
+ file = x
|
|
371
|
+ break -- break/leave for on error
|
|
372
|
+ end
|
|
373
|
+ end
|
|
374
|
+ end
|
|
375
|
+ else
|
|
376
|
+ if not LUFS.isfile(confdir .."/".. value) then
|
|
377
|
+ err = true
|
|
378
|
+ file = value
|
|
379
|
+ end
|
|
380
|
+ end
|
|
381
|
+ if err then
|
|
382
|
+ return nil, string.format(err_tab_filter(self, translate("File '%s' not found inside Configuration Directory") ), file )
|
|
383
|
+ end
|
|
384
|
+ return value
|
|
385
|
+end
|
|
386
|
+
|
|
387
|
+-- tab: access -- ##############################################################
|
|
388
|
+
|
|
389
|
+-- listen-address --------------------------------------------------------------
|
|
390
|
+local la = ns:taboption("access", DynamicList, "listen_address")
|
|
391
|
+la.title_base = "Listen addresses"
|
|
392
|
+la.title = string.format(HELP, "LISTEN-ADDRESS", la.title_base )
|
|
393
|
+la.description = translate("The address and TCP port on which Privoxy will listen for client requests.")
|
|
394
|
+ .. [[<br />]]
|
|
395
|
+ .. translate("Syntax: ")
|
|
396
|
+ .. "IPv4:Port / [IPv6]:Port / Host:Port"
|
|
397
|
+la.default = "127.0.0.1:8118"
|
|
398
|
+la.rmempty = false
|
|
399
|
+function la.validate(self, value)
|
|
400
|
+ if not value or #value == 0 then
|
|
401
|
+ return nil, err_tab_access(self, translate("Mandatory Input: No Data given!") )
|
|
402
|
+ end
|
|
403
|
+
|
|
404
|
+ local function check_value(v)
|
|
405
|
+ local _ret = UTIL.split(v, "]:")
|
|
406
|
+ local _ip
|
|
407
|
+ if _ret[2] then -- ip6 with port
|
|
408
|
+ _ip = string.gsub(_ret[1], "%[", "") -- remove "[" at beginning
|
|
409
|
+ if not DTYP.ip6addr(_ip) then
|
|
410
|
+ return translate("Mandatory Input: No valid IPv6 address given!")
|
|
411
|
+ elseif not DTYP.port(_ret[2]) then
|
|
412
|
+ return translate("Mandatory Input: No valid Port given!")
|
|
413
|
+ else
|
|
414
|
+ return nil
|
|
415
|
+ end
|
|
416
|
+ end
|
|
417
|
+ _ret = UTIL.split(v, ":")
|
|
418
|
+ if not _ret[2] then
|
|
419
|
+ return translate("Mandatory Input: No Port given!")
|
|
420
|
+ end
|
|
421
|
+ if #_ret[1] > 0 and not DTYP.host(_ret[1]) then -- :8118 is valid address
|
|
422
|
+ return translate("Mandatory Input: No valid IPv4 address or host given!")
|
|
423
|
+ elseif not DTYP.port(_ret[2]) then
|
|
424
|
+ return translate("Mandatory Input: No valid Port given!")
|
|
425
|
+ else
|
|
426
|
+ return nil
|
|
427
|
+ end
|
|
428
|
+ end
|
|
429
|
+
|
|
430
|
+ local err = ""
|
|
431
|
+ local entry = ""
|
|
432
|
+ if type(value) == "table" then
|
|
433
|
+ local x
|
|
434
|
+ for _, x in ipairs(value) do
|
|
435
|
+ if x and #x > 0 then
|
|
436
|
+ err = check_value(x)
|
|
437
|
+ if err then
|
|
438
|
+ entry = x
|
|
439
|
+ break
|
|
440
|
+ end
|
|
441
|
+ end
|
|
442
|
+ end
|
|
443
|
+ else
|
|
444
|
+ err = check_value(value)
|
|
445
|
+ entry = value
|
|
446
|
+ end
|
|
447
|
+ if err then
|
|
448
|
+ return nil, string.format(err_tab_access(self, err .. " - %s"), entry )
|
|
449
|
+ end
|
|
450
|
+ return value
|
|
451
|
+end
|
|
452
|
+
|
|
453
|
+-- permit-access ---------------------------------------------------------------
|
|
454
|
+local pa = ns:taboption("access", DynamicList, "permit_access")
|
|
455
|
+pa.title = string.format(HELP, "ACLS", "Permit access" )
|
|
456
|
+pa.description = translate("Who can access what.")
|
|
457
|
+ .. [[<br /><strong>]]
|
|
458
|
+ .. translate("Please read Privoxy manual for details!")
|
|
459
|
+ .. [[</strong>]]
|
|
460
|
+pa.rmempty = true
|
|
461
|
+
|
|
462
|
+-- deny-access -----------------------------------------------------------------
|
|
463
|
+local da = ns:taboption("access", DynamicList, "deny_access")
|
|
464
|
+da.title = string.format(HELP, "ACLS", "Deny Access" )
|
|
465
|
+da.description = translate("Who can access what.")
|
|
466
|
+ .. [[<br /><strong>]]
|
|
467
|
+ .. translate("Please read Privoxy manual for details!")
|
|
468
|
+ .. [[</strong>]]
|
|
469
|
+da.rmempty = true
|
|
470
|
+
|
|
471
|
+-- buffer-limit ----------------------------------------------------------------
|
|
472
|
+local bl = ns:taboption("access", Value, "buffer_limit")
|
|
473
|
+bl.title_base = "Buffer Limit"
|
|
474
|
+bl.title = string.format(HELP, "BUFFER-LIMIT", bl.title_base )
|
|
475
|
+bl.description = translate("Maximum size (in KB) of the buffer for content filtering.")
|
|
476
|
+ .. [[<br />]]
|
|
477
|
+ .. translate("Value range 1 to 4096, no entry defaults to 4096")
|
|
478
|
+bl.default = 4096
|
|
479
|
+bl.rmempty = true
|
|
480
|
+function bl.validate(self, value)
|
|
481
|
+ local v = tonumber(value)
|
|
482
|
+ if not v then
|
|
483
|
+ return nil, err_tab_access(self, translate("Value is not a number") )
|
|
484
|
+ elseif v < 1 or v > 4096 then
|
|
485
|
+ return nil, err_tab_access(self, translate("Value not between 1 and 4096") )
|
|
486
|
+ elseif v == self.default then
|
|
487
|
+ return "" -- dont need to save default
|
|
488
|
+ end
|
|
489
|
+ return value
|
|
490
|
+end
|
|
491
|
+
|
|
492
|
+-- toggle ----------------------------------------------------------------------
|
|
493
|
+local tgl = ns:taboption("access", Flag, "toggle")
|
|
494
|
+tgl.title = string.format(HELP, "TOGGLE", "Toggle Status" )
|
|
495
|
+tgl.description = translate("Enable/Disable filtering when Privoxy starts.")
|
|
496
|
+ .. [[<br />]]
|
|
497
|
+ .. translate("Disabled == Transparent Proxy Mode")
|
|
498
|
+tgl.orientation = "horizontal"
|
|
499
|
+tgl.default = "1"
|
|
500
|
+tgl.rmempty = false
|
|
501
|
+function tgl.parse(self, section)
|
|
502
|
+ CTRL.flag_parse(self, section)
|
|
503
|
+end
|
|
504
|
+
|
|
505
|
+-- enable-remote-toggle --------------------------------------------------------
|
|
506
|
+local ert = ns:taboption("access", Flag, "enable_remote_toggle")
|
|
507
|
+ert.title = string.format(HELP, "ENABLE-REMOTE-TOGGLE", "Enable remote toggle" )
|
|
508
|
+ert.description = translate("Whether or not the web-based toggle feature may be used.")
|
|
509
|
+ert.orientation = "horizontal"
|
|
510
|
+ert.rmempty = true
|
|
511
|
+function ert.parse(self, section)
|
|
512
|
+ CTRL.flag_parse(self, section)
|
|
513
|
+end
|
|
514
|
+
|
|
515
|
+-- enable-remote-http-toggle ---------------------------------------------------
|
|
516
|
+local eht = ns:taboption("access", Flag, "enable_remote_http_toggle")
|
|
517
|
+eht.title = string.format(HELP, "ENABLE-REMOTE-HTTP-TOGGLE", "Enable remote toggle via HTTP" )
|
|
518
|
+eht.description = translate("Whether or not Privoxy recognizes special HTTP headers to change its behaviour.")
|
|
519
|
+ .. [[<br /><strong>]]
|
|
520
|
+ .. translate("This option will be removed in future releases as it has been obsoleted by the more general header taggers.")
|
|
521
|
+ .. [[</strong>]]
|
|
522
|
+eht.orientation = "horizontal"
|
|
523
|
+eht.rmempty = true
|
|
524
|
+function eht.parse(self, section)
|
|
525
|
+ CTRL.flag_parse(self, section)
|
|
526
|
+end
|
|
527
|
+
|
|
528
|
+-- enable-edit-actions ---------------------------------------------------------
|
|
529
|
+local eea = ns:taboption("access", Flag, "enable_edit_actions")
|
|
530
|
+eea.title = string.format(HELP, "ENABLE-EDIT-ACTIONS", "Enable action file editor" )
|
|
531
|
+eea.description = translate("Whether or not the web-based actions file editor may be used.")
|
|
532
|
+eea.orientation = "horizontal"
|
|
533
|
+eea.rmempty = true
|
|
534
|
+function eea.parse(self, section)
|
|
535
|
+ CTRL.flag_parse(self, section)
|
|
536
|
+end
|
|
537
|
+
|
|
538
|
+-- enforce-blocks --------------------------------------------------------------
|
|
539
|
+local eb = ns:taboption("access", Flag, "enforce_blocks")
|
|
540
|
+eb.title = string.format(HELP, "ENFORCE-BLOCKS", "Enforce page blocking" )
|
|
541
|
+eb.description = translate("If enabled, Privoxy hides the 'go there anyway' link. "
|
|
542
|
+ .. "The user obviously should not be able to bypass any blocks.")
|
|
543
|
+eb.orientation = "horizontal"
|
|
544
|
+eb.rmempty = true
|
|
545
|
+function eb.parse(self, section)
|
|
546
|
+ CTRL.flag_parse(self, section)
|
|
547
|
+end
|
|
548
|
+
|
|
549
|
+-- tab: forward -- #############################################################
|
|
550
|
+
|
|
551
|
+-- enable-proxy-authentication-forwarding --------------------------------------
|
|
552
|
+local paf = ns:taboption("forward", Flag, "enable_proxy_authentication_forwarding")
|
|
553
|
+paf.title = string.format(HELP, "ENABLE-PROXY-AUTHENTICATION-FORWARDING",
|
|
554
|
+ translate("Enable proxy authentication forwarding") )
|
|
555
|
+paf.description = translate("Whether or not proxy authentication through Privoxy should work.")
|
|
556
|
+ .. [[<br /><strong>]]
|
|
557
|
+ .. translate("Enabling this option is NOT recommended if there is no parent proxy that requires authentication!")
|
|
558
|
+ .. [[</strong>]]
|
|
559
|
+--paf.orientation = "horizontal"
|
|
560
|
+paf.rmempty = true
|
|
561
|
+function paf.parse(self, section)
|
|
562
|
+ CTRL.flag_parse(self, section)
|
|
563
|
+end
|
|
564
|
+
|
|
565
|
+-- forward ---------------------------------------------------------------------
|
|
566
|
+local fwd = ns:taboption("forward", DynamicList, "forward")
|
|
567
|
+fwd.title = string.format(HELP, "FORWARD", "Forward HTTP" )
|
|
568
|
+fwd.description = translate("To which parent HTTP proxy specific requests should be routed.")
|
|
569
|
+ .. [[<br />]]
|
|
570
|
+ .. translate("Syntax: target_pattern http_parent[:port]")
|
|
571
|
+fwd.rmempty = true
|
|
572
|
+
|
|
573
|
+-- forward-socks4 --------------------------------------------------------------
|
|
574
|
+local fs4 = ns:taboption("forward", DynamicList, "forward_socks4")
|
|
575
|
+fs4.title = string.format(HELP, "SOCKS", "Forward SOCKS 4" )
|
|
576
|
+fs4.description = translate("Through which SOCKS proxy (and optionally to which parent HTTP proxy) specific requests should be routed.")
|
|
577
|
+ .. [[<br />]]
|
|
578
|
+ .. translate("Syntax: target_pattern socks_proxy[:port] http_parent[:port]")
|
|
579
|
+fs4.rmempty = true
|
|
580
|
+
|
|
581
|
+-- forward-socks4a -------------------------------------------------------------
|
|
582
|
+local f4a = ns:taboption("forward", DynamicList, "forward_socks4a")
|
|
583
|
+f4a.title = string.format(HELP, "SOCKS", "Forward SOCKS 4A" )
|
|
584
|
+f4a.description = fs4.description
|
|
585
|
+f4a.rmempty = true
|
|
586
|
+
|
|
587
|
+-- forward-socks5 --------------------------------------------------------------
|
|
588
|
+local fs5 = ns:taboption("forward", DynamicList, "forward_socks5")
|
|
589
|
+fs5.title = string.format(HELP, "SOCKS", "Forward SOCKS 5" )
|
|
590
|
+fs5.description = fs4.description
|
|
591
|
+fs5.rmempty = true
|
|
592
|
+
|
|
593
|
+-- forward-socks5t -------------------------------------------------------------
|
|
594
|
+local f5t = ns:taboption("forward", DynamicList, "forward_socks5t")
|
|
595
|
+f5t.title = string.format(HELP, "SOCKS", "Forward SOCKS 5t" )
|
|
596
|
+f5t.description = fs4.description
|
|
597
|
+f5t.rmempty = true
|
|
598
|
+
|
|
599
|
+-- tab: misc -- ################################################################
|
|
600
|
+
|
|
601
|
+-- accept-intercepted-requests -------------------------------------------------
|
|
602
|
+local air = ns:taboption("misc", Flag, "accept_intercepted_requests")
|
|
603
|
+air.title = string.format(HELP, "ACCEPT-INTERCEPTED-REQUESTS", "Accept intercepted requests" )
|
|
604
|
+air.description = translate("Whether intercepted requests should be treated as valid.")
|
|
605
|
+air.orientation = "horizontal"
|
|
606
|
+air.rmempty = true
|
|
607
|
+function air.parse(self, section)
|
|
608
|
+ CTRL.flag_parse(self, section)
|
|
609
|
+end
|
|
610
|
+
|
|
611
|
+-- allow-cgi-request-crunching -------------------------------------------------
|
|
612
|
+local crc = ns:taboption("misc", Flag, "allow_cgi_request_crunching")
|
|
613
|
+crc.title = string.format(HELP, "ALLOW-CGI-REQUEST-CRUNCHING", "Allow CGI request crunching" )
|
|
614
|
+crc.description = translate("Whether requests to Privoxy's CGI pages can be blocked or redirected.")
|
|
615
|
+crc.orientation = "horizontal"
|
|
616
|
+crc.rmempty = true
|
|
617
|
+function crc.parse(self, section)
|
|
618
|
+ CTRL.flag_parse(self, section)
|
|
619
|
+end
|
|
620
|
+
|
|
621
|
+-- split-large-forms -----------------------------------------------------------
|
|
622
|
+local slf = ns:taboption("misc", Flag, "split_large_forms")
|
|
623
|
+slf.title = string.format(HELP, "SPLIT-LARGE-FORMS", "Split large forms" )
|
|
624
|
+slf.description = translate("Whether the CGI interface should stay compatible with broken HTTP clients.")
|
|
625
|
+slf.orientation = "horizontal"
|
|
626
|
+slf.rmempty = true
|
|
627
|
+function slf.parse(self, section)
|
|
628
|
+ CTRL.flag_parse(self, section)
|
|
629
|
+end
|
|
630
|
+
|
|
631
|
+-- keep-alive-timeout ----------------------------------------------------------
|
|
632
|
+local kat = ns:taboption("misc", Value, "keep_alive_timeout")
|
|
633
|
+kat.title_base = "Keep-alive timeout"
|
|
634
|
+kat.title = string.format(HELP, "KEEP-ALIVE-TIMEOUT", kat.title_base)
|
|
635
|
+kat.description = translate("Number of seconds after which an open connection will no longer be reused.")
|
|
636
|
+kat.rmempty = true
|
|
637
|
+function kat.validate(self, value)
|
|
638
|
+ local v = tonumber(value)
|
|
639
|
+ if not v then
|
|
640
|
+ return nil, err_tab_misc(self, translate("Value is not a number") )
|
|
641
|
+ elseif v < 1 then
|
|
642
|
+ return nil, err_tab_misc(self, translate("Value not greater 0 or empty") )
|
|
643
|
+ end
|
|
644
|
+ return value
|
|
645
|
+end
|
|
646
|
+
|
|
647
|
+-- tolerate-pipelining ---------------------------------------------------------
|
|
648
|
+local tp = ns:taboption("misc", Flag, "tolerate_pipelining")
|
|
649
|
+tp.title = string.format(HELP, "TOLERATE-PIPELINING", "Tolerate pipelining" )
|
|
650
|
+tp.description = translate("Whether or not pipelined requests should be served.")
|
|
651
|
+tp.orientation = "horizontal"
|
|
652
|
+tp.rmempty = true
|
|
653
|
+function tp.parse(self, section)
|
|
654
|
+ CTRL.flag_parse(self, section)
|
|
655
|
+end
|
|
656
|
+
|
|
657
|
+-- default-server-timeout ------------------------------------------------------
|
|
658
|
+local dst = ns:taboption("misc", Value, "default_server_timeout")
|
|
659
|
+dst.title_base = "Default server timeout"
|
|
660
|
+dst.title = string.format(HELP, "DEFAULT-SERVER-TIMEOUT", dst.title_base)
|
|
661
|
+dst.description = translate("Assumed server-side keep-alive timeout (in seconds) if not specified by the server.")
|
|
662
|
+dst.rmempty = true
|
|
663
|
+function dst.validate(self, value)
|
|
664
|
+ local v = tonumber(value)
|
|
665
|
+ if not v then
|
|
666
|
+ return nil, err_tab_misc(self, translate("Value is not a number") )
|
|
667
|
+ elseif v < 1 then
|
|
668
|
+ return nil, err_tab_misc(self, translate("Value not greater 0 or empty") )
|
|
669
|
+ end
|
|
670
|
+ return value
|
|
671
|
+end
|
|
672
|
+
|
|
673
|
+-- connection-sharing ----------------------------------------------------------
|
|
674
|
+local cs = ns:taboption("misc", Flag, "connection_sharing")
|
|
675
|
+cs.title = string.format(HELP, "CONNECTION-SHARING", "Connection sharing" )
|
|
676
|
+cs.description = translate("Whether or not outgoing connections that have been kept alive should be shared between different incoming connections.")
|
|
677
|
+cs.orientation = "horizontal"
|
|
678
|
+cs.rmempty = true
|
|
679
|
+function cs.parse(self, section)
|
|
680
|
+ CTRL.flag_parse(self, section)
|
|
681
|
+end
|
|
682
|
+
|
|
683
|
+-- socket-timeout --------------------------------------------------------------
|
|
684
|
+local st = ns:taboption("misc", Value, "socket_timeout")
|
|
685
|
+st.title_base = "Socket timeout"
|
|
686
|
+st.title = string.format(HELP, "SOCKET-TIMEOUT", st.title_base )
|
|
687
|
+st.description = translate("Number of seconds after which a socket times out if no data is received.")
|
|
688
|
+st.default = 300
|
|
689
|
+st.rmempty = true
|
|
690
|
+function st.validate(self, value)
|
|
691
|
+ local v = tonumber(value)
|
|
692
|
+ if not v then
|
|
693
|
+ return nil, err_tab_misc(self, translate("Value is not a number") )
|
|
694
|
+ elseif v < 1 then
|
|
695
|
+ return nil, err_tab_misc(self, translate("Value not greater 0 or empty") )
|
|
696
|
+ elseif v == self.default then
|
|
697
|
+ return "" -- dont need to save default
|
|
698
|
+ end
|
|
699
|
+ return value
|
|
700
|
+end
|
|
701
|
+
|
|
702
|
+-- max-client-connections ------------------------------------------------------
|
|
703
|
+local mcc = ns:taboption("misc", Value, "max_client_connections")
|
|
704
|
+mcc.title_base = "Max. client connections"
|
|
705
|
+mcc.title = string.format(HELP, "MAX-CLIENT-CONNECTIONS", mcc.title_base )
|
|
706
|
+mcc.description = translate("Maximum number of client connections that will be served.")
|
|
707
|
+mcc.default = 128
|
|
708
|
+mcc.rmempty = true
|
|
709
|
+function mcc.validate(self, value)
|
|
710
|
+ local v = tonumber(value)
|
|
711
|
+ if not v then
|
|
712
|
+ return nil, err_tab_misc(self, translate("Value is not a number") )
|
|
713
|
+ elseif v < 1 then
|
|
714
|
+ return nil, err_tab_misc(self, translate("Value not greater 0 or empty") )
|
|
715
|
+ elseif v == self.default then
|
|
716
|
+ return "" -- dont need to save default
|
|
717
|
+ end
|
|
718
|
+ return value
|
|
719
|
+end
|
|
720
|
+
|
|
721
|
+-- handle-as-empty-doc-returns-ok ----------------------------------------------
|
|
722
|
+local her = ns:taboption("misc", Flag, "handle_as_empty_doc_returns_ok")
|
|
723
|
+her.title = string.format(HELP, "HANDLE-AS-EMPTY-DOC-RETURNS-OK", "Handle as empty doc returns ok" )
|
|
724
|
+her.description = translate("The status code Privoxy returns for pages blocked with +handle-as-empty-document.")
|
|
725
|
+her.orientation = "horizontal"
|
|
726
|
+her.rmempty = true
|
|
727
|
+function her.parse(self, section)
|
|
728
|
+ CTRL.flag_parse(self, section)
|
|
729
|
+end
|
|
730
|
+
|
|
731
|
+-- enable-compression ----------------------------------------------------------
|
|
732
|
+local ec = ns:taboption("misc", Flag, "enable_compression")
|
|
733
|
+ec.title = string.format(HELP, "ENABLE-COMPRESSION", "Enable compression" )
|
|
734
|
+ec.description = translate("Whether or not buffered content is compressed before delivery.")
|
|
735
|
+ec.orientation = "horizontal"
|
|
736
|
+ec.rmempty = true
|
|
737
|
+function ec.parse(self, section)
|
|
738
|
+ CTRL.flag_parse(self, section)
|
|
739
|
+end
|
|
740
|
+
|
|
741
|
+-- compression-level -----------------------------------------------------------
|
|
742
|
+local cl = ns:taboption("misc", Value, "compression_level")
|
|
743
|
+cl.title_base = "Compression level"
|
|
744
|
+cl.title = string.format(HELP, "COMPRESSION-LEVEL", cl.title_base )
|
|
745
|
+cl.description = translate("The compression level that is passed to the zlib library when compressing buffered content.")
|
|
746
|
+cl.default = 1
|
|
747
|
+cl.rmempty = true
|
|
748
|
+function cl.validate(self, value)
|
|
749
|
+ local v = tonumber(value)
|
|
750
|
+ if not v then
|
|
751
|
+ return nil, err_tab_misc(self, translate("Value is not a number") )
|
|
752
|
+ elseif v < 0 or v > 9 then
|
|
753
|
+ return nil, err_tab_misc(self, translate("Value not between 0 and 9") )
|
|
754
|
+ elseif v == self.default then
|
|
755
|
+ return "" -- don't need to save default
|
|
756
|
+ end
|
|
757
|
+ return value
|
|
758
|
+end
|
|
759
|
+
|
|
760
|
+-- client-header-order ---------------------------------------------------------
|
|
761
|
+local cho = ns:taboption("misc", Value, "client_header_order")
|
|
762
|
+cho.title = string.format(HELP, "CLIENT-HEADER-ORDER", "Client header order" )
|
|
763
|
+cho.description = translate("The order in which client headers are sorted before forwarding them.")
|
|
764
|
+ .. [[<br />]]
|
|
765
|
+ .. translate("Syntax: Client header names delimited by spaces.")
|
|
766
|
+cho.rmempty = true
|
|
767
|
+
|
|
768
|
+-- "debug"-tab definition -- ###################################################
|
|
769
|
+
|
|
770
|
+-- single-threaded -------------------------------------------------------------
|
|
771
|
+local st = ns:taboption("debug", Flag, "single_threaded")
|
|
772
|
+st.title = string.format(HELP, "SINGLE-THREADED", "Single Threaded" )
|
|
773
|
+st.description = translate("Whether to run only one server thread.")
|
|
774
|
+ .. [[<br /><strong>]]
|
|
775
|
+ .. translate("This option is only there for debugging purposes. It will drastically reduce performance.")
|
|
776
|
+ .. [[</strong>]]
|
|
777
|
+st.rmempty = true
|
|
778
|
+function st.parse(self, section)
|
|
779
|
+ CTRL.flag_parse(self, section)
|
|
780
|
+end
|
|
781
|
+
|
|
782
|
+-- debug -----------------------------------------------------------------------
|
|
783
|
+local d1 = ns:taboption("debug", Flag, "debug_1")
|
|
784
|
+d1.title = string.format(HELP, "DEBUG", "Debug 1" )
|
|
785
|
+d1.description = translate("Log the destination for each request Privoxy let through. See also 'Debug 1024'.")
|
|
786
|
+d1.rmempty = true
|
|
787
|
+function d1.parse(self, section)
|
|
788
|
+ CTRL.flag_parse(self, section)
|
|
789
|
+end
|
|
790
|
+
|
|
791
|
+-- debug -----------------------------------------------------------------------
|
|
792
|
+local d2 = ns:taboption("debug", Flag, "debug_2")
|
|
793
|
+d2.title = string.format(HELP, "DEBUG", "Debug 2" )
|
|
794
|
+d2.description = translate("Show each connection status")
|
|
795
|
+d2.rmempty = true
|
|
796
|
+function d2.parse(self, section)
|
|
797
|
+ CTRL.flag_parse(self, section)
|
|
798
|
+end
|
|
799
|
+
|
|
800
|
+-- debug -----------------------------------------------------------------------
|
|
801
|
+local d3 = ns:taboption("debug", Flag, "debug_4")
|
|
802
|
+d3.title = string.format(HELP, "DEBUG", "Debug 4" )
|
|
803
|
+d3.description = translate("Show I/O status")
|
|
804
|
+d3.rmempty = true
|
|
805
|
+function d3.parse(self, section)
|
|
806
|
+ CTRL.flag_parse(self, section)
|
|
807
|
+end
|
|
808
|
+
|
|
809
|
+-- debug -----------------------------------------------------------------------
|
|
810
|
+local d4 = ns:taboption("debug", Flag, "debug_8")
|
|
811
|
+d4.title = string.format(HELP, "DEBUG", "Debug 8" )
|
|
812
|
+d4.description = translate("Show header parsing")
|
|
813
|
+d4.rmempty = true
|
|
814
|
+function d4.parse(self, section)
|
|
815
|
+ CTRL.flag_parse(self, section)
|
|
816
|
+end
|
|
817
|
+
|
|
818
|
+-- debug -----------------------------------------------------------------------
|
|
819
|
+local d5 = ns:taboption("debug", Flag, "debug_16")
|
|
820
|
+d5.title = string.format(HELP, "DEBUG", "Debug 16" )
|
|
821
|
+d5.description = translate("Log all data written to the network")
|
|
822
|
+d5.rmempty = true
|
|
823
|
+function d5.parse(self, section)
|
|
824
|
+ CTRL.flag_parse(self, section)
|
|
825
|
+end
|
|
826
|
+
|
|
827
|
+-- debug -----------------------------------------------------------------------
|
|
828
|
+local d6 = ns:taboption("debug", Flag, "debug_32")
|
|
829
|
+d6.title = string.format(HELP, "DEBUG", "Debug 32" )
|
|
830
|
+d6.description = translate("Debug force feature")
|
|
831
|
+d6.rmempty = true
|
|
832
|
+function d6.parse(self, section)
|
|
833
|
+ CTRL.flag_parse(self, section)
|
|
834
|
+end
|
|
835
|
+
|
|
836
|
+-- debug -----------------------------------------------------------------------
|
|
837
|
+local d7 = ns:taboption("debug", Flag, "debug_64")
|
|
838
|
+d7.title = string.format(HELP, "DEBUG", "Debug 64" )
|
|
839
|
+d7.description = translate("Debug regular expression filters")
|
|
840
|
+d7.rmempty = true
|
|
841
|
+function d7.parse(self, section)
|
|
842
|
+ CTRL.flag_parse(self, section)
|
|
843
|
+end
|
|
844
|
+
|
|
845
|
+-- debug -----------------------------------------------------------------------
|
|
846
|
+local d8 = ns:taboption("debug", Flag, "debug_128")
|
|
847
|
+d8.title = string.format(HELP, "DEBUG", "Debug 128" )
|
|
848
|
+d8.description = translate("Debug redirects")
|
|
849
|
+d8.rmempty = true
|
|
850
|
+function d8.parse(self, section)
|
|
851
|
+ CTRL.flag_parse(self, section)
|
|
852
|
+end
|
|
853
|
+
|
|
854
|
+-- debug -----------------------------------------------------------------------
|
|
855
|
+local d9 = ns:taboption("debug", Flag, "debug_256")
|
|
856
|
+d9.title = string.format(HELP, "DEBUG", "Debug 256" )
|
|
857
|
+d9.description = translate("Debug GIF de-animation")
|
|
858
|
+d9.rmempty = true
|
|
859
|
+function d9.parse(self, section)
|
|
860
|
+ CTRL.flag_parse(self, section)
|
|
861
|
+end
|
|
862
|
+
|
|
863
|
+-- debug -----------------------------------------------------------------------
|
|
864
|
+local d10 = ns:taboption("debug", Flag, "debug_512")
|
|
865
|
+d10.title = string.format(HELP, "DEBUG", "Debug 512" )
|
|
866
|
+d10.description = translate("Common Log Format")
|
|
867
|
+d10.rmempty = true
|
|
868
|
+function d10.parse(self, section)
|
|
869
|
+ CTRL.flag_parse(self, section)
|
|
870
|
+end
|
|
871
|
+
|
|
872
|
+-- debug -----------------------------------------------------------------------
|
|
873
|
+local d11 = ns:taboption("debug", Flag, "debug_1024")
|
|
874
|
+d11.title = string.format(HELP, "DEBUG", "Debug 1024" )
|
|
875
|
+d11.description = translate("Log the destination for requests Privoxy didn't let through, and the reason why.")
|
|
876
|
+d11.rmempty = true
|
|
877
|
+function d11.parse(self, section)
|
|
878
|
+ CTRL.flag_parse(self, section)
|
|
879
|
+end
|
|
880
|
+
|
|
881
|
+-- debug -----------------------------------------------------------------------
|
|
882
|
+local d12 = ns:taboption("debug", Flag, "debug_2048")
|
|
883
|
+d12.title = string.format(HELP, "DEBUG", "Debug 2048" )
|
|
884
|
+d12.description = translate("CGI user interface")
|
|
885
|
+d12.rmempty = true
|
|
886
|
+function d12.parse(self, section)
|
|
887
|
+ CTRL.flag_parse(self, section)
|
|
888
|
+end
|
|
889
|
+
|
|
890
|
+-- debug -----------------------------------------------------------------------
|
|
891
|
+local d13 = ns:taboption("debug", Flag, "debug_4096")
|
|
892
|
+d13.title = string.format(HELP, "DEBUG", "Debug 4096" )
|
|
893
|
+d13.description = translate("Startup banner and warnings.")
|
|
894
|
+d13.rmempty = true
|
|
895
|
+function d13.parse(self, section)
|
|
896
|
+ CTRL.flag_parse(self, section)
|
|
897
|
+end
|
|
898
|
+
|
|
899
|
+-- debug -----------------------------------------------------------------------
|
|
900
|
+local d14 = ns:taboption("debug", Flag, "debug_8192")
|
|
901
|
+d14.title = string.format(HELP, "DEBUG", "Debug 8192" )
|
|
902
|
+d14.description = translate("Non-fatal errors - *we highly recommended enabling this*")
|
|
903
|
+d14.rmempty = true
|
|
904
|
+function d14.parse(self, section)
|
|
905
|
+ CTRL.flag_parse(self, section)
|
|
906
|
+end
|
|
907
|
+
|
|
908
|
+-- debug -----------------------------------------------------------------------
|
|
909
|
+local d15 = ns:taboption("debug", Flag, "debug_32768")
|
|
910
|
+d15.title = string.format(HELP, "DEBUG", "Debug 32768" )
|
|
911
|
+d15.description = translate("Log all data read from the network")
|
|
912
|
+d15.rmempty = true
|
|
913
|
+function d15.parse(self, section)
|
|
914
|
+ CTRL.flag_parse(self, section)
|
|
915
|
+end
|
|
916
|
+
|
|
917
|
+-- debug -----------------------------------------------------------------------
|
|
918
|
+local d16 = ns:taboption("debug", Flag, "debug_65536")
|
|
919
|
+d16.title = string.format(HELP, "DEBUG", "Debug 65536" )
|
|
920
|
+d16.description = translate("Log the applying actions")
|
|
921
|
+d16.rmempty = true
|
|
922
|
+function d16.parse(self, section)
|
|
923
|
+ CTRL.flag_parse(self, section)
|
|
924
|
+end
|
|
925
|
+
|
|
926
|
+-- tab: logview -- #############################################################
|
|
927
|
+
|
|
928
|
+local lv = ns:taboption("logview", DummyValue, "_logview")
|
|
929
|
+lv.template = "privoxy/detail_logview"
|
|
930
|
+lv.inputtitle = translate("Read / Reread log file")
|
|
931
|
+lv.rows = 50
|
|
932
|
+function lv.cfgvalue(self, section)
|
|
933
|
+ local lfile=self.map:get(ns.section, "logdir") .. "/" .. self.map:get(ns.section, "logfile")
|
|
934
|
+ if NXFS.access(lfile) then
|
|
935
|
+ return lfile .. "\n" .. translate("Please press [Read] button")
|
|
936
|
+ end
|
|
937
|
+ return lfile .. "\n" .. translate("File not found or empty")
|
|
938
|
+end
|
|
939
|
+
|
|
940
|
+return m
|