Optional json file to store port number.
This commit is contained in:
parent
fe98c11aaa
commit
cc28312487
3 changed files with 13 additions and 8 deletions
Binary file not shown.
Binary file not shown.
21
server.py
21
server.py
|
@ -6,14 +6,6 @@
|
||||||
# web-masters and a like, so we are counting on
|
# web-masters and a like, so we are counting on
|
||||||
# your ability to set it up and running.
|
# your ability to set it up and running.
|
||||||
|
|
||||||
CSS = "https://zortazert.codeberg.page/style/styles.css"
|
|
||||||
PORT = input("Port: ")
|
|
||||||
try:
|
|
||||||
PORT = int(PORT)
|
|
||||||
except:
|
|
||||||
print("Port should be a number")
|
|
||||||
exit()
|
|
||||||
|
|
||||||
# Server side
|
# Server side
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
from subprocess import *
|
from subprocess import *
|
||||||
|
@ -23,6 +15,19 @@ import os
|
||||||
from modules import search
|
from modules import search
|
||||||
from modules import render
|
from modules import render
|
||||||
|
|
||||||
|
CSS = "https://zortazert.codeberg.page/style/styles.css"
|
||||||
|
try:
|
||||||
|
with open("port.json","r") as f:
|
||||||
|
json_stuff = json.load(f)
|
||||||
|
PORT = json_stuff["port"]
|
||||||
|
except:
|
||||||
|
PORT = input("Port: ")
|
||||||
|
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...
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue