Branded email template + footer pages: help center, token unsubscribe, settings deep links
release gate / check (push) Failing after 6m56s
release gate / check (push) Failing after 6m56s
Transactional mail now goes out as the Superbrain HTML design
(internal/mailer/template.html, embedded verbatim) with a plain-text
alternative: multipart/alternative (plain first per RFC 2046), random
boundary, CRLF normalization and SMTP dot-stuffing. Render() fills the
{{placeholders}} with HTML-escaped values and removes optional sections
(CTA + fallback link, note block, footer links, address) when empty;
anchor drift fails the unit tests and degrades to plain text at send
time, never blocking delivery. Password reset gets the headline,
first-name greeting, "Choose a new password" button (Outlook VML
fallback) and expiry/single-use note; notification and agent emails
render title-as-headline with body paragraphs.
The template's footer links are now real pages:
- /help: public help center (10 topic sections + FAQ accordion), linked
from the login page.
- /unsubscribe?token=...: public confirmation page; the HMAC-signed user
id (notify.UnsubscribeToken, domain-separated, stable, no stored row)
IS the credential. POST /api/notifications/unsubscribe accepts the
RFC 8058 one-click shape (token in query, form body ignored) and the
browser JSON shape; it disables the user's enabled email channels and
pauses enabled agent email tasks addressed to their own email
(idempotent, re-enableable, per-client rate limited, audit logged).
- Email preferences deep-links to /settings?tab=notifications; Settings
now honors ?tab=<section> (unknown values fall back to profile).
notify.FooterLinks is the single eligibility point: preferences + help
whenever NEXTAUTH_URL is set; unsubscribe ONLY when the recipient is the
owner's own account email — third-party channel addresses and agent
recipients never receive a link that changes someone else's settings,
and transactional mail (password reset) never carries unsubscribe.
Owner-addressed mail also carries List-Unsubscribe +
List-Unsubscribe-Post headers.
Verified: Go build/vet/unit green; new TestUnsubscribeFlow integration
test pins footer + headers, blast radius (slack channel and third-party
task survive), one-click + JSON paths, idempotence, tampered tokens and
the third-party/transactional exclusions; notifications, phase-2,
password-reset and agent suites green; web lint/SSR-lint/build 0 errors;
full browser regressions pass; live smoke of /help, /unsubscribe states,
the settings deep-link auth gate and bad-token 400 through the proxy.
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
import Link from 'next/link'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { HelpFaq } from './faq'
|
||||
import {
|
||||
Bookmark, FolderOpen, FileText, Kanban, Radar, Bell, Bot,
|
||||
FolderSync, KeyRound, ArrowRight,
|
||||
} from 'lucide-react'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
const SECTIONS = [
|
||||
{
|
||||
id: 'getting-started',
|
||||
icon: ArrowRight,
|
||||
title: 'Getting started',
|
||||
body: [
|
||||
'Sign in with your email and password, or with Authelia single sign-on if your deployment uses it. On first run, create your account from the sign-up page — then start by saving a bookmark, writing a page, or connecting a service in Settings.',
|
||||
'Forgot your password? Use the "Forgot password?" link on the sign-in page; a single-use reset link is emailed to you. On single-sign-on deployments, recovery is handled by your identity provider instead.',
|
||||
],
|
||||
where: 'Sign in → /login · Reset → /forgot-password',
|
||||
},
|
||||
{
|
||||
id: 'bookmarks',
|
||||
icon: Bookmark,
|
||||
title: 'Bookmarks & tags',
|
||||
body: [
|
||||
'Every URL you save becomes a bookmark with a title, description, notes, tags and an optional due date. Open a bookmark to edit its details, attach it to pages and collections, or place it on the board.',
|
||||
'Sharing a tag shares every bookmark under it with the recipients — group-wide, including bookmarks other recipients add later. A public bookmark link publishes the title, description, notes, due date, tags and preview to anyone with the link, and deliberately carries no owner attribution.',
|
||||
],
|
||||
where: 'Sidebar → Bookmarks · Tags',
|
||||
},
|
||||
{
|
||||
id: 'collections',
|
||||
icon: FolderOpen,
|
||||
title: 'Collections',
|
||||
body: [
|
||||
'Collections group bookmarks manually or by smart filters, and render as a table or a board grouped by any select property. Shared collections are read-only for recipients.',
|
||||
'Connected services materialize as collections automatically: each WebDAV share, CalDAV calendar and CardDAV address book becomes its own collection whose files, events or contacts are bookmarks. Syncing mirrors the server — removed items detach, and your own removals stay removed.',
|
||||
],
|
||||
where: 'Sidebar → Collections · Settings → WebDAV / CalDAV / CardDAV',
|
||||
},
|
||||
{
|
||||
id: 'pages',
|
||||
icon: FileText,
|
||||
title: 'Pages',
|
||||
body: [
|
||||
'Pages are WYSIWYG documents stored as Markdown. Every URL you add — via the Link button, the links popover, or a bare-URL paste — is also saved as a bookmark linked to the page, reusing an existing bookmark for the same URL instead of duplicating it.',
|
||||
'Pages can nest under a parent; deleting a parent promotes its children. Every save keeps a revision you can restore, and deleted pages are recoverable from Trash. Autosave pauses on a version conflict so you never clobber newer content.',
|
||||
],
|
||||
where: 'Sidebar → Pages · Trash',
|
||||
},
|
||||
{
|
||||
id: 'board',
|
||||
icon: Kanban,
|
||||
title: 'Kanban board',
|
||||
body: [
|
||||
'The board places bookmarks in columns you define. Drag cards between columns or reorder within a column; moves are saved immediately. Shared cards are read-only.',
|
||||
],
|
||||
where: 'Sidebar → Board',
|
||||
},
|
||||
{
|
||||
id: 'signals',
|
||||
icon: Radar,
|
||||
title: 'Signals & mailbox watches',
|
||||
body: [
|
||||
'Signals are events attached to bookmarks — notes, arrivals, reminders. Connect an IMAP mailbox in Settings and add a watch from a bookmark\'s Signals panel: matching emails become signals on that bookmark.',
|
||||
],
|
||||
where: 'Settings → IMAP · Bookmark → Signals',
|
||||
},
|
||||
{
|
||||
id: 'notifications',
|
||||
icon: Bell,
|
||||
title: 'Notifications',
|
||||
body: [
|
||||
'Notification rules fire on signals created, bookmarks coming due, or shares received, and deliver through your channels: email, Slack, Matrix, Telegram or Signal. Rules can target other people in your organization; each recipient gets the delivery through their own channel. History shows every delivery, including suppressed ones.',
|
||||
'Email preferences live in Settings → Notifications. Every notification email also carries an unsubscribe link that turns off your email channels and any automations that email you — password resets and other account emails are not affected.',
|
||||
],
|
||||
where: 'Settings → Notifications',
|
||||
},
|
||||
{
|
||||
id: 'assistant',
|
||||
icon: Bot,
|
||||
title: 'Assistant & automations',
|
||||
body: [
|
||||
'The assistant answers questions about your data and can propose automations: stored tasks that periodically check a page and then notify you, send an email, or save a bookmark. Proposals are compiled into a validated spec and only run after you confirm them — the assistant never acts on its own.',
|
||||
'AI features use your own provider key (Settings → AI) or the server key when your plan includes it. Without any AI configured, the app tells you where to add one instead of failing silently.',
|
||||
],
|
||||
where: 'Assistant panel · Settings → AI / Automations',
|
||||
},
|
||||
{
|
||||
id: 'connections',
|
||||
icon: FolderSync,
|
||||
title: 'Connections',
|
||||
body: [
|
||||
'Settings connects Superbrain to your services: WebDAV shares, CalDAV calendars, CardDAV address books, Nextcloud contacts sync, and IMAP mailboxes. Credentials are stored encrypted and are write-only — the app never shows them back to you.',
|
||||
'On Core deployments with Nextcloud, the connection forms offer a one-click prefill for your account.',
|
||||
],
|
||||
where: 'Settings → Connections',
|
||||
},
|
||||
{
|
||||
id: 'developer',
|
||||
icon: KeyRound,
|
||||
title: 'API keys & MCP',
|
||||
body: [
|
||||
'Personal API keys (sb_…) authenticate machine clients against the Go API directly; the plaintext key is shown once at creation and stored hashed. The superbrain-mcp server exposes your data to MCP clients through the federated gateway.',
|
||||
'You can also register external MCP servers (Settings → MCP) for Superbrain to dial as a client.',
|
||||
],
|
||||
where: 'Settings → API Keys / MCP',
|
||||
},
|
||||
]
|
||||
|
||||
export default function HelpPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<header className="border-b border-border">
|
||||
<div className="mx-auto flex max-w-4xl items-center justify-between px-6 py-4">
|
||||
<Link href="/login" className="font-display text-lg font-bold tracking-tight">
|
||||
superbrain
|
||||
</Link>
|
||||
<Button asChild size="sm">
|
||||
<Link href="/login">Open Superbrain</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="mx-auto max-w-4xl px-6 pb-24">
|
||||
<div className="pt-16 pb-10">
|
||||
<Badge variant="secondary" className="mb-4">Help center</Badge>
|
||||
<h1 className="font-display text-4xl font-bold tracking-tight">
|
||||
How Superbrain works
|
||||
</h1>
|
||||
<p className="mt-3 max-w-2xl text-base text-muted-foreground">
|
||||
Bookmarks, pages, collections and automations — a quick guide to every
|
||||
surface of the app. Jump to a topic below, or browse the FAQ at the end.
|
||||
</p>
|
||||
<nav className="mt-6 flex flex-wrap gap-2">
|
||||
{SECTIONS.map(s => (
|
||||
<a
|
||||
key={s.id}
|
||||
href={`#${s.id}`}
|
||||
className="rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
|
||||
>
|
||||
{s.title}
|
||||
</a>
|
||||
))}
|
||||
<a
|
||||
href="#faq"
|
||||
className="rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
|
||||
>
|
||||
FAQ
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div className="space-y-12">
|
||||
{SECTIONS.map(s => (
|
||||
<section key={s.id} id={s.id} className="scroll-mt-8">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
|
||||
<s.icon className="h-5 w-5" />
|
||||
</div>
|
||||
<h2 className="font-display text-2xl font-bold tracking-tight">{s.title}</h2>
|
||||
</div>
|
||||
<div className="mt-4 space-y-3 text-sm leading-relaxed text-foreground/90">
|
||||
{s.body.map((p, i) => <p key={i}>{p}</p>)}
|
||||
</div>
|
||||
<p className="mt-3 font-mono text-xs text-muted-foreground">{s.where}</p>
|
||||
</section>
|
||||
))}
|
||||
|
||||
<section id="faq" className="scroll-mt-8">
|
||||
<h2 className="font-display text-2xl font-bold tracking-tight">Frequently asked questions</h2>
|
||||
<HelpFaq />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className="border-t border-border">
|
||||
<div className="mx-auto flex max-w-4xl flex-wrap items-center justify-between gap-2 px-6 py-6 text-xs text-muted-foreground">
|
||||
<span>Superbrain — your second brain, federated.</span>
|
||||
<span className="flex gap-4">
|
||||
<Link href="/login" className="hover:text-primary hover:underline">Sign in</Link>
|
||||
<Link href="/forgot-password" className="hover:text-primary hover:underline">Reset password</Link>
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user