summaryrefslogtreecommitdiffstats
path: root/prog/jelka/daemon.py
diff options
context:
space:
mode:
Diffstat (limited to 'prog/jelka/daemon.py')
-rwxr-xr-xprog/jelka/daemon.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/prog/jelka/daemon.py b/prog/jelka/daemon.py
index a288f35..badae36 100755
--- a/prog/jelka/daemon.py
+++ b/prog/jelka/daemon.py
@@ -67,7 +67,7 @@ def update_preflight(koda):
return flask.Response("", status=204, headers={"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, OPTIONS", "Access-Control-Allow-Headers": "Content-Type", "Access-Control-Max-Age": "86400"})
def kode():
- return [base64.b64encode(hashlib.sha256(skrivnost+bytes(str(int(time.time()/1000)), encoding="utf-8")).digest()).replace(b"/", b"").replace(b"+", b"")[:4].lower().decode(), base64.b64encode(hashlib.sha256(skrivnost+bytes(str(int(time.time()/1000)-1), encoding="utf-8")).digest()).replace(b"/", b"").replace(b"+", b"")[:4].lower().decode()]
+ return [base64.b64encode(hashlib.sha256(skrivnost+bytes(str(int(time.time()/1000)), encoding="utf-8")).digest()).replace(b"/", b"").replace(b"+", b"")[:4].lower().decode(), base64.b64encode(hashlib.sha256(skrivnost+bytes(str(int(time.time()/1000)-1), encoding="utf-8")).digest()).replace(b"/", b"").replace(b"+", b"")[:4].lower().decode(), os.getenv("KODA")]
def zaznaj_smrt():
proces.wait()
@@ -98,5 +98,8 @@ začni_vzorec = threading.Event()
sprememba_stanja = threading.Event()
if __name__ == "__main__":
- threading.Thread(target=lambda: http.run(host="::", port=6969, debug=True, use_reloader=False)).start()
+ port = 6969
+ if os.getenv("PORT"):
+ port = int(os.getenv("PORT"))
+ threading.Thread(target=lambda: http.run(host="::", port=port, debug=True, use_reloader=False)).start()
threading.Thread(target=subprocess_manager).start()