Skip to content

Commit

Permalink
Remove list filename option
Browse files Browse the repository at this point in the history
There's just not really a compelling reason for this to be configurable.
  • Loading branch information
ShadowNinja committed Jan 24, 2016
1 parent b366290 commit ccd85da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions config-example.py
Expand Up @@ -8,9 +8,6 @@
# 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.
Expand Down
6 changes: 3 additions & 3 deletions server.py
Expand Up @@ -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)


Expand Down Expand Up @@ -336,7 +336,7 @@ def purgeOld(self):

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
Expand All @@ -359,7 +359,7 @@ def save(self):
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},
Expand Down

0 comments on commit ccd85da

Please sign in to comment.