Skip to content

Commit b6cae2f

Browse files
committedJul 3, 2014
Add 'ALLOW_UPDATE_WITHOUT_OLD' config option
1 parent 794741f commit b6cae2f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
 

‎config.py

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424
# List of banned IP addresses.
2525
BANLIST = []
2626

27+
# Creates server entries if a server sends an 'update' and there is no entry yet
28+
# This should only be used to populate the server list after list.json was deleted.
29+
ALLOW_UPDATE_WITHOUT_OLD = False

‎server.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ def announce():
8383
return "Invalid JSON data.", 400
8484

8585
if server["action"] != "start" and not old:
86-
return "Server to update not found.", 500
86+
if app.config["ALLOW_UPDATE_WITHOUT_OLD"]:
87+
old = server
88+
old["start"] = time.time()
89+
old["clients_top"] = 0
90+
old["updates"] = 0
91+
old["total_clients"] = 0
92+
else:
93+
return "Server to update not found.", 500
8794

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

@@ -247,6 +254,7 @@ def saveList():
247254
"rollback": (False, "bool"),
248255
"can_see_far_names": (False, "bool"),
249256
}
257+
250258
def checkRequest(server):
251259
for name, data in fields.items():
252260
if not name in server:

0 commit comments

Comments
 (0)
Please sign in to comment.