@@ -13,6 +13,14 @@ PORT = 5000
|
||||
# only announce once every 5 minutes, so this should be more than 300.
|
||||
PURGE_TIME = 350
|
||||
|
||||
# List of banned IP addresses for announce
|
||||
# e.g. ['2620:101::44']
|
||||
BANNED_IPS = []
|
||||
|
||||
# List of banned servers as IP/port pairs
|
||||
# e.g. ['1.2.3.4/30000']
|
||||
BANNED_SERVERS = []
|
||||
|
||||
# Creates server entries if a server sends an 'update' and there is no entry yet.
|
||||
# This should only be used to populate the server list after list.json was deleted.
|
||||
# This WILL cause problems such as mapgen, mods and privilege information missing from the list
|
||||
|
||||
@@ -39,6 +39,9 @@ def announce():
|
||||
if ip.startswith("::ffff:"):
|
||||
ip = ip[7:]
|
||||
|
||||
if ip in app.config["BANNED_IPS"]:
|
||||
return "Banned (IP).", 403
|
||||
|
||||
data = request.values["json"]
|
||||
|
||||
if len(data) > 5000:
|
||||
@@ -72,6 +75,9 @@ def announce():
|
||||
server["port"] = int(server["port"])
|
||||
#### End compatability code ####
|
||||
|
||||
if "%s/%d" % (server["ip"], server["port"]) in app.config["BANNED_SERVERS"]:
|
||||
return "Banned (Server).", 403
|
||||
|
||||
old = serverList.get(ip, server["port"])
|
||||
|
||||
if action == "delete":
|
||||
|
||||
Reference in New Issue
Block a user