Remove list filename option

There's just not really a compelling reason for this to be configurable.
This commit is contained in:
ShadowNinja
2016-01-23 23:59:45 -05:00
parent b366290118
commit ccd85da424
2 changed files with 3 additions and 6 deletions

View File

@@ -8,9 +8,6 @@ HOST = "127.0.0.1"
# Port for development server to listen on
PORT = 5000
# File to store the JSON server list data in.
FILENAME = "list.json"
# Amount of time, is seconds, after which servers are removed from the list
# if they haven't updated their listings. Note: By default Minetest servers
# only announce once every 5 minutes, so this should be more than 300.

View File

@@ -26,7 +26,7 @@ def index():
def list():
# We have to make sure that the list isn't cached,
# since the list isn't really static.
return send_from_directory(app.static_folder, app.config["FILENAME"],
return send_from_directory(app.static_folder, "list.json",
cache_timeout=0)
@@ -336,7 +336,7 @@ class ServerList:
def load(self):
try:
with open(os.path.join("static", app.config["FILENAME"]), "r") as fd:
with open(os.path.join("static", "list.json"), "r") as fd:
data = json.load(fd)
except FileNotFoundError:
return
@@ -359,7 +359,7 @@ class ServerList:
self.maxServers = max(servers, self.maxServers)
self.maxClients = max(clients, self.maxClients)
with open(os.path.join("static", app.config["FILENAME"]), "w") as fd:
with open(os.path.join("static", "list.json"), "w") as fd:
json.dump({
"total": {"servers": servers, "clients": clients},
"total_max": {"servers": self.maxServers, "clients": self.maxClients},