diff --git a/app.py b/app.py index 3df4a61..af5bd19 100644 --- a/app.py +++ b/app.py @@ -188,6 +188,7 @@ def record_auth_failure(client_ip: str): HTML = """ + aukpad
-
- disconnected +
+ disconnected
+ - + + +
@@ -348,14 +399,13 @@ HTML = """
+

+ + Content is deleted after __RETENTION_HOURS__ hours of inactivity and can be accessed + by the server and anyone with the link and optional password. + +

- -

- Please Note: 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. - -

@@ -400,6 +450,16 @@ function toggleTheme() { }); })(); +// Bottom notice: click anywhere on it to dismiss, remembered across pads and reloads. +function hideNotice() { + $("#notice").style.display = "none"; + try { localStorage.setItem("notice", "off"); } catch (e) {} +} +(function() { + try { if (localStorage.getItem("notice") === "off") $("#notice").style.display = "none"; } + catch (e) {} // private mode / storage disabled: just leave the notice up +})(); + // Derive docId from path; redirect root to random let docId = decodeURIComponent(location.pathname.replace(/(^\\/|\\/$)/g, "")); if (!docId) { location.replace("/" + rand() + "/"); } @@ -587,6 +647,13 @@ function submitAuth() { } } +function setPeers(n) { + const el = $("#peers"); + $("#peer-count").textContent = n; // never el.textContent: it would wipe the + el.title = n + (n === 1 ? " peer" : " peers") + " connected"; + el.style.display = "inline-flex"; +} + // --- WS connect + sync --- function connect(){ isAuthed = false; @@ -603,7 +670,7 @@ function connect(){ if (msg.type === "init") { isProtected = !!msg.protected; updateLockBtn(); - if (msg.peers !== undefined) { const el = $("#peers"); el.textContent = msg.peers; el.style.display = "inline"; } + if (msg.peers !== undefined) setPeers(msg.peers); if (isProtected && !isAuthed) { if (urlPw) { ws.send(JSON.stringify({type: "auth", password: urlPw})); @@ -648,9 +715,7 @@ function connect(){ ta.selectionStart = adjustCursor(oldText, msg.text, s); ta.selectionEnd = adjustCursor(oldText, msg.text, e); } else if (msg.type === "peers_changed") { - const el = $("#peers"); - el.textContent = msg.count; - el.style.display = "inline"; + setPeers(msg.count); } else if (msg.type === "lang_changed") { applyLang(msg.lang || ""); } else if (msg.type === "protected_changed") { @@ -803,6 +868,7 @@ def get_system_info(): + aukpad - System Info