luci-app-vpnbypass: switch to luci-tree Makefile, i18n support
[project/luci.git] / applications / luci-app-adblock / luasrc / model / cbi / adblock.lua
1 -- Copyright 2016 Openwrt.org
2 -- Licensed to the public under the Apache License 2.0.
3
4 m = Map("adblock", translate("Adblock"),
5         translate("Configuration of the adblock package to block ad/abuse domains by using DNS."))
6
7 -- General options
8
9 s = m:section(NamedSection, "global", "adblock", translate("Global options"))
10
11 o1 = s:option(Flag, "adb_enabled", translate("Enable adblock"))
12 o1.rmempty = false
13 o1.default = 0
14
15 o3 = s:option(Value, "adb_whitelist", translate("Whitelist file"),
16      translate("File with whitelisted hosts/domains that are allowed despite being on a blocklist."))
17 o3.rmempty = false
18 o3.datatype = "file"
19
20 fdns = s:option(Flag, "adb_forcedns", translate("Redirect all DNS queries to the local resolver"),
21         translate("When adblock is active, all DNS queries are redirected to the local resolver " ..
22         "in this server by default. You can disable that to allow queries to external DNS servers."))
23 fdns.rmempty = false
24 fdns.default = fdns.enabled
25
26 -- Statistics
27
28 t = m:section(NamedSection, "global", "adblock", translate("Statistics"))
29
30 dat = t:option(DummyValue, "adb_lastrun", translate("Last update of the blocklists"))
31 tot = t:option(DummyValue, "adb_overall_count", translate("Total count of blocked domains"))
32 prc = t:option(DummyValue, "adb_percentage", translate("Percentage of blocked packets (before last update, IPv4/IPv6)"))
33
34 -- Blocklist options
35
36 bl = m:section(TypedSection, "source", translate("Blocklist sources"),
37         translate("Available blocklist sources (")
38         .. [[<a href="https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md" target="_blank">]]
39         .. translate("see list details")
40         .. [[</a>]]
41         .. translate("). Note that list URLs and Shallalist category selections are not configurable via Luci."))
42 bl.template = "cbi/tblsection"
43
44 name = bl:option(Flag, "enabled", translate("Enabled"))
45 name.rmempty  = false
46
47 des = bl:option(DummyValue, "adb_src_desc", translate("Description"))
48 cou = bl:option(DummyValue, "adb_src_count", translate("Count"))
49 upd = bl:option(DummyValue, "adb_src_timestamp", translate("List date/state"))
50
51 -- Additional options
52
53 s2 = m:section(NamedSection, "backup", "service", translate("Backup options"))
54
55 o4 = s2:option(Flag, "enabled", translate("Enable blocklist backup"))
56 o4.rmempty = false
57 o4.default = 0
58
59 o5 = s2:option(Value, "adb_dir", translate("Backup directory"))
60 o5.rmempty = false
61 o5.datatype = "directory"
62
63 -- Extra options
64
65 e = m:section(NamedSection, "global", "adblock", translate("Extra options"),
66         translate("Options for further tweaking in case the defaults are not suitable for you."))
67
68 a0 = e:option(Flag, "adb_restricted", translate("Do not write status info to flash"),
69         translate("Skip writing update status information to the config file. Status fields on this page will not be updated."))
70 a0.default = 0
71
72 a1 = e:option(Value, "adb_nullport", translate("Port of the adblock uhttpd instance"))
73 a1.optional = true
74 a1.default = 65534
75 a1.datatype = "port"
76
77 a5 = e:option(Value, "adb_nullportssl", translate("Port of the adblock uhttpd instance for https links"))
78 a5.optional = true
79 a5.default = 65535
80 a5.datatype = "port"
81
82 a2 = e:option(Value, "adb_nullipv4", translate("IPv4 blackhole ip address"))
83 a2.optional = true
84 a2.default = "198.18.0.1"
85 a2.datatype = "ip4addr"
86
87 a3 = e:option(Value, "adb_nullipv6", translate("IPv6 blackhole ip address"))
88 a3.optional = true
89 a3.default = "::ffff:c612:0001"
90 a3.datatype = "ip6addr"
91
92 a4 = e:option(Value, "adb_fetchttl", translate("Timeout for blocklist fetch (seconds)"))
93 a4.optional = true
94 a4.default = 5
95 a4.datatype = "range(2,60)"
96
97 a7 = e:option(Value, "adb_lanif", translate("Name of the logical lan interface"))
98 a7.optional = true
99 a7.default = "lan"
100 a7.datatype = "network"
101
102 return m
103