diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-12-01 00:08:51 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-12-01 00:08:51 +0100 |
commit | 2c87f8bd0e28ffcda4e297b5edc643c30cd84e59 (patch) | |
tree | 23151e8d11d03fec01b47c9358f2066ec1c40053 /prog/jelka/daemon.py | |
parent | lib64 (diff) | |
download | r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar.gz r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar.bz2 r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar.lz r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar.xz r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.tar.zst r-2c87f8bd0e28ffcda4e297b5edc643c30cd84e59.zip |
Diffstat (limited to '')
-rwxr-xr-x | prog/jelka/daemon.py | 7 |
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() |