some visual changes

This commit is contained in:
2025-09-23 16:52:25 +02:00
parent bd13e890e1
commit c7f0fae19b
3 changed files with 19 additions and 30 deletions

View File

@@ -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"""<!doctype html>
<html lang="en" style="height:100%; margin:0;">
<head>
@@ -62,7 +65,7 @@ def render_markdown(md_path: Path):
<img src="../css/icons/back.png" width="32" height="32" alt="Back" style="display:block;" />
{title}
</h1>
<img src="../css/icons/written.png" width="32" height="32" alt="write_img" loading="lazy" style="vertical-align: middle;" />
<img src="../css/icons/written.png" width="32" height="32" alt="write_img" loading="lazy" style="vertical-align: middle;padding-left:12px; padding-left:40px;" />
<div class="meta" style="display: inline;">Written @{time.asctime(time.localtime())}</div>
<hr style="margin:10px 0;" />
{html_body}
@@ -73,10 +76,9 @@ def render_markdown(md_path: Path):
<img src="../css/icons/date.png" width="16" height="16" alt="date" loading="lazy" style="vertical-align: middle;" />
{time.strftime("%Y-%m-%d %H:%M:%S")}<br/>
<img src="../css/icons/magnifier.png" width="16" height="16" alt="Hash1" loading="lazy" style="display:inline; vertical-align:middle;" />
Hash 1 (<b>UTF-8</b>)<i>:{base64.b64encode(random.choice(hash_list).encode("utf-8")).decode("utf-8")}</i><br />
Hash 1 (<b>UTF-8</b>)<i>:{base64.b64encode(hash1.encode("utf-8")).decode("utf-8")}</i><br />
<img src="../css/icons/magnifier.png" width="16" height="16" alt="Hash2" loading="lazy" style="display:inline; vertical-align:middle;" />
Hash 2 (<b>ASCII</b>)<i>:{base64.b64encode(random.choice(hash_list).encode("ascii")).decode("ascii")}</i><br />
<i>Decode Hashes to identify pages</i>
Hash 2 (<b>Windows-1252</b>)<i>:{base64.b64encode(hash2.encode("windows-1252")).decode("windows-1252")}</i><br />
</footer>
</body>
</html>"""
@@ -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():

View File

@@ -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('<h1 id="nojs" style="color:black; display: flex; align-items: center;"><img src="../../css/icons/folder.png" width="45" height="45" style="vertical-align: middle; margin-right: 8px;" />Index of PyPost</h1>');
</script>
<p>
<p id="available">
<img src="../../css/icons/available.png" width="32" height="32" style="vertical-align: middle; display: inline; margin-right: 8px;" />
Available pages:
</p>

View File

@@ -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"""
<footer style="
position: absolute;
@@ -46,9 +53,9 @@ def index_footer():
">
<hr style="border: 1px solid #ccc;" />
<p>
Hash 1 (<b>UTF-8</b>)<i>:{base64.b64encode(random.choice(hash_list).encode("utf-8")).decode("utf-8")}</i><br />
Hash 2 (<b>ASCII</b>)<i>:{base64.b64encode(random.choice(hash_list).encode("ascii")).decode("ascii")}</i><br />
<i>Decode Hashes to identify pages</i>
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 />
</p>
</footer>
"""