Dough Git

commit

Docs

commit
f326a1d2a81b965fa2019455ec9398224b040a77
author
Clove Twilight <[email protected]>
date
2026-10-26 06:31

diff --git a/src/web/App.svelte b/src/web/App.svelte
index 9b5cad8..9338883 100644
--- a/src/web/App.svelte
+++ b/src/web/App.svelte
@@ -13,14 +13,25 @@
   import { isDemo, router } from "./lib/router.svelte";
   import { composeNew, composer, loadSession, session } from "./lib/state.svelte";
   import Admin from "./pages/Admin.svelte";
+  import Privacy from "./pages/Privacy.svelte";
   import Settings from "./pages/Settings.svelte";
-
-  let error = $state("");
-  loadSession()
-    .then(() => !isDemo && startLive())
-    .catch((e: Error) => (error = e.message));
+  import Terms from "./pages/Terms.svelte";
 
   const route = $derived(router.route);
+  const legal = $derived(route.name === "privacy" || route.name === "terms");
+
+  // The privacy policy and terms are public, so opening them directly doesn't
+  // sign you in first. Anywhere else loads the session (and redirects to
+  // sign-in if needed).
+  let error = $state("");
+  let started = false;
+  $effect(() => {
+    if (started || legal) return;
+    started = true;
+    loadSession()
+      .then(() => !isDemo && startLive())
+      .catch((e: Error) => (error = e.message));
+  });
   const reading = $derived(route.name === "folder" && route.threadId !== null);
 
   $effect(() => {
@@ -36,13 +47,16 @@
   });
 
   const titles: Record<string, string> = { inbox: "Inbox", sent: "Sent", drafts: "Drafts", bin: "Bin" };
-  const title = $derived(route.name === "folder" ? titles[route.folder] : route.name === "settings" ? "Settings" : "Admin");
+  const pageTitles: Record<string, string> = { settings: "Settings", privacy: "Privacy", terms: "Terms", admin: "Admin" };
+  const title = $derived(route.name === "folder" ? titles[route.folder] : pageTitles[route.name]);
 </script>
 
 <svelte:window onkeydown={(e) => e.key === "Escape" && (drawer = false)} />
 
 {#if error}
   <p class="error boot">{error}</p>
+{:else if !session.me && legal}
+  {#if route.name === "privacy"}<Privacy standalone />{:else}<Terms standalone />{/if}
 {:else if !session.me}
   <p class="muted boot">Loading…</p>
 {:else}
@@ -67,6 +81,10 @@
       {/if}
     {:else if route.name === "settings"}
       <Settings />
+    {:else if route.name === "privacy"}
+      <Privacy />
+    {:else if route.name === "terms"}
+      <Terms />
     {:else if route.name === "admin" && session.me.isAdmin}
       <Admin />
     {/if}
diff --git a/src/web/components/LegalPage.svelte b/src/web/components/LegalPage.svelte
new file mode 100644
index 0000000..04a1992
--- /dev/null
+++ b/src/web/components/LegalPage.svelte
@@ -0,0 +1,124 @@
+<!-- mailbox/src/web/components/LegalPage.svelte
+     Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+     Licensed under the DASL-1.0 Licence.
+     See LICENCE.md in the project root for full licence information. -->
+<script lang="ts">
+  import ArrowLeft from "@lucide/svelte/icons/arrow-left";
+  import type { Snippet } from "svelte";
+  import { router } from "../lib/router.svelte";
+
+  /**
+   * The privacy policy and terms. `standalone` is for visitors who aren't
+   * signed in (app stores need a public link): no app shell around it.
+   */
+  let { title, updated, standalone = false, children }: { title: string; updated: string; standalone?: boolean; children: Snippet } =
+    $props();
+</script>
+
+<div class="page" class:standalone>
+  {#if standalone}
+    <a class="back" href={router.href("/inbox")}><ArrowLeft size={16} /> Go to the inbox</a>
+  {:else}
+    <a class="back" href={router.href("/settings")}><ArrowLeft size={16} /> Settings</a>
+  {/if}
+  <h1>{title}</h1>
+  <p class="muted updated">Last updated {updated}</p>
+  {@render children()}
+</div>
+
+<style>
+  .page {
+    grid-column: 2 / -1;
+    overflow-y: auto;
+    padding: 0.5rem 0.25rem;
+  }
+
+  .page.standalone {
+    position: relative;
+    height: 100%;
+    padding: 1.5rem max(1rem, calc(50% - 320px));
+  }
+
+  .back {
+    display: inline-flex;
+    align-items: center;
+    gap: 0.35rem;
+    margin-top: 0.5rem;
+    color: var(--muted);
+    font-size: 0.85rem;
+    text-decoration: none;
+  }
+
+  .back:hover {
+    color: var(--text);
+  }
+
+  h1 {
+    margin: 0.5rem 0 0.25rem;
+    font-size: clamp(1.75rem, 4vw, 2.5rem);
+    font-weight: 700;
+    letter-spacing: -0.03em;
+  }
+
+  .updated {
+    margin: 0 0 1.25rem;
+    font-size: 0.85rem;
+  }
+
+  .page :global(section) {
+    max-width: 640px;
+    margin-bottom: 1rem;
+    padding: 1.25rem 1.5rem;
+    border: 1px solid var(--line);
+    border-radius: var(--radius);
+    background: var(--panel);
+    backdrop-filter: blur(14px);
+    line-height: 1.55;
+  }
+
+  .page :global(section p) {
+    margin: 0.5rem 0 0;
+  }
+
+  .page :global(h2) {
+    margin: 0 0 0.5rem;
+    color: var(--accent);
+    font-size: 0.7rem;
+    font-weight: 600;
+    letter-spacing: 0.14em;
+    text-transform: uppercase;
+  }
+
+  .page :global(ul) {
+    margin: 0.5rem 0 0;
+    padding-left: 1.1rem;
+  }
+
+  .page :global(li + li) {
+    margin-top: 0.35rem;
+  }
+
+  .page :global(section a) {
+    color: var(--accent);
+  }
+
+  /* Phones: the app bar names the page; cards run edge to edge of the gutter. */
+  @media (max-width: 800px) {
+    .page {
+      grid-column: 1 / -1;
+      padding: 0 0.75rem 2rem;
+    }
+
+    .page.standalone {
+      padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(2rem + env(safe-area-inset-bottom));
+    }
+
+    .page:not(.standalone) h1 {
+      display: none;
+    }
+
+    .page :global(section) {
+      padding: 1rem;
+    }
+  }
+</style>
diff --git a/src/web/components/Sidebar.svelte b/src/web/components/Sidebar.svelte
index 83993f9..f836dc5 100644
--- a/src/web/components/Sidebar.svelte
+++ b/src/web/components/Sidebar.svelte
@@ -106,7 +106,7 @@
   {/if}
 
   <ul class="bottom">
-    <li><a class="item" class:active={route.name === "settings"} href={router.href("/settings")}><SettingsIcon size={16} /> <span class="label">Settings</span></a></li>
+    <li><a class="item" class:active={route.name === "settings" || route.name === "privacy" || route.name === "terms"} href={router.href("/settings")}><SettingsIcon size={16} /> <span class="label">Settings</span></a></li>
     {#if session.me?.isAdmin}
       <li><a class="item" class:active={route.name === "admin"} href={router.href("/admin")}><Shield size={16} /> <span class="label">Admin</span></a></li>
     {/if}
diff --git a/src/web/lib/router.svelte.ts b/src/web/lib/router.svelte.ts
index f328398..364389b 100644
--- a/src/web/lib/router.svelte.ts
+++ b/src/web/lib/router.svelte.ts
@@ -3,6 +3,8 @@ import type { ListFolder } from "../../shared/types";
 export type Route =
   | { name: "folder"; folder: ListFolder; threadId: string | null }
   | { name: "settings" }
+  | { name: "privacy" }
+  | { name: "terms" }
   | { name: "admin" };
 
 /**
@@ -20,6 +22,8 @@ function strip(pathname: string): string {
 function parse(path: string): Route {
   const [first, second] = path.split("/").filter(Boolean);
   if (first === "settings") return { name: "settings" };
+  if (first === "privacy") return { name: "privacy" };
+  if (first === "terms") return { name: "terms" };
   if (first === "admin") return { name: "admin" };
   const folder: ListFolder = first === "sent" || first === "drafts" || first === "bin" ? first : "inbox";
   return { name: "folder", folder, threadId: second ?? null };
diff --git a/src/web/pages/Privacy.svelte b/src/web/pages/Privacy.svelte
new file mode 100644
index 0000000..a953b2d
--- /dev/null
+++ b/src/web/pages/Privacy.svelte
@@ -0,0 +1,103 @@
+<!-- mailbox/src/web/pages/Privacy.svelte
+     Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+     Licensed under the DASL-1.0 Licence.
+     See LICENCE.md in the project root for full licence information. -->
+<script lang="ts">
+  import LegalPage from "../components/LegalPage.svelte";
+  import { router } from "../lib/router.svelte";
+
+  let { standalone = false }: { standalone?: boolean } = $props();
+
+  const contact = "[email protected]";
+</script>
+
+<LegalPage title="Privacy policy" updated="26 October 2026" {standalone}>
+  <section>
+    <h2>Who we are</h2>
+    <p>
+      This inbox (mail.doughmination.gay) is a small, private email service run by Clove Nytrix Doughmination Twilight.
+      Accounts are only for people let in through the Doughmination SSO. Questions or requests about your data go to
+      <a href="mailto:{contact}">{contact}</a>. Using the inbox also means agreeing to the
+      <a href={router.href("/terms")}>terms of service</a>.
+    </p>
+  </section>
+
+  <section>
+    <h2>What the inbox stores</h2>
+    <ul>
+      <li><strong>Your account:</strong> your username, your SSO account ID, the name you send as, whether you're an admin, and when you joined and last signed in.</li>
+      <li><strong>Your mail:</strong> every message you receive, send or save as a draft, including who it's from and to (and Bcc on mail you send), the subject, the body and any attachments.</li>
+      <li><strong>Sign-in sessions:</strong> a random session token, plus the refresh token the SSO gives us so we can check your account is still active.</li>
+      <li><strong>Notifications:</strong> if you turn them on, the push address and keys your browser gives us for that device.</li>
+    </ul>
+    <p>Mail is stored so you can read it here. It isn't end-to-end encrypted, the same as most email.</p>
+  </section>
+
+  <section>
+    <h2>Who can see your mail</h2>
+    <p>
+      Clove, who runs the inbox, has access to the mail that passes through it, through the Resend dashboard (and the
+      inbox's own database). Your mail isn't read unless it's absolutely needed for moderation, for example to look into
+      a report of illegal content or abuse under the <a href={router.href("/terms")}>terms</a>.
+    </p>
+  </section>
+
+  <section>
+    <h2>Signing in (Doughmination SSO)</h2>
+    <p>You sign in through auth.doughmination.gay, which is run by the same person and keeps:</p>
+    <ul>
+      <li>Your username, name, email address and whether it's verified.</li>
+      <li>Your password (only as a one-way hash), passkeys (public keys only), and your two-factor secret (encrypted).</li>
+      <li>Your active sessions, each with the IP address and browser it was started from, so you can see and end them.</li>
+      <li>The browsers you've signed in from (as a hashed cookie), so signing in somewhere new can email you a security notice. That notice includes the IP address and rough location (city and country) of the sign-in.</li>
+      <li>A log of security events, such as sign-ins and account changes, with the IP address involved.</li>
+    </ul>
+  </section>
+
+  <section>
+    <h2>Who else handles it</h2>
+    <ul>
+      <li><strong>Cloudflare</strong> hosts the inbox and the SSO, including the databases and attachment storage. Like any web host it sees requests, including your IP address, and keeps short-lived logs of them.</li>
+      <li><strong>Resend</strong> delivers all mail in and out, so it handles every message you send and receive on its way through and keeps a copy for a while. The SSO's account emails are sent through it too.</li>
+      <li><strong>Your browser's push service</strong> (Google, Apple or Mozilla, depending on your browser) carries notifications. They're encrypted, so the push service can't read them.</li>
+      <li><strong>The people you email with</strong> get what you send them, like with any email.</li>
+      <li><strong>Remote images:</strong> pictures hosted elsewhere in an email are blocked until you choose to show them. Once you do, the sender's servers can see your IP address and that you opened it.</li>
+    </ul>
+    <p>Nothing is sold or shared for advertising, and there are no analytics or trackers.</p>
+  </section>
+
+  <section>
+    <h2>Cookies</h2>
+    <ul>
+      <li><code>session</code> keeps you signed in to the inbox, for up to 30 days.</li>
+      <li><code>login</code> lasts 10 minutes while you're signing in.</li>
+      <li>The SSO sets its own sign-in cookie, and a device cookie that it remembers for up to a year.</li>
+    </ul>
+    <p>They're only used to sign you in and keep you secure.</p>
+  </section>
+
+  <section>
+    <h2>How long it's kept</h2>
+    <ul>
+      <li>Mail stays until you delete it. Deleted mail goes to the Bin and is gone for good after 30 days, or straight away if you empty the Bin.</li>
+      <li>Attachments you upload but never send are removed after 2 days.</li>
+      <li>Inbox sessions end after 30 days at most.</li>
+      <li>The SSO's security log is kept for 180 days, and a browser it hasn't seen for a year is forgotten.</li>
+      <li>Deleting your account removes your mail, attachments, addresses and notification settings.</li>
+    </ul>
+  </section>
+
+  <section>
+    <h2>Your choices</h2>
+    <p>
+      You can change the name you send as and turn notifications off in Settings, and delete any of your mail at any
+      time. To get a copy of your data, have something corrected, or have your account deleted, email
+      <a href="mailto:{contact}">{contact}</a>. You can also complain to your local data protection authority.
+    </p>
+  </section>
+
+  <section>
+    <h2>Changes</h2>
+    <p>If this policy changes, the date at the top changes with it. Big changes will be announced to account holders.</p>
+  </section>
+</LegalPage>
diff --git a/src/web/pages/Settings.svelte b/src/web/pages/Settings.svelte
index 2dbbbef..837c718 100644
--- a/src/web/pages/Settings.svelte
+++ b/src/web/pages/Settings.svelte
@@ -4,8 +4,11 @@
      See LICENCE.md in the project root for full licence information. -->
 <script lang="ts">
   import Bell from "@lucide/svelte/icons/bell";
+  import ChevronRight from "@lucide/svelte/icons/chevron-right";
+  import ShieldCheck from "@lucide/svelte/icons/shield-check";
   import { onMount } from "svelte";
   import { api } from "../lib/api";
+  import { router } from "../lib/router.svelte";
   import { session } from "../lib/state.svelte";
 
   let name = $state(session.me?.name ?? "");
@@ -102,6 +105,15 @@
     {/if}
     {#if status}<p class="muted">{status}</p>{/if}
   </section>
+
+  <section>
+    <h2><ShieldCheck size={16} /> Privacy and terms</h2>
+    <p class="muted">What's stored about you and your mail, who can see it, and the rules for using the inbox.</p>
+    <div class="buttons">
+      <a class="btn link" href={router.href("/privacy")}>Privacy policy <ChevronRight size={16} /></a>
+      <a class="btn link" href={router.href("/terms")}>Terms of service <ChevronRight size={16} /></a>
+    </div>
+  </section>
 </div>
 
 <style>
@@ -164,6 +176,13 @@
     overflow-wrap: anywhere;
   }
 
+  .link {
+    display: inline-flex;
+    align-items: center;
+    gap: 0.25rem;
+    text-decoration: none;
+  }
+
   /* Phones: the app bar names the page; cards run edge to edge of the gutter. */
   @media (max-width: 800px) {
     .page {
diff --git a/src/web/pages/Terms.svelte b/src/web/pages/Terms.svelte
new file mode 100644
index 0000000..e979033
--- /dev/null
+++ b/src/web/pages/Terms.svelte
@@ -0,0 +1,83 @@
+<!-- mailbox/src/web/pages/Terms.svelte
+     Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+     Licensed under the DASL-1.0 Licence.
+     See LICENCE.md in the project root for full licence information. -->
+<script lang="ts">
+  import LegalPage from "../components/LegalPage.svelte";
+  import { router } from "../lib/router.svelte";
+
+  let { standalone = false }: { standalone?: boolean } = $props();
+
+  const contact = "[email protected]";
+</script>
+
+<LegalPage title="Terms of service" updated="26 October 2026" {standalone}>
+  <section>
+    <h2>The basics</h2>
+    <p>
+      This inbox (mail.doughmination.gay) is a small, private email service run by Clove Nytrix Doughmination Twilight.
+      By using it you agree to these terms. How your data is handled is covered in the
+      <a href={router.href("/privacy")}>privacy policy</a>.
+    </p>
+  </section>
+
+  <section>
+    <h2>What's fine</h2>
+    <p>
+      It's your inbox. Use it for whatever you like, adult content and porn included, as long as it's legal. Adult
+      content is for adults only: don't send it to anyone under 18, or to people who haven't agreed to get it.
+    </p>
+  </section>
+
+  <section>
+    <h2>What isn't</h2>
+    <p>Don't use the inbox for anything illegal. That includes, but isn't limited to:</p>
+    <ul>
+      <li>Any sexual content involving minors. This gets your account removed straight away and reported to the authorities.</li>
+      <li>Sharing intimate images of someone without their consent.</li>
+      <li>Spam: bulk or unsolicited mail that people didn't ask for.</li>
+      <li>Phishing, scams, fraud, or sending malware.</li>
+      <li>Threats, harassment, or stalking.</li>
+      <li>Trying to break into the service or other people's accounts, or getting in the way of it working for everyone else.</li>
+    </ul>
+    <p>
+      Spam and abuse can also get the shared domains blocked by other mail providers, which hurts everyone using them,
+      so it's treated seriously.
+    </p>
+  </section>
+
+  <section>
+    <h2>Moderation</h2>
+    <p>
+      If something illegal or abusive is reported or spotted, Clove may look at the mail involved, remove it, suspend or
+      delete the account, and report it to the authorities where that's needed. Mail isn't read otherwise.
+    </p>
+  </section>
+
+  <section>
+    <h2>Your mail and your account</h2>
+    <ul>
+      <li>What you write stays yours. The inbox only stores and delivers it so you can use the service.</li>
+      <li>You're responsible for what you send, and for keeping your SSO account secure.</li>
+      <li>Your addresses come with your account and stop working when it ends.</li>
+      <li>You can leave at any time: email <a href="mailto:{contact}">{contact}</a> to have your account deleted.</li>
+    </ul>
+  </section>
+
+  <section>
+    <h2>No guarantees</h2>
+    <p>
+      The inbox is run by one person and provided as it is. It may go down, lose mail, or change, and there's no promise
+      it'll be around forever, so keep your own copies of anything important. As far as the law allows, Clove isn't
+      liable for losses from using it or not being able to.
+    </p>
+  </section>
+
+  <section>
+    <h2>Changes</h2>
+    <p>
+      If these terms change, the date at the top changes with it. Big changes will be announced to account holders.
+      Questions go to <a href="mailto:{contact}">{contact}</a>.
+    </p>
+  </section>
+</LegalPage>