diff --git a/PyPost.py b/PyPost.py
index efde9c5..ed46f71 100644
--- a/PyPost.py
+++ b/PyPost.py
@@ -47,6 +47,9 @@ def render_markdown(md_path: Path):
import random
from hashes.hashes import hash_list
# Create clean HTML structure
+ # Pick two different hashes from hash_list
+ hash1, hash2 = random.sample(hash_list, 2)
+
clean_html = f"""
@@ -62,7 +65,7 @@ def render_markdown(md_path: Path):
{title}
-
+
Written @{time.asctime(time.localtime())}
{html_body}
@@ -73,10 +76,9 @@ def render_markdown(md_path: Path):
{time.strftime("%Y-%m-%d %H:%M:%S")}
- Hash 1 (UTF-8):{base64.b64encode(random.choice(hash_list).encode("utf-8")).decode("utf-8")}
+ Hash 1 (UTF-8):{base64.b64encode(hash1.encode("utf-8")).decode("utf-8")}
- Hash 2 (ASCII):{base64.b64encode(random.choice(hash_list).encode("ascii")).decode("ascii")}
- Decode Hashes to identify pages
+ Hash 2 (Windows-1252):{base64.b64encode(hash2.encode("windows-1252")).decode("windows-1252")}
"""
@@ -116,28 +118,6 @@ def initial_scan(markdown_dir: Path):
for md in markdown_dir.rglob("*.md"):
render_markdown(md)
-"""
-class Handler(FileSystemEventHandler):
- def on_created(self, event):
- if not event.is_directory and event.src_path.endswith(".md"):
- render_markdown(Path(event.src_path))
-
- def on_modified(self, event):
- if not event.is_directory and event.src_path.endswith(".md"):
- render_markdown(Path(event.src_path))
-
- def on_deleted(self, event):
- if not event.is_directory and event.src_path.endswith(".md"):
- remove_html(Path(event.src_path))
-
- def on_moved(self, event):
- src = Path(event.src_path)
- dest = Path(event.dest_path)
- if src.suffix.lower() == ".md":
- remove_html(src)
- if dest.suffix.lower() == ".md":
- render_markdown(dest)
-"""
if __name__ == "__main__":
if not MARKDOWN_DIR.exists():
diff --git a/html/base/index.html b/html/base/index.html
index c6b13ea..6d944f2 100644
--- a/html/base/index.html
+++ b/html/base/index.html
@@ -7,6 +7,8 @@
h1 { color: #333; }
li { list-style: none; background: url("../../css/icons/item.png") no-repeat left center; background-size: 15px 20px; padding-left: 25px; transition: font-size 0.5s cubic-bezier(0.075, 0.82, 0.165, 1); }
li:hover { font-size: larger; }
+ #available { padding-left: 40px;}
+ ul { padding-left: 100px;}
#nojs { display: inline-block;color: red;transition: transform 0.7s cubic-bezier(0.215, 0.610, 0.355, 1); }
#nojs:hover { transform: skewX(-12deg);}
#nonenormalul { list-style: disc inside; margin: 1em 0; padding-left: 40px; background: none; }
@@ -33,7 +35,7 @@
console.log("javascript is enabled! good!")
document.write('
Index of PyPost
');
-
+
Available pages:
diff --git a/webserver.py b/webserver.py
index 3759cb5..07e7525 100644
--- a/webserver.py
+++ b/webserver.py
@@ -4,6 +4,7 @@ import threading
import subprocess
from http.server import BaseHTTPRequestHandler, HTTPServer
import mimetypes
+from functools import lru_cache
from jsmin import jsmin # pip install jsmin
from log.Logger import *
@@ -37,7 +38,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
+
return f"""
"""