Skip to content
Permalink
Browse files

Add 'ALLOW_UPDATE_WITHOUT_OLD' config option

  • Loading branch information
sfan5 committed Jul 3, 2014
1 parent 794741f commit b6cae2f7c9d810324907c83693886908f36c295e
Showing with 12 additions and 1 deletion.
  1. +3 −0 config.py
  2. +9 −1 server.py
@@ -24,3 +24,6 @@
# List of banned IP addresses.
BANLIST = []

# 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.
ALLOW_UPDATE_WITHOUT_OLD = False
@@ -83,7 +83,14 @@ def announce():
return "Invalid JSON data.", 400

if server["action"] != "start" and not old:
return "Server to update not found.", 500
if app.config["ALLOW_UPDATE_WITHOUT_OLD"]:
old = server
old["start"] = time.time()
old["clients_top"] = 0
old["updates"] = 0
old["total_clients"] = 0
else:
return "Server to update not found.", 500

server["update_time"] = time.time()

@@ -247,6 +254,7 @@ def saveList():
"rollback": (False, "bool"),
"can_see_far_names": (False, "bool"),
}

def checkRequest(server):
for name, data in fields.items():
if not name in server:

0 comments on commit b6cae2f

Please sign in to comment.
You can’t perform that action at this time.