From 9c87b660b86059a6fd64db44b42a18a846d6bd95 Mon Sep 17 00:00:00 2001 From: jyamihud Date: Sun, 3 Apr 2022 20:35:04 +0300 Subject: [PATCH] Fix the PR from earlier. --- server.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/server.py b/server.py index c85b27b..1cc6415 100644 --- a/server.py +++ b/server.py @@ -18,28 +18,24 @@ from modules import render CSS = "https://zortazert.codeberg.page/style/styles.css" try: - if os.path.exists("config.json"): - with open("config.json","r") as f: - srvConfig = json.load(f) - ADDRESS = srvConfig["address"] - PORT = srvConfig["port"] - CSS = srvConfig["css"] + + with open("config.json","r") as f: + srvConfig = json.load(f) + ADDRESS = srvConfig["address"] + PORT = srvConfig["port"] + CSS = srvConfig["css"] except: newConfig = open("config.json", "w") newConfig.write("""{ "INFO" : "You would be better off setting address to the full URL of the FreeCompetitors instance.", "address" : "/", - "port" : "8080", + "port" : 8080, "css" : "https://zortazert.codeberg.page/style/styles.css" }""") newConfig.close print("Please edit the configuration file \"config.json\".") exit() -try: - PORT = int(PORT) -except: - print("Port should be a number") - exit() + # Who fucking made this http.server so I need to use classes? # I fucking hate who ever thought that it was a good idea...