Add 'ALLOW_UPDATE_WITHOUT_OLD' config option

This commit is contained in:
sfan5
2014-07-03 14:22:09 +02:00
parent 794741fa1f
commit b6cae2f7c9
2 changed files with 12 additions and 1 deletions

View File

@@ -24,3 +24,6 @@ PURGE_TIME = 350
# 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

View File

@@ -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 @@ fields = {
"rollback": (False, "bool"),
"can_see_far_names": (False, "bool"),
}
def checkRequest(server):
for name, data in fields.items():
if not name in server: