Add 'ALLOW_UPDATE_WITHOUT_OLD' config option
This commit is contained in:
@@ -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
|
||||
|
||||
10
server.py
10
server.py
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user