Skip to content

Commit

Permalink
Add 'ALLOW_UPDATE_WITHOUT_OLD' config option
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Jul 3, 2014
1 parent 794741f commit b6cae2f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config.py
Expand Up @@ -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
10 changes: 9 additions & 1 deletion server.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b6cae2f

Please sign in to comment.