ux: FIX reconnecting issue and ADD small disclaimer

This commit is contained in:
Caffeine Fueled 2026-09-02 19:10:27 +02:00
parent d57a28b1ad
commit aae1f5f924
Signed by: cf7
GPG key ID: CA295D643074C68C

22
app.py
View file

@ -265,6 +265,17 @@ HTML = """<!doctype html>
#wrap.hl #t::placeholder { color:var(--gutter-color); } #wrap.hl #t::placeholder { color:var(--gutter-color); }
#wrap.hl #t::selection { background:rgba(59,130,246,.35); } #wrap.hl #t::selection { background:rgba(59,130,246,.35); }
pre { margin: 0; } pre { margin: 0; }
/* Dismissed with the checkbox hack so it needs no JS. Trade-off: dismissal lasts
for the page view only, since there is no script to persist it. */
#notice-dismiss { position:absolute; width:0; height:0; opacity:0; }
#notice { flex-shrink:0; margin:.5rem 0 0; display:flex; gap:.75rem; align-items:flex-start;
font-size:.75rem; line-height:1.45; color:var(--gutter-color); }
#notice strong { color:var(--hl-attr); font-weight:600; }
#notice label { margin-left:auto; flex-shrink:0; cursor:pointer; padding:0 .2rem;
font-size:1rem; line-height:1.1; user-select:none; }
#notice label:hover { color:var(--text); }
#notice-dismiss:focus-visible + #notice label { outline:2px solid var(--hl-attr); border-radius:3px; }
#notice-dismiss:checked + #notice { display:none; }
/* highlight.js tokens, mapped onto the theme variables above so dark/light just works */ /* highlight.js tokens, mapped onto the theme variables above so dark/light just works */
.hljs-comment, .hljs-quote { color:var(--hl-comment); font-style:italic; } .hljs-comment, .hljs-quote { color:var(--hl-comment); font-style:italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-doctag { color:var(--hl-keyword); } .hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-doctag { color:var(--hl-keyword); }
@ -338,6 +349,14 @@ HTML = """<!doctype html>
placeholder="Start typing…"></textarea> placeholder="Start typing…"></textarea>
</div> </div>
</div> </div>
<input type="checkbox" id="notice-dismiss">
<p id="notice">
<span><strong>Please Note:</strong> no client-side encryption the server and anyone with the
link and password can access the content. Content is deleted after __RETENTION_HOURS__ hours
of inactivity.</span>
<label for="notice-dismiss" title="Dismiss" aria-label="Dismiss notice">&times;</label>
</p>
<div id="pw-overlay"> <div id="pw-overlay">
<div id="pw-box"> <div id="pw-box">
<h2>This pad is password protected</h2> <h2>This pad is password protected</h2>
@ -734,6 +753,9 @@ ta.addEventListener("input", () => {
</script> </script>
""" """
# RETENTION_HOURS is fixed at startup, so bake it in once rather than per request.
HTML = HTML.replace("__RETENTION_HOURS__", str(RETENTION_HOURS))
@app.get("/favicon.ico", include_in_schema=False) @app.get("/favicon.ico", include_in_schema=False)
def favicon(): def favicon():
return FileResponse("favicon.ico") return FileResponse("favicon.ico")