fixed a footer bug, servertime changes!
This commit is contained in:
18
webserver.py
18
webserver.py
@@ -52,13 +52,13 @@ import random
|
||||
|
||||
from hashes.hashes import hash_list
|
||||
|
||||
@lru_cache
|
||||
def index_footer():
|
||||
h1 = random.choice(hash_list)
|
||||
# Ensure h2 is different from h1
|
||||
h2_candidates = [h for h in hash_list if h != h1]
|
||||
h2 = random.choice(h2_candidates) if h2_candidates else h1
|
||||
# Generate hashes only once at server start
|
||||
H1 = random.choice(hash_list)
|
||||
H2_CANDIDATES = [h for h in hash_list if h != H1]
|
||||
H2 = random.choice(H2_CANDIDATES) if H2_CANDIDATES else H1
|
||||
|
||||
# cahcing was a bad, idea, servertime got stuck. it is now a variable ;)
|
||||
def index_footer():
|
||||
return f"""
|
||||
<footer style="
|
||||
position: absolute;
|
||||
@@ -67,9 +67,9 @@ def index_footer():
|
||||
">
|
||||
<hr style="border: 1px solid #ccc;" />
|
||||
<p>
|
||||
Server-Time (CET): <i>{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}</i><br />
|
||||
Hash 1 (<b>UTF-8</b>)<i>:{base64.b64encode(h1.encode("utf-8")).decode("utf-8")}</i><br />
|
||||
Hash 2 (<b>Windows-1252</b>)<i>:{base64.b64encode(h2.encode("windows-1252")).decode("windows-1252")}</i><br />
|
||||
Server-Time (CET ; GMT+2): <i>{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}</i><br />
|
||||
Hash 1 (<b>UTF-8</b>)<i>:{base64.b64encode(H1.encode("utf-8")).decode("utf-8")}</i><br />
|
||||
Hash 2 (<b>Windows-1252</b>)<i>:{base64.b64encode(H2.encode("windows-1252")).decode("windows-1252")}</i><br />
|
||||
</p>
|
||||
</footer>
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user