0f96ffb30a0bace33309d13bec379fefe24145f9
[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 tot = s:option(DummyValue, "adb_overall_count", translate("Total count of blocked domains"))
27
28 -- Blocklist options
29
30 bl = m:section(TypedSection, "source", translate("Blocklist sources"),
31         translate("Available blocklist sources (")
32         .. [[<a href="https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md" target="_blank">]]
33         .. translate("see list details")
34         .. [[</a>]]
35         .. translate("). Note that list URLs and Shallalist category selections are not configurable via Luci."))
36 bl.template = "cbi/tblsection"
37
38 name = bl:option(Flag, "enabled", translate("Enabled"))
39 name.rmempty  = false
40
41 des = bl:option(DummyValue, "adb_src_desc", translate("Description"))
42 cou = bl:option(DummyValue, "adb_src_count", translate("Count"))
43 upd = bl:option(DummyValue, "adb_src_timestamp", translate("List date/state"))
44
45 -- Additional options
46
47 s2 = m:section(NamedSection, "backup", "service", translate("Backup options"))
48
49 o4 = s2:option(Flag, "enabled", translate("Enable blocklist backup"))
50 o4.rmempty = false
51 o4.default = 0
52
53 o5 = s2:option(Value, "adb_dir", translate("Backup directory"))
54 o5.rmempty = false
55 o5.datatype = "directory"
56
57 -- Extra options
58
59 e = m:section(NamedSection, "global", "adblock", translate("Extra options"),
60         translate("Options for further tweaking in case the defaults are not suitable for you."))
61
62 a1 = e:option(Value, "adb_nullport", translate("Port of the adblock uhttpd instance"))
63 a1.optional = true
64 a1.default = 65535
65 a1.datatype = "port"
66
67 a2 = e:option(Value, "adb_nullipv4", translate("IPv4 blackhole ip address"))
68 a2.optional = true
69 a2.default = "192.0.2.1"
70 a2.datatype = "ip4addr"
71
72 a3 = e:option(Value, "adb_nullipv6", translate("IPv6 blackhole ip address"))
73 a3.optional = true
74 a3.default = "::ffff:c000:0201"
75 a3.datatype = "ip6addr"
76
77 a7 = e:option(Value, "adb_lanif", translate("Name of the logical lan interface"))
78 a7.optional = true
79 a7.default = "lan"
80 a7.datatype = "network"
81
82 return m
83