luci-app-adblock: sync with adblock 3.5.0
[project/luci.git] / applications / luci-app-p2pblock / luasrc / model / cbi / luci_fw / p2pblock.lua
1 -- Copyright 2009 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local sys = require "luci.sys"
5
6 m = Map("freifunk_p2pblock", translate("P2P-Block"),
7         translate("P2P-Block is a greylisting mechanism to block various peer-to-peer protocols for non-whitelisted clients."))
8
9 s = m:section(NamedSection, "p2pblock", "settings", "Settings")
10 s.anonymous = true
11 s.addremove = false
12
13 en = s:option(Flag, "_enabled", translate("Enable P2P-Block"))
14 en.rmempty = false
15
16 function en.cfgvalue()
17         return ( sys.init.enabled("freifunk-p2pblock") and "1" or "0" )
18 end
19
20 function en.write(self, section, val)
21         if val == "1" then
22                 sys.init.enable("freifunk-p2pblock")
23         else
24                 sys.init.disable("freifunk-p2pblock")
25         end
26 end
27
28 s:option(Value, "portrange", translate("Portrange"))
29
30 s:option(Value, "blocktime", translate("Block Time"),
31         translate("seconds"))
32
33 s:option(DynamicList, "whitelist", translate("Whitelisted IPs"))
34
35 l7 = s:option(MultiValue, "layer7", translate("Layer7-Protocols"))
36 l7.widget = "checkbox"
37 l7:value("aim", "AIM Chat")
38 l7:value("bittorrent", "Bittorrent")
39 l7:value("edonkey", "eDonkey, eMule, Kademlia")
40 l7:value("fasttrack", "Fasttrack Protocol")
41 l7:value("ftp", "File Transfer Protocol")
42 l7:value("gnutella", "Gnutella")
43 l7:value("http", "Hypertext Transfer Protocol")
44 l7:value("ident", "Ident Protocol")
45 l7:value("irc", "Internet Relay Chat")
46 l7:value("jabber", "Jabber/XMPP")
47 l7:value("msnmessenger", "MSN Messenger")
48 l7:value("ntp", "Network Time Protocol")
49 l7:value("pop3", "POP3 Protocol")
50 l7:value("smtp", "SMTP Protocol")
51 l7:value("ssl", "SSL Protocol")
52 l7:value("vnc", "VNC Protocol")
53
54 ipp2p = s:option(MultiValue, "ipp2p", translate("IP-P2P"))
55 ipp2p.widget = "checkbox"
56 ipp2p:value("edk", "eDonkey, eMule, Kademlia")
57 ipp2p:value("kazaa", "KaZaA, FastTrack")
58 ipp2p:value("gnu", "Gnutella")
59 ipp2p:value("dc", "Direct Connect")
60 ipp2p:value("bit", "BitTorrent, extended BT")
61 ipp2p:value("apple", "AppleJuice")
62 ipp2p:value("winmx", "WinMX")
63 ipp2p:value("soul", "SoulSeek")
64 ipp2p:value("ares", "AresLite")
65
66 return m