feat(chat): share a chat by link — anonymous read-only /shared/<token> page, share/unshare

This commit is contained in:
2026-08-30 01:34:44 -04:00
parent ece93a7c8f
commit 114b115034
28 changed files with 3442 additions and 54 deletions
+12 -1
View File
@@ -106,9 +106,20 @@ export async function initSharedHeader() {
// a query-safe "/…" string (never "//"; ? # and spaces stay
// percent-encoded in it), so it rides in next= as-is — the same shape
// the static fallbacks use (login.js safeNext re-validates it).
//
// Phase 51 (owner-locked 2026-08-29, TODO.md L6): the ONE exception —
// on the NESTED /shared/<token> page "where you were" is a public
// link, not a place in the app: the rewrite stays at the APP ROOT
// ("/"), so a guest signing in from a shared page lands in the chat
// (the static ?next=/ fallback in shared.html matches — the rewrite
// only ever KEEPS it there). A signed-in admin on the shared page
// never sees the link (hidden = admin), so this only shapes the
// guest experience.
const nextPath = window.location.pathname || "/";
const signInNext = nextPath.startsWith("/shared/") ? "/" : nextPath;
document.querySelectorAll(".sign-in-link").forEach(link => {
link.hidden = admin;
link.href = "/login.html?next=" + (window.location.pathname || "/");
link.href = "/login.html?next=" + signInNext;
});
document.querySelectorAll(".sign-out-btn").forEach(btn => { btn.hidden = !admin; });
const navSources = document.querySelector("#nav-sources");