Fix the PR from earlier.

This commit is contained in:
jyamihud 2022-04-03 20:35:04 +03:00
parent 32cad6847c
commit 9c87b660b8

View file

@ -18,28 +18,24 @@ from modules import render
CSS = "https://zortazert.codeberg.page/style/styles.css" CSS = "https://zortazert.codeberg.page/style/styles.css"
try: try:
if os.path.exists("config.json"):
with open("config.json","r") as f: with open("config.json","r") as f:
srvConfig = json.load(f) srvConfig = json.load(f)
ADDRESS = srvConfig["address"] ADDRESS = srvConfig["address"]
PORT = srvConfig["port"] PORT = srvConfig["port"]
CSS = srvConfig["css"] CSS = srvConfig["css"]
except: except:
newConfig = open("config.json", "w") newConfig = open("config.json", "w")
newConfig.write("""{ newConfig.write("""{
"INFO" : "You would be better off setting address to the full URL of the FreeCompetitors instance.", "INFO" : "You would be better off setting address to the full URL of the FreeCompetitors instance.",
"address" : "/", "address" : "/",
"port" : "8080", "port" : 8080,
"css" : "https://zortazert.codeberg.page/style/styles.css" "css" : "https://zortazert.codeberg.page/style/styles.css"
}""") }""")
newConfig.close newConfig.close
print("Please edit the configuration file \"config.json\".") print("Please edit the configuration file \"config.json\".")
exit() 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? # Who fucking made this http.server so I need to use classes?
# I fucking hate who ever thought that it was a good idea... # I fucking hate who ever thought that it was a good idea...