Dough Git

commit

Update site

commit
535d1d8821ae437909cdb6258d14386d4f43295d
author
Clove Twilight <[email protected]>
date
2026-11-04 18:32

diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..4d57c38
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,22 @@
+# Copy to `.env`. In production it lives next to the build (see deploy/run).
+
+# ---- Admin sign-in (Doughmination SSO) ---------------------------------------
+# In the SSO admin, add a *confidential* application, group-locked to admins:
+#   Redirect URI: https://doughmination.gay/admin/callback
+#   (and http://localhost:5173/admin/callback for local dev)
+SSO_CLIENT_ID=
+SSO_CLIENT_SECRET=
+# Optional, defaults to https://auth.doughmination.gay
+# SSO_ISSUER=
+
+# Signs the admin session cookie. At least 32 characters,
+# e.g. `openssl rand -base64 48`.
+SESSION_SECRET=
+
+# ---- Guestbook ---------------------------------------------------------------
+# Must match one of the API's GUESTBOOK_ADMIN_KEYS.
+GUESTBOOK_ADMIN_KEY=
+
+# Optional Cloudflare Turnstile site key. Leave blank if the API has no
+# TURNSTILE_SECRET set, or every post will fail the captcha check.
+PUBLIC_TURNSTILE_SITE_KEY=
diff --git a/.gitignore b/.gitignore
index 3b462cb..d853db0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,5 @@ Thumbs.db
 # Vite
 vite.config.js.timestamp-*
 vite.config.ts.timestamp-*
+
+api/
\ No newline at end of file
diff --git a/deploy/run b/deploy/run
index 90b4b54..9eeb03f 100755
--- a/deploy/run
+++ b/deploy/run
@@ -7,4 +7,9 @@ export HOST=127.0.0.1
 export PORT=3100
 export NODE_ENV=production
 
-exec /home/clove/.nvm/versions/node/v26.11.1/bin/node build/index.js
+# Public URL behind the proxy: SvelteKit needs it for form actions (CSRF check)
+# and to build the SSO redirect URI
+export ORIGIN=https://doughmination.gay
+
+# Secrets (SSO client, session secret, guestbook key) live in /srv/clove/web/.env
+exec /home/clove/.nvm/versions/node/v26.11.1/bin/node --env-file-if-exists=.env build/index.js
diff --git a/src/env.ts b/src/env.ts
new file mode 100644
index 0000000..b7e1957
--- /dev/null
+++ b/src/env.ts
@@ -0,0 +1,33 @@
+/* src/env.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+// Runtime environment variables, see .env.example. All optional: without the
+// SSO ones the admin page reports itself unconfigured, and without the
+// Turnstile key the guestbook posts with no captcha.
+
+import { defineEnvVars } from '@sveltejs/kit/env';
+
+const optional = (value: string | undefined) => value || undefined;
+
+export const variables = defineEnvVars({
+	SSO_ISSUER: { schema: optional, description: 'SSO issuer, defaults to authUrl' },
+	SSO_CLIENT_ID: { schema: optional, description: "This site's SSO application client id" },
+	SSO_CLIENT_SECRET: { schema: optional, description: "This site's SSO application secret" },
+	SESSION_SECRET: {
+		schema: (value) => {
+			if (value && value.length < 32) throw new Error('SESSION_SECRET must be 32+ characters');
+			return optional(value);
+		},
+		description: 'Signs the admin session cookie'
+	},
+	GUESTBOOK_ADMIN_KEY: {
+		schema: optional,
+		description: "Sent as X-Guestbook-Key, one of the API's GUESTBOOK_ADMIN_KEYS"
+	},
+	PUBLIC_TURNSTILE_SITE_KEY: {
+		public: true,
+		schema: optional,
+		description: 'Cloudflare Turnstile site key for the guestbook form'
+	}
+});
diff --git a/src/lib/components/FriendCard.svelte b/src/lib/components/FriendCard.svelte
index a2e007f..0b5e3d5 100644
--- a/src/lib/components/FriendCard.svelte
+++ b/src/lib/components/FriendCard.svelte
@@ -23,6 +23,7 @@
 	import IcStar from '~icons/ic/outline-star';
 	import IcVerified from '~icons/ic/outline-verified';
 	import ListeningIcon from '#lib/components/ListeningIcon.svelte';
+	import { discordCdn } from '#lib';
 	import {
 		pickListening,
 		assetUrl,
@@ -82,7 +83,7 @@
 		user ? user.display_name || user.global_name || user.username : friend.name
 	);
 	const handle = $derived(user?.username ?? '');
-	const avatar = $derived(user?.avatar_url ?? 'https://cdn.discordapp.com/embed/avatars/0.png');
+	const avatar = $derived(user?.avatar_url ?? `${discordCdn}/embed/avatars/0.png`);
 	const gradient = $derived(nameGradient(user?.display_name_styles?.colors));
 	const decoration = $derived(findCollectible(record, 'avatar_decoration'));
 	const pronouns = $derived(user?.pronouns || record?.pronoundb || '');
diff --git a/src/lib/components/Hamburger.svelte b/src/lib/components/Hamburger.svelte
index 44c8ea6..2defbf7 100644
--- a/src/lib/components/Hamburger.svelte
+++ b/src/lib/components/Hamburger.svelte
@@ -23,6 +23,7 @@
 			{ href: '/music', label: 'Music' },
 			{ href: '/friends', label: 'Friends' },
 			{ href: '/88x31', label: '88x31' },
+			{ href: '/guestbook', label: 'Guestbook' },
 			{ href: '/contact', label: 'Contact' },
 			{ href: '/cv', label: 'CV' }
 		]
diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte
index 85e05ee..d5d86fc 100644
--- a/src/lib/components/Header.svelte
+++ b/src/lib/components/Header.svelte
@@ -9,7 +9,7 @@
 	import Hamburger from '#lib/components/Hamburger.svelte';
 	import { SiGithub, SiDiscord } from 'simple-icons';
 	import '#lib/styles/header.css';
-	import { websiteDomain } from '#lib';
+	import { authUrl, githubUrl, websiteDomain } from '#lib';
 </script>
 
 <!-- Fixed-height page backdrop, so every page gets the same amount of background -->
@@ -21,10 +21,8 @@
 		<span>{websiteDomain}</span>
 	</a>
 	<nav>
-		<a href="https://auth.doughmination.gay" target="_blank"><IcKey class="nav-icon" />Apps</a>
-		<a href="https://github.com/doughmination" target="_blank"
-			><SiGithub class="nav-icon" />GitHub</a
-		>
+		<a href={authUrl} target="_blank"><IcKey class="nav-icon" />Apps</a>
+		<a href={githubUrl} target="_blank"><SiGithub class="nav-icon" />GitHub</a>
 		<a href="/contact"><IcCall class="nav-icon" />Contact</a>
 		<a href="/invite"> <SiDiscord class="nav-icon" />Discord Server</a>
 		<a href="/blog"><IcArticle class="nav-icon" />Blog</a>
diff --git a/src/lib/components/Meta.svelte b/src/lib/components/Meta.svelte
index 2e0d269..a77d7d2 100644
--- a/src/lib/components/Meta.svelte
+++ b/src/lib/components/Meta.svelte
@@ -5,7 +5,16 @@
 <script lang="ts">
 	import { page } from '$app/state';
 
-	import { websiteDomain, websiteUrl } from '#lib';
+	import {
+		websiteDomain,
+		websiteUrl,
+		githubUrl,
+		twitterUrl,
+		blueskyUrl,
+		linkedinUrl,
+		twitchUrl,
+		youtubeUrl
+	} from '#lib';
 
 	// Matches --accent in theme.css
 	const accentColour = 0xeb459e;
@@ -79,14 +88,7 @@
 				url: websiteUrl + '/',
 				image: websiteUrl + '/favicon.png',
 				jobTitle: 'Software Developer',
-				sameAs: [
-					'https://github.com/doughmination',
-					'https://x.com/DoughminCEO',
-					'https://bsky.app/profile/doughmination.gay',
-					'https://uk.linkedin.com/in/estrogen',
-					'https://www.twitch.tv/doughminationgaming',
-					'https://www.youtube.com/@CloveTwiGaming'
-				]
+				sameAs: [githubUrl, twitterUrl, blueskyUrl, linkedinUrl, twitchUrl, youtubeUrl]
 			},
 			{
 				'@type': 'WebSite',
diff --git a/src/lib/index.ts b/src/lib/index.ts
index 4a163d4..9243734 100644
--- a/src/lib/index.ts
+++ b/src/lib/index.ts
@@ -4,25 +4,56 @@
 
 // This files contains all the constants used over each page
 
-export const discordId = '1464890289922641993';
+// Site
 
 export const websiteDomain = 'doughmination.gay';
 
 export const websiteUrl = `https://${websiteDomain}`;
 
-export const lfmApi = 'https://ws.audioscrobbler.com/2.0/';
+export const contactEmail = `clove@${websiteDomain}`;
 
-export const lfmUser = 'Real_AlexTLM';
+export const mediaBase = `https://m.${websiteDomain}`;
 
-export const lmfKey = '768e8bd0d366f4d6c7874740ca6610ad';
+export const authUrl = `https://auth.${websiteDomain}`;
+
+// Doughmination API (https://doughmination.uk, see /docs there)
+
+export const apiBase = 'https://doughmination.uk';
+
+export const wsUrl = 'wss://doughmination.uk/v2/ws';
+
+// Discord
+
+export const discordId = '1464890289922641993';
 
 export const discordInvite = 'https://discord.com/invite/N8gCjS294R';
 
-export const lrcLibHosts = [
-	'https://lyrics.doughmination.gay',
-	'https://lrclib.net'
-];
+export const discordCdn = 'https://cdn.discordapp.com';
+
+// Socials
+
+export const githubUrl = 'https://github.com/doughmination';
+
+export const twitterUrl = 'https://x.com/DoughminCEO';
+
+export const blueskyUrl = `https://bsky.app/profile/${websiteDomain}`;
+
+export const linkedinUrl = 'https://uk.linkedin.com/in/estrogen';
+
+export const twitchUrl = 'https://www.twitch.tv/doughminationgaming';
+
+export const youtubeUrl = 'https://www.youtube.com/@CloveTwiGaming';
+
+// Music
+
+export const lfmApi = 'https://ws.audioscrobbler.com/2.0/';
+
+export const lfmUser = 'Real_AlexTLM';
+
+export const lmfKey = '768e8bd0d366f4d6c7874740ca6610ad';
 
 export const lfmPlaceholder = '2a96cbd8b46e442fc41c2b86b821562f';
 
-export const tadbApi =  'https://www.theaudiodb.com/api/v1/json/123';
+export const lrcLibHosts = [`https://lyrics.${websiteDomain}`, 'https://lrclib.net'];
+
+export const tadbApi = 'https://www.theaudiodb.com/api/v1/json/123';
diff --git a/src/lib/scripts/api.ts b/src/lib/scripts/api.ts
new file mode 100644
index 0000000..d25db92
--- /dev/null
+++ b/src/lib/scripts/api.ts
@@ -0,0 +1,43 @@
+/* src/lib/scripts/api.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+// One client for every call to the Doughmination API (https://doughmination.uk,
+// see /docs there). Routes either return the payload bare with errors as
+// { detail } / { error }, or wrap it in a { success, data, error } envelope.
+
+import { apiBase } from '#lib';
+
+export class ApiError extends Error {
+	constructor(
+		message: string,
+		readonly status: number
+	) {
+		super(message);
+	}
+}
+
+type ErrorBody = { detail?: string; error?: string | { message?: string } };
+
+function errorMessage(body: ErrorBody | null, status: number): string {
+	const error = typeof body?.error === 'string' ? body.error : body?.error?.message;
+	return body?.detail ?? error ?? `Request failed (${status})`;
+}
+
+/** A bare-payload route. Throws ApiError on any non-2xx response. */
+export async function api<T>(path: string, init?: RequestInit): Promise<T> {
+	const res = await fetch(apiBase + path, {
+		...init,
+		headers: { ...(init?.body ? { 'Content-Type': 'application/json' } : {}), ...init?.headers }
+	});
+	const body = (await res.json().catch(() => null)) as (T & ErrorBody) | null;
+	if (!res.ok) throw new ApiError(errorMessage(body, res.status), res.status);
+	return body as T;
+}
+
+/** A { success, data } route, unwrapped to its data. */
+export async function apiData<T>(path: string, init?: RequestInit): Promise<T> {
+	const body = await api<{ success: boolean; data?: T } & ErrorBody>(path, init);
+	if (!body.success || body.data === undefined) throw new ApiError(errorMessage(body, 200), 200);
+	return body.data;
+}
diff --git a/src/lib/scripts/discord.ts b/src/lib/scripts/discord.ts
index 36d38df..9e29c59 100644
--- a/src/lib/scripts/discord.ts
+++ b/src/lib/scripts/discord.ts
@@ -7,8 +7,8 @@
 
 import { cached, invalidateOn } from '#lib/scripts/cache.ts';
 
-export const API_BASE = 'https://doughmination.uk';
-export const WS_URL = 'wss://doughmination.uk/v2/ws';
+import { wsUrl, discordCdn } from '#lib';
+import { apiData } from '#lib/scripts/api.ts';
 
 export type Status = 'online' | 'idle' | 'dnd' | 'offline';
 
@@ -103,20 +103,10 @@ export interface DiscordRecord {
 
 // Live presence comes over the socket, so the rest of the record can be kept a while
 export function fetchUser(id: string): Promise<DiscordRecord> {
-	return cached(
-		`discord:${id}`,
-		async () => {
-			const res = await fetch(`${API_BASE}/v2/discord/users/${id}`);
-			const body = (await res.json()) as {
-				success: boolean;
-				data?: DiscordRecord;
-				error?: { message?: string };
-			};
-			if (!body.success) throw new Error(body.error?.message ?? `Request failed (${res.status})`);
-			return body.data as DiscordRecord;
-		},
-		{ ttl: 10 * 60_000, events: ['reconnect'] }
-	);
+	return cached(`discord:${id}`, () => apiData<DiscordRecord>(`/v2/discord/users/${id}`), {
+		ttl: 10 * 60_000,
+		events: ['reconnect']
+	});
 }
 
 // ---- Live socket ----------------------------------------------------------
@@ -158,7 +148,7 @@ function emitEvent(type: string) {
 }
 
 function connect() {
-	ws = new WebSocket(WS_URL);
+	ws = new WebSocket(wsUrl);
 
 	ws.onopen = () => {
 		if (retry) emitEvent('reconnect');
@@ -316,11 +306,11 @@ export function assetUrl(appId: string | undefined, asset: string | undefined):
 	if (!asset) return null;
 	if (asset.startsWith('mp:')) return 'https://media.discordapp.net/' + asset.slice(3);
 	if (!appId) return null;
-	return `https://cdn.discordapp.com/app-assets/${appId}/${asset}.png`;
+	return `${discordCdn}/app-assets/${appId}/${asset}.png`;
 }
 
 export function emojiUrl(id: string, animated: boolean): string {
-	return `https://cdn.discordapp.com/emojis/${id}.${animated ? 'gif' : 'png'}?size=32`;
+	return `${discordCdn}/emojis/${id}.${animated ? 'gif' : 'png'}?size=32`;
 }
 
 export function intToHex(n: number): string {
diff --git a/src/lib/scripts/guestbook.ts b/src/lib/scripts/guestbook.ts
new file mode 100644
index 0000000..14dcaaf
--- /dev/null
+++ b/src/lib/scripts/guestbook.ts
@@ -0,0 +1,44 @@
+/* src/lib/scripts/guestbook.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+// Guestbook on the Doughmination API. Posting goes straight from the browser,
+// so the API's per-IP rate limit sees the visitor rather than this server.
+
+import { api } from '#lib/scripts/api.ts';
+
+export interface Entry {
+	id: string;
+	name: string;
+	message: string;
+	website: string;
+	ts: number;
+}
+
+export interface AdminEntry extends Entry {
+	status: 'approved' | 'pending';
+	flagged?: string[];
+}
+
+export const LIMITS = { name: 40, message: 500, website: 200 } as const;
+
+export function fetchEntries(limit = 50, offset = 0) {
+	return api<{ entries: Entry[]; total: number }>(`/v2/guestbook?limit=${limit}&offset=${offset}`);
+}
+
+export interface Signature {
+	name: string;
+	message: string;
+	website: string;
+	/** Honeypot, left empty by people */
+	url2: string;
+	turnstileToken?: string;
+}
+
+/** Sign the guestbook. `pending` means the word filter held it for review. */
+export function signGuestbook(signature: Signature) {
+	return api<{ ok: true; entry?: Entry; pending?: true; skipped?: true }>('/v2/guestbook', {
+		method: 'POST',
+		body: JSON.stringify(signature)
+	});
+}
diff --git a/src/lib/scripts/heatmap.ts b/src/lib/scripts/heatmap.ts
index 537def4..c9d7dd3 100644
--- a/src/lib/scripts/heatmap.ts
+++ b/src/lib/scripts/heatmap.ts
@@ -5,7 +5,7 @@
 // Contribution heatmap: daily counts from every Git host I use, merged into
 // GitHub-style weeks (Sunday to Saturday, UTC)
 
-import { API_BASE } from '#lib/scripts/discord.ts';
+import { apiData } from '#lib/scripts/api.ts';
 import { cached } from '#lib/scripts/cache.ts';
 
 export interface Day {
@@ -84,10 +84,7 @@ export function fetchContributions(): Promise<Contributions> {
 }
 
 async function loadContributions(): Promise<Contributions> {
-	const res = await fetch(`${API_BASE}/v2/contribapi`);
-	const body = (await res.json()) as { success: boolean; data?: Record<string, SourceDay[]> };
-	if (!body.success || !body.data) throw new Error(`Request failed (${res.status})`);
-	const weeks = toWeeks(body.data);
+	const weeks = toWeeks(await apiData<Record<string, SourceDay[]>>('/v2/contribapi'));
 	const total = weeks.flat().reduce((sum, day) => sum + day.contributions, 0);
 	return { weeks, total, since: weeks[0]?.[0]?.date ?? null };
 }
diff --git a/src/lib/scripts/music.ts b/src/lib/scripts/music.ts
index 2d85f29..b3dce67 100644
--- a/src/lib/scripts/music.ts
+++ b/src/lib/scripts/music.ts
@@ -7,7 +7,16 @@
 import { pickListening, type Presence } from '#lib/scripts/discord.ts';
 import { cached } from '#lib/scripts/cache.ts';
 
-import { lfmApi, lfmUser, lmfKey, lfmPlaceholder, lrcLibHosts, tadbApi } from '#lib';
+import {
+	lfmApi,
+	lfmUser,
+	lmfKey,
+	lfmPlaceholder,
+	lrcLibHosts,
+	tadbApi,
+	websiteDomain,
+	websiteUrl
+} from '#lib';
 
 const ART_CACHE_PREFIX = 'dough:artimg:';
 const DAY = 86_400_000;
@@ -225,7 +234,7 @@ function lrclibGet(params: Record<string, string>) {
 	const qs = new URLSearchParams(params);
 	return fromAnyHost(async (host) => {
 		const res = await fetch(`${host}/api/get?${qs}`, {
-			headers: { 'X-User-Agent': 'doughmination.gay music (https://doughmination.gay)' }
+			headers: { 'X-User-Agent': `${websiteDomain} music (${websiteUrl})` }
 		});
 		return res.ok ? ((await res.json()) as LrclibRecord) : null;
 	});
diff --git a/src/lib/scripts/plural.ts b/src/lib/scripts/plural.ts
index cdec647..336f10c 100644
--- a/src/lib/scripts/plural.ts
+++ b/src/lib/scripts/plural.ts
@@ -5,7 +5,7 @@
 // Fronting and device state from the Doughmination API
 // (https://doughmination.uk, see /docs there)
 
-import { API_BASE } from '#lib/scripts/discord.ts';
+import { api } from '#lib/scripts/api.ts';
 import { cached } from '#lib/scripts/cache.ts';
 
 export interface Member {
@@ -30,20 +30,11 @@ export interface Device {
 	updated_at: string;
 }
 
-// Unlike the Discord routes, these return the payload bare rather than in
-// a { success, data } envelope, and errors as { detail }
-async function get<T>(path: string): Promise<T> {
-	const res = await fetch(API_BASE + path);
-	const body = (await res.json()) as T & { detail?: string };
-	if (!res.ok) throw new Error(body?.detail ?? `Request failed (${res.status})`);
-	return body as T;
-}
-
 // Both are kept until the socket says they've changed
 export function fetchFronters(): Promise<Member[]> {
 	return cached(
 		'fronters',
-		async () => (await get<{ members: Member[] }>('/v2/plural/fronters')).members ?? [],
+		async () => (await api<{ members: Member[] }>('/v2/plural/fronters')).members ?? [],
 		{ events: ['fronters_update', 'reconnect'] }
 	);
 }
@@ -51,7 +42,7 @@ export function fetchFronters(): Promise<Member[]> {
 export function fetchDevice(device: string): Promise<Device> {
 	return cached(
 		`device:${device}`,
-		() => get<Device>(`/v2/devices/${encodeURIComponent(device)}`),
+		() => api<Device>(`/v2/devices/${encodeURIComponent(device)}`),
 		{
 			events: ['device_update', 'reconnect']
 		}
diff --git a/src/lib/server/guestbook.ts b/src/lib/server/guestbook.ts
new file mode 100644
index 0000000..4a3838e
--- /dev/null
+++ b/src/lib/server/guestbook.ts
@@ -0,0 +1,38 @@
+/* src/lib/server/guestbook.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+// Guestbook moderation, called only from the admin page's server code. The
+// key never leaves this server.
+
+import { error } from '@sveltejs/kit';
+import { GUESTBOOK_ADMIN_KEY } from '$app/env/private';
+
+import { api } from '#lib/scripts/api.ts';
+import type { AdminEntry } from '#lib/scripts/guestbook.ts';
+
+function admin<T>(path: string, init?: RequestInit): Promise<T> {
+	const key = GUESTBOOK_ADMIN_KEY;
+	if (!key) error(503, 'GUESTBOOK_ADMIN_KEY is not set');
+	return api<T>(`/v2/guestbook/admin${path}`, {
+		...init,
+		headers: { 'X-Guestbook-Key': key }
+	});
+}
+
+export const listEntries = () =>
+	admin<{ entries: AdminEntry[]; total: number; pending: number }>('/entries');
+
+export const setStatus = (id: string, status: AdminEntry['status']) =>
+	admin(`/entries/${encodeURIComponent(id)}`, {
+		method: 'PATCH',
+		body: JSON.stringify({ status })
+	});
+
+export const deleteEntry = (id: string) =>
+	admin(`/entries/${encodeURIComponent(id)}`, { method: 'DELETE' });
+
+export const getBlocklist = () => admin<{ words: string[] }>('/blocklist');
+
+export const saveBlocklist = (words: string[]) =>
+	admin<{ words: string[] }>('/blocklist', { method: 'PUT', body: JSON.stringify({ words }) });
diff --git a/src/lib/server/sso.ts b/src/lib/server/sso.ts
new file mode 100644
index 0000000..7cb6a88
--- /dev/null
+++ b/src/lib/server/sso.ts
@@ -0,0 +1,193 @@
+/* src/lib/server/sso.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+// Admin sign-in through the Doughmination SSO (OpenID Connect, Authorization
+// Code + PKCE), run entirely on the server. Who may sign in at all is decided
+// by the SSO application's group lock; this file only proves who came back.
+//
+// The code exchange and userinfo call are server-to-server over TLS with the
+// client secret, so their responses are trusted directly, as the API does.
+// The session is a signed, httpOnly cookie, so no token ever reaches the page.
+
+import { createHash, createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
+import { error, redirect, type Cookies, type RequestEvent } from '@sveltejs/kit';
+import { dev } from '$app/env';
+import { SESSION_SECRET, SSO_CLIENT_ID, SSO_CLIENT_SECRET, SSO_ISSUER } from '$app/env/private';
+
+import { authUrl } from '#lib';
+
+const SESSION_COOKIE = 'admin_session';
+const LOGIN_COOKIE = 'admin_login';
+const SESSION_HOURS = 12;
+const LOGIN_MINUTES = 10;
+
+export interface AdminSession {
+	sub: string;
+	name: string;
+	exp: number;
+}
+
+interface Discovery {
+	issuer: string;
+	authorization_endpoint: string;
+	token_endpoint: string;
+	userinfo_endpoint: string;
+}
+
+function config() {
+	if (!SSO_CLIENT_ID || !SSO_CLIENT_SECRET || !SESSION_SECRET) {
+		error(503, 'Admin sign-in is not configured');
+	}
+	const issuer = (SSO_ISSUER || authUrl).replace(/\/+$/, '');
+	return {
+		issuer,
+		clientId: SSO_CLIENT_ID,
+		clientSecret: SSO_CLIENT_SECRET,
+		secret: SESSION_SECRET
+	};
+}
+
+let discovery: Promise<Discovery> | undefined;
+
+function discover(issuer: string): Promise<Discovery> {
+	discovery ??= fetch(`${issuer}/.well-known/openid-configuration`)
+		.then((res) => {
+			if (!res.ok) throw new Error(`SSO discovery failed (${res.status})`);
+			return res.json() as Promise<Discovery>;
+		})
+		.catch((err) => {
+			discovery = undefined; // retry next time
+			throw err;
+		});
+	return discovery;
+}
+
+// ---- Signed cookies ---------------------------------------------------------
+
+const b64url = (buf: Buffer) => buf.toString('base64url');
+
+function sign(value: object, secret: string): string {
+	const payload = b64url(Buffer.from(JSON.stringify(value)));
+	return `${payload}.${b64url(createHmac('sha256', secret).update(payload).digest())}`;
+}
+
+function verify<T extends { exp: number }>(token: string | undefined, secret: string): T | null {
+	const [payload, mac] = token?.split('.') ?? [];
+	if (!payload || !mac) return null;
+	const expected = createHmac('sha256', secret).update(payload).digest();
+	const given = Buffer.from(mac, 'base64url');
+	if (given.length !== expected.length || !timingSafeEqual(given, expected)) return null;
+	try {
+		const value = JSON.parse(Buffer.from(payload, 'base64url').toString()) as T;
+		return value.exp > Date.now() ? value : null;
+	} catch {
+		return null;
+	}
+}
+
+const cookieOptions = (maxAge: number) =>
+	({ path: '/admin', httpOnly: true, secure: !dev, sameSite: 'lax', maxAge }) as const;
+
+// ---- Flow ---------------------------------------------------------------------
+
+const redirectUri = (url: URL) => `${url.origin}/admin/callback`;
+
+/** Start sign-in: remember state + PKCE verifier, then send the browser to the SSO. */
+export async function beginLogin({ url, cookies }: RequestEvent): Promise<never> {
+	const { issuer, clientId, secret } = config();
+	const doc = await discover(issuer);
+
+	const state = b64url(randomBytes(32));
+	const verifier = b64url(randomBytes(32));
+	cookies.set(
+		LOGIN_COOKIE,
+		sign({ state, verifier, exp: Date.now() + LOGIN_MINUTES * 60_000 }, secret),
+		cookieOptions(LOGIN_MINUTES * 60)
+	);
+
+	const target = new URL(doc.authorization_endpoint);
+	target.search = new URLSearchParams({
+		response_type: 'code',
+		client_id: clientId,
+		redirect_uri: redirectUri(url),
+		scope: 'openid profile',
+		state,
+		code_challenge: b64url(createHash('sha256').update(verifier).digest()),
+		code_challenge_method: 'S256'
+	}).toString();
+	redirect(303, target.toString());
+}
+
+/** Finish sign-in: check state, swap the code for tokens and open a session. */
+export async function completeLogin({ url, cookies }: RequestEvent): Promise<never> {
+	const { issuer, clientId, clientSecret, secret } = config();
+	const login = verify<{ state: string; verifier: string; exp: number }>(
+		cookies.get(LOGIN_COOKIE),
+		secret
+	);
+	cookies.delete(LOGIN_COOKIE, { path: '/admin' });
+
+	const denied = url.searchParams.get('error');
+	if (denied)
+		error(403, denied === 'access_denied' ? 'Your SSO account is not allowed here' : denied);
+
+	const code = url.searchParams.get('code');
+	if (!login || !code || url.searchParams.get('state') !== login.state) {
+		error(400, 'Sign-in expired or invalid, please try again');
+	}
+
+	const doc = await discover(issuer);
+	const iss = url.searchParams.get('iss');
+	if (iss !== null && iss !== doc.issuer) error(400, 'Sign-in came from an unexpected issuer');
+
+	const tokenRes = await fetch(doc.token_endpoint, {
+		method: 'POST',
+		headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
+		body: new URLSearchParams({
+			grant_type: 'authorization_code',
+			code,
+			redirect_uri: redirectUri(url),
+			code_verifier: login.verifier,
+			client_id: clientId,
+			client_secret: clientSecret
+		})
+	});
+	if (!tokenRes.ok) error(502, `The SSO rejected the sign-in (${tokenRes.status})`);
+	const { access_token } = (await tokenRes.json()) as { access_token?: string };
+	if (!access_token) error(502, 'The SSO did not return an access token');
+
+	const infoRes = await fetch(doc.userinfo_endpoint, {
+		headers: { Authorization: `Bearer ${access_token}`, Accept: 'application/json' }
+	});
+	if (!infoRes.ok) error(502, `SSO userinfo request failed (${infoRes.status})`);
+	const claims = (await infoRes.json()) as {
+		sub?: string;
+		name?: string;
+		preferred_username?: string;
+	};
+	if (!claims.sub) error(502, 'The SSO did not return a subject identifier');
+
+	const session: AdminSession = {
+		sub: claims.sub,
+		name: claims.name || claims.preferred_username || 'Admin',
+		exp: Date.now() + SESSION_HOURS * 3_600_000
+	};
+	cookies.set(SESSION_COOKIE, sign(session, secret), cookieOptions(SESSION_HOURS * 3600));
+	redirect(303, '/admin');
+}
+
+export function getSession(cookies: Cookies): AdminSession | null {
+	return verify<AdminSession>(cookies.get(SESSION_COOKIE), config().secret);
+}
+
+/** The signed-in admin, or a redirect to sign in. */
+export function requireSession(cookies: Cookies): AdminSession {
+	const session = getSession(cookies);
+	if (!session) redirect(303, '/admin/login');
+	return session;
+}
+
+export function endSession(cookies: Cookies): void {
+	cookies.delete(SESSION_COOKIE, { path: '/admin' });
+}
diff --git a/src/lib/styles/guestbook.css b/src/lib/styles/guestbook.css
new file mode 100644
index 0000000..1b50720
--- /dev/null
+++ b/src/lib/styles/guestbook.css
@@ -0,0 +1,230 @@
+/* src/lib/styles/guestbook.css
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+/* Guestbook (also used by the admin page) */
+
+.guestbook {
+	display: flex;
+	flex-direction: column;
+	gap: 1.5rem;
+	padding-block: 2rem;
+}
+
+/* Form */
+
+.gb-form {
+	display: flex;
+	flex-direction: column;
+	gap: 1rem;
+	padding: 1.25rem 1.5rem;
+	border: 1px solid var(--line);
+	border-radius: 1rem;
+	background: var(--raised);
+}
+
+.gb-row {
+	display: grid;
+	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
+	gap: 1rem;
+}
+
+.gb-form label {
+	position: relative;
+	display: flex;
+	flex-direction: column;
+	gap: 0.4rem;
+}
+
+.gb-form label > span {
+	color: var(--accent);
+	font-size: 0.7rem;
+	font-weight: 600;
+	letter-spacing: 0.14em;
+	text-transform: uppercase;
+}
+
+.gb-form label em {
+	color: var(--muted);
+	font-style: normal;
+	text-transform: none;
+	letter-spacing: normal;
+}
+
+.gb-form input,
+.gb-form textarea {
+	padding: 0.6rem 0.75rem;
+	border: 1px solid var(--line);
+	border-radius: 0.6rem;
+	background: rgb(0 0 0 / 25%);
+	color: var(--text);
+	font: inherit;
+}
+
+.gb-form textarea {
+	resize: vertical;
+}
+
+.gb-form input:focus-visible,
+.gb-form textarea:focus-visible {
+	outline: 2px solid var(--accent);
+	outline-offset: 1px;
+}
+
+.gb-count {
+	align-self: flex-end;
+	color: var(--muted);
+	font-size: 0.75rem;
+}
+
+.gb-trap {
+	position: absolute !important;
+	left: -10000px;
+	width: 1px;
+	height: 1px;
+	overflow: hidden;
+}
+
+.gb-actions {
+	display: flex;
+	flex-wrap: wrap;
+	gap: 0.75rem 1rem;
+	align-items: center;
+}
+
+.guestbook button,
+.gb-link {
+	padding: 0.5rem 1rem;
+	border: 0;
+	border-radius: 999px;
+	background: var(--accent);
+	color: #fff;
+	font: inherit;
+	font-size: 0.9rem;
+	font-weight: 600;
+	cursor: pointer;
+	transition: filter 0.15s ease;
+}
+
+.guestbook button:hover,
+.gb-link:hover {
+	filter: brightness(1.1);
+}
+
+.guestbook button:disabled {
+	opacity: 0.6;
+	cursor: progress;
+}
+
+.gb-notice {
+	margin: 0;
+	font-size: 0.9rem;
+}
+
+.gb-notice.ok {
+	color: var(--accent);
+}
+
+.gb-notice.error {
+	color: #f38ba8;
+}
+
+.gb-hint {
+	margin: 0;
+	color: var(--muted);
+	font-size: 0.85rem;
+}
+
+/* Entries */
+
+.gb-empty {
+	color: var(--muted);
+}
+
+.gb-entries {
+	display: flex;
+	flex-direction: column;
+	gap: 0.75rem;
+	margin: 0;
+	padding: 0;
+	list-style: none;
+}
+
+.gb-entry {
+	padding: 1rem 1.25rem;
+	border: 1px solid var(--line);
+	border-radius: 1rem;
+	background: var(--raised);
+}
+
+.gb-entry.pending {
+	border-color: rgb(235 69 158 / 40%);
+}
+
+.gb-meta {
+	display: flex;
+	flex-wrap: wrap;
+	gap: 0.25rem 0.75rem;
+	align-items: baseline;
+	margin: 0 0 0.4rem;
+}
+
+.gb-meta time,
+.gb-site {
+	color: var(--muted);
+	font-size: 0.8rem;
+	overflow-wrap: anywhere;
+}
+
+.gb-message {
+	margin: 0;
+	white-space: pre-line;
+	overflow-wrap: anywhere;
+}
+
+.gb-flagged {
+	margin: 0.5rem 0 0;
+	color: var(--accent);
+	font-size: 0.8rem;
+}
+
+.gb-more {
+	align-self: center;
+}
+
+/* Admin */
+
+.gb-tabs {
+	display: flex;
+	flex-wrap: wrap;
+	gap: 0.5rem;
+}
+
+.guestbook .gb-tabs button {
+	border: 1px solid var(--line);
+	background: var(--raised);
+	color: var(--text);
+}
+
+.guestbook .gb-tabs button.active {
+	border-color: var(--accent);
+	background: var(--accent-dim);
+	color: var(--accent);
+}
+
+.gb-entry-actions {
+	display: flex;
+	gap: 0.5rem;
+	margin-top: 0.75rem;
+}
+
+.guestbook .gb-entry-actions button {
+	padding: 0.35rem 0.85rem;
+	font-size: 0.8rem;
+}
+
+.guestbook button.danger {
+	background: transparent;
+	border: 1px solid #f38ba8;
+	color: #f38ba8;
+}
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index ef97d55..af1507d 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -5,6 +5,7 @@
 <script lang="ts">
 	import { page } from '$app/state';
 	import '#lib/styles/index.css';
+	import { contactEmail } from '#lib';
 
 	const notFound = $derived(page.status === 404);
 	const serverError = $derived(page.status == 500);
@@ -24,7 +25,7 @@
 					The page you&apos;re looking for doesn&apos;t exist or has been moved.
 				{:else if serverError}
 					Something went wrong on the server while processing your request. Please try again in a
-					little while. If the problem persists, <a href="mailto:[email protected]"
+					little while. If the problem persists, <a href="mailto:{contactEmail}"
 						>contact the site administrator</a
 					> and include any relevant details about what you were doing.
 				{:else}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 6ea9bb1..0f0002f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -38,7 +38,7 @@
 		type Member
 	} from '#lib/scripts/plural.ts';
 
-	import { discordId } from '#lib';
+	import { discordId, lrcLibHosts } from '#lib';
 
 	const PHONE = 'S26';
 
@@ -144,7 +144,7 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://lyrics.doughmination.gay" crossorigin="" />
+	<link rel="preconnect" href={lrcLibHosts[0]} crossorigin="" />
 </svelte:head>
 
 <section class="hero">
diff --git a/src/routes/88x31/+page.svelte b/src/routes/88x31/+page.svelte
index 42eeac8..df2d2f1 100644
--- a/src/routes/88x31/+page.svelte
+++ b/src/routes/88x31/+page.svelte
@@ -5,6 +5,7 @@
 <script lang="ts">
 	import Meta from '#lib/components/Meta.svelte';
 	import '#lib/styles/buttons.css';
+	import { mediaBase, apiBase } from '#lib';
 
 	type Button = {
 		img: string;
@@ -14,12 +15,12 @@
 		eager?: boolean;
 	};
 
-	const BUTTON_BASE = 'https://m.doughmination.gay/img/88x31/';
+	const BUTTON_BASE = `${mediaBase}/img/88x31/`;
 
 	const BUTTONS: Button[] = [
 		{ href: 'https://www.monsterenergy.com/', img: 'monster.png', alt: 'MONSTER' },
 		{
-			href: 'https://doughmination.uk',
+			href: apiBase,
 			img: 'doughmination.png',
 			alt: 'Doughmination',
 			eager: true
@@ -95,7 +96,7 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://m.doughmination.gay" crossorigin="" />
+	<link rel="preconnect" href={mediaBase} crossorigin="" />
 </svelte:head>
 
 <section class="hero">
diff --git a/src/routes/admin/+page.server.ts b/src/routes/admin/+page.server.ts
new file mode 100644
index 0000000..77c75c8
--- /dev/null
+++ b/src/routes/admin/+page.server.ts
@@ -0,0 +1,59 @@
+// src/routes/admin/+page.server.ts
+// DASL-1.2 — (c) Clove Twilight
+
+import { fail, redirect } from '@sveltejs/kit';
+
+import { endSession, requireSession } from '#lib/server/sso.ts';
+import {
+	deleteEntry,
+	getBlocklist,
+	listEntries,
+	saveBlocklist,
+	setStatus
+} from '#lib/server/guestbook.ts';
+import type { Actions, PageServerLoad } from './$types';
+
+export const load: PageServerLoad = async ({ cookies }) => {
+	const session = requireSession(cookies);
+	const [entries, blocklist] = await Promise.all([listEntries(), getBlocklist()]);
+	return { name: session.name, ...entries, words: blocklist.words };
+};
+
+// Every action checks the session again: a form post doesn't run load first.
+async function run(cookies: Parameters<typeof requireSession>[0], task: () => Promise<unknown>) {
+	requireSession(cookies);
+	try {
+		await task();
+	} catch (err) {
+		return fail(502, { error: err instanceof Error ? err.message : 'Request failed' });
+	}
+}
+
+const entryId = async (request: Request) => String((await request.formData()).get('id') ?? '');
+
+export const actions: Actions = {
+	approve: async ({ cookies, request }) => {
+		const id = await entryId(request);
+		return run(cookies, () => setStatus(id, 'approved'));
+	},
+	hold: async ({ cookies, request }) => {
+		const id = await entryId(request);
+		return run(cookies, () => setStatus(id, 'pending'));
+	},
+	delete: async ({ cookies, request }) => {
+		const id = await entryId(request);
+		return run(cookies, () => deleteEntry(id));
+	},
+	blocklist: async ({ cookies, request }) => {
+		const words = String((await request.formData()).get('words') ?? '')
+			.split('\n')
+			.map((w) => w.trim())
+			.filter(Boolean);
+		const failed = await run(cookies, () => saveBlocklist(words));
+		return failed ?? { saved: true };
+	},
+	logout: async ({ cookies }) => {
+		endSession(cookies);
+		redirect(303, '/');
+	}
+};
diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte
new file mode 100644
index 0000000..cc10228
--- /dev/null
+++ b/src/routes/admin/+page.svelte
@@ -0,0 +1,108 @@
+<!-- src/routes/admin/+page.svelte
+     DASL-1.2 — (c) Clove Twilight
+-->
+
+<script lang="ts">
+	import { enhance } from '$app/forms';
+	import '#lib/styles/guestbook.css';
+	import type { PageProps } from './$types';
+
+	let { data, form }: PageProps = $props();
+
+	let filter = $state<'pending' | 'approved' | 'all'>('pending');
+
+	const shown = $derived(
+		filter === 'all' ? data.entries : data.entries.filter((e) => e.status === filter)
+	);
+	const dateFormat = new Intl.DateTimeFormat('en-GB', { dateStyle: 'medium', timeStyle: 'short' });
+</script>
+
+<svelte:head>
+	<title>Admin</title>
+	<meta name="robots" content="noindex, nofollow" />
+</svelte:head>
+
+<section class="hero">
+	<div class="wrap">
+		<p class="eyebrow">Signed in as {data.name}</p>
+		<h1>Guestbook admin</h1>
+		<form method="POST" action="?/logout">
+			<button class="gb-link">Sign out</button>
+		</form>
+	</div>
+</section>
+
+<section class="guestbook wrap">
+	{#if form?.error}
+		<p class="gb-notice error" role="alert">{form.error}</p>
+	{/if}
+
+	<div class="gb-tabs" role="tablist">
+		{#each [['pending', `Pending (${data.pending})`], ['approved', 'Approved'], ['all', 'All']] as const as [value, label] (value)}
+			<button
+				role="tab"
+				aria-selected={filter === value}
+				class:active={filter === value}
+				onclick={() => (filter = value)}>{label}</button
+			>
+		{/each}
+	</div>
+
+	{#if shown.length === 0}
+		<p class="gb-empty">Nothing here.</p>
+	{:else}
+		<ol class="gb-entries">
+			{#each shown as entry (entry.id)}
+				<li class="gb-entry" class:pending={entry.status === 'pending'}>
+					<p class="gb-meta">
+						<strong>{entry.name}</strong>
+						{#if entry.website}<span class="gb-site">{entry.website}</span>{/if}
+						<time datetime={new Date(entry.ts).toISOString()}>{dateFormat.format(entry.ts)}</time>
+					</p>
+					<p class="gb-message">{entry.message}</p>
+					{#if entry.flagged?.length}
+						<p class="gb-flagged">Held for: {entry.flagged.join(', ')}</p>
+					{/if}
+					<form method="POST" class="gb-entry-actions" use:enhance>
+						<input type="hidden" name="id" value={entry.id} />
+						{#if entry.status === 'pending'}
+							<button formaction="?/approve">Approve</button>
+						{:else}
+							<button formaction="?/hold">Hide</button>
+						{/if}
+						<button
+							formaction="?/delete"
+							class="danger"
+							onclick={(e) => {
+								if (!confirm(`Delete the message from ${entry.name}?`)) e.preventDefault();
+							}}>Delete</button
+						>
+					</form>
+				</li>
+			{/each}
+		</ol>
+	{/if}
+
+	<form
+		method="POST"
+		action="?/blocklist"
+		class="gb-form"
+		use:enhance={() =>
+			({ update }) =>
+				update({ reset: false })}
+	>
+		<label>
+			<span>Blocklist, one word or phrase per line</span>
+			<textarea name="words" rows="10" spellcheck="false">{data.words.join('\n')}</textarea>
+		</label>
+		<p class="gb-hint">
+			Matching ignores case, accents, spaces, punctuation, repeated letters and lookalikes like
+			<code>@</code> for <code>a</code>, and also checks inside longer words. A match holds the
+			message for review here rather than rejecting it. Changes only affect new messages.
+		</p>
+		<div class="gb-actions">
+			<button type="submit">Save blocklist</button>
+			{#if form?.saved}<p class="gb-notice ok" role="status">Saved.</p>{/if}
+		</div>
+	</form>
+</section>
diff --git a/src/routes/admin/callback/+server.ts b/src/routes/admin/callback/+server.ts
new file mode 100644
index 0000000..b773e34
--- /dev/null
+++ b/src/routes/admin/callback/+server.ts
@@ -0,0 +1,6 @@
+// src/routes/admin/callback/+server.ts
+// DASL-1.2 — (c) Clove Twilight
+
+import { completeLogin } from '#lib/server/sso.ts';
+
+export const GET = completeLogin;
diff --git a/src/routes/admin/login/+server.ts b/src/routes/admin/login/+server.ts
new file mode 100644
index 0000000..b4a3d03
--- /dev/null
+++ b/src/routes/admin/login/+server.ts
@@ -0,0 +1,6 @@
+// src/routes/admin/login/+server.ts
+// DASL-1.2 — (c) Clove Twilight
+
+import { beginLogin } from '#lib/server/sso.ts';
+
+export const GET = beginLogin;
diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte
index 6104b42..192dd5d 100644
--- a/src/routes/contact/+page.svelte
+++ b/src/routes/contact/+page.svelte
@@ -19,7 +19,15 @@
 		SiTumblr
 	} from 'simple-icons';
 	import '#lib/styles/contact.css';
-	import { discordId, websiteDomain } from '#lib';
+	import {
+		discordId,
+		contactEmail,
+		twitterUrl,
+		blueskyUrl,
+		linkedinUrl,
+		twitchUrl,
+		youtubeUrl
+	} from '#lib';
 
 	const contacts = [
 		{
@@ -30,8 +38,8 @@
 		},
 		{
 			name: 'Email',
-			value: `clove@${websiteDomain}`,
-			href: `mailto:clove@${websiteDomain}`,
+			value: contactEmail,
+			href: `mailto:${contactEmail}`,
 			icon: IcEmail
 		},
 		{
@@ -43,25 +51,25 @@
 		{
 			name: 'Twitter',
 			value: '@DoughminCEO',
-			href: 'https://x.com/DoughminCEO',
+			href: twitterUrl,
 			icon: SiX
 		},
 		{
 			name: 'LinkedIn',
 			value: 'estrogenhrt',
-			href: 'https://uk.linkedin.com/in/estrogen',
+			href: linkedinUrl,
 			icon: IcWork
 		},
 		{
 			name: 'Twitch',
 			value: 'doughminationgaming',
-			href: 'https://www.twitch.tv/doughminationgaming',
+			href: twitchUrl,
 			icon: SiTwitch
 		},
 		{
 			name: 'Bluesky',
 			value: '@doughmination.gay',
-			href: 'https://bsky.app/profile/doughmination.gay',
+			href: blueskyUrl,
 			icon: SiBluesky
 		},
 		{
@@ -79,7 +87,7 @@
 		{
 			name: 'YouTube',
 			value: '@CloveTwiGaming',
-			href: 'https://www.youtube.com/@CloveTwiGaming',
+			href: youtubeUrl,
 			icon: SiYoutube
 		},
 		{
diff --git a/src/routes/discord/+page.svelte b/src/routes/discord/+page.svelte
index 88c5f1c..737debe 100644
--- a/src/routes/discord/+page.svelte
+++ b/src/routes/discord/+page.svelte
@@ -43,7 +43,7 @@
 		type Presence
 	} from '#lib/scripts/discord.ts';
 
-	import { discordId } from '#lib';
+	import { discordId, apiBase, discordCdn } from '#lib';
 
 	let record = $state<DiscordRecord | null>(null);
 	let livePresence = $state<Presence | null>(null);
@@ -112,8 +112,8 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://doughmination.uk" crossorigin="" />
-	<link rel="preconnect" href="https://cdn.discordapp.com" />
+	<link rel="preconnect" href={apiBase} crossorigin="" />
+	<link rel="preconnect" href={discordCdn} />
 </svelte:head>
 
 <section class="hero">
diff --git a/src/routes/friends/+page.svelte b/src/routes/friends/+page.svelte
index 9b1d150..e42dcef 100644
--- a/src/routes/friends/+page.svelte
+++ b/src/routes/friends/+page.svelte
@@ -6,6 +6,7 @@
 	import Meta from '#lib/components/Meta.svelte';
 	import '#lib/styles/presence.css';
 	import '#lib/styles/friends.css';
+	import { apiBase, discordCdn } from '#lib';
 	import FriendCard, { type Friend } from '#lib/components/FriendCard.svelte';
 	import {
 		fetchUser,
@@ -48,8 +49,8 @@
 <Meta title="Friends" description="Friends of Clove Twilight, with their live Discord presence." />
 
 <svelte:head>
-	<link rel="preconnect" href="https://doughmination.uk" crossorigin="" />
-	<link rel="preconnect" href="https://cdn.discordapp.com" />
+	<link rel="preconnect" href={apiBase} crossorigin="" />
+	<link rel="preconnect" href={discordCdn} />
 </svelte:head>
 
 <section class="hero">
@@ -76,6 +77,6 @@
 	</div>
 
 	<p class="friends-credit">
-		Presence data is served by <a href="https://doughmination.uk">the Doughmination API</a>.
+		Presence data is served by <a href={apiBase}>the Doughmination API</a>.
 	</p>
 </div>
diff --git a/src/routes/guestbook/+page.svelte b/src/routes/guestbook/+page.svelte
new file mode 100644
index 0000000..fbbf684
--- /dev/null
+++ b/src/routes/guestbook/+page.svelte
@@ -0,0 +1,162 @@
+<!-- src/routes/guestbook/+page.svelte
+     DASL-1.2 — (c) Clove Twilight
+-->
+
+<script lang="ts">
+	import { onMount } from 'svelte';
+	import { PUBLIC_TURNSTILE_SITE_KEY } from '$app/env/public';
+	import Meta from '#lib/components/Meta.svelte';
+	import '#lib/styles/guestbook.css';
+	import { apiBase } from '#lib';
+	import { LIMITS, fetchEntries, signGuestbook, type Entry } from '#lib/scripts/guestbook.ts';
+
+	const PAGE_SIZE = 50;
+	const siteKey = PUBLIC_TURNSTILE_SITE_KEY;
+
+	let entries = $state<Entry[]>([]);
+	let total = $state(0);
+	let loading = $state(true);
+	let loadError = $state('');
+
+	let message = $state('');
+	let sending = $state(false);
+	let notice = $state<{ kind: 'ok' | 'error'; text: string } | null>(null);
+
+	const dateFormat = new Intl.DateTimeFormat('en-GB', { dateStyle: 'medium' });
+
+	async function load(offset = 0) {
+		try {
+			const page = await fetchEntries(PAGE_SIZE, offset);
+			entries = offset ? [...entries, ...page.entries] : page.entries;
+			total = page.total;
+			loadError = '';
+		} catch (err) {
+			loadError = err instanceof Error ? err.message : 'Could not load the guestbook';
+		} finally {
+			loading = false;
+		}
+	}
+
+	onMount(() => {
+		load();
+	});
+
+	async function submit(event: SubmitEvent) {
+		event.preventDefault();
+		const form = event.currentTarget as HTMLFormElement;
+		const data = new FormData(form);
+		const field = (name: string) => String(data.get(name) ?? '');
+
+		sending = true;
+		notice = null;
+		try {
+			const result = await signGuestbook({
+				name: field('name'),
+				message: field('message'),
+				website: field('website'),
+				url2: field('url2'),
+				turnstileToken: field('cf-turnstile-response') || undefined
+			});
+			if (result.entry) {
+				entries = [result.entry, ...entries];
+				total += 1;
+			}
+			notice = result.pending
+				? { kind: 'ok', text: 'Thanks! Your message is waiting for a quick review.' }
+				: { kind: 'ok', text: 'Thanks for signing!' };
+			form.reset();
+			message = '';
+		} catch (err) {
+			notice = { kind: 'error', text: err instanceof Error ? err.message : 'Could not sign' };
+		} finally {
+			sending = false;
+			(window as { turnstile?: { reset(): void } }).turnstile?.reset();
+		}
+	}
+</script>
+
+<Meta
+	title="Guestbook"
+	description="Sign Clove Twilight's guestbook and leave a message for whoever drops by next."
+/>
+
+<svelte:head>
+	<link rel="preconnect" href={apiBase} crossorigin="" />
+	{#if siteKey}
+		<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
+	{/if}
+</svelte:head>
+
+<section class="hero">
+	<div class="wrap">
+		<p class="eyebrow">Clove Twilight</p>
+		<h1>Guestbook</h1>
+		<p class="subtitle">Say hi, leave a note, or just let me know you stopped by.</p>
+	</div>
+</section>
+
+<section class="guestbook wrap">
+	<form class="gb-form" onsubmit={submit}>
+		<div class="gb-row">
+			<label>
+				<span>Name</span>
+				<input name="name" required maxlength={LIMITS.name} autocomplete="nickname" />
+			</label>
+			<label>
+				<span>Website <em>(optional)</em></span>
+				<input name="website" type="url" maxlength={LIMITS.website} placeholder="https://" />
+			</label>
+		</div>
+		<label>
+			<span>Message</span>
+			<textarea name="message" required maxlength={LIMITS.message} rows="4" bind:value={message}
+			></textarea>
+			<small class="gb-count">{message.length}/{LIMITS.message}</small>
+		</label>
+		<!-- Honeypot: hidden from people, filled in by bots -->
+		<label class="gb-trap" aria-hidden="true">
+			<span>Leave this empty</span>
+			<input name="url2" tabindex="-1" autocomplete="off" />
+		</label>
+		{#if siteKey}
+			<div class="cf-turnstile" data-sitekey={siteKey} data-theme="dark"></div>
+		{/if}
+		<div class="gb-actions">
+			<button type="submit" disabled={sending}>{sending ? 'Signing…' : 'Sign the guestbook'}</button
+			>
+			{#if notice}
+				<p class="gb-notice {notice.kind}" role="status">{notice.text}</p>
+			{/if}
+		</div>
+	</form>
+
+	{#if loading}
+		<p class="gb-empty">Loading messages…</p>
+	{:else if loadError}
+		<p class="gb-empty">{loadError}</p>
+	{:else if entries.length === 0}
+		<p class="gb-empty">No messages yet. Be the first!</p>
+	{:else}
+		<ol class="gb-entries">
+			{#each entries as entry (entry.id)}
+				<li class="gb-entry">
+					<p class="gb-meta">
+						{#if entry.website}
+							<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
+							<a href={entry.website} rel="nofollow ugc noopener" target="_blank">{entry.name}</a>
+						{:else}
+							<strong>{entry.name}</strong>
+						{/if}
+						<time datetime={new Date(entry.ts).toISOString()}>
+							{dateFormat.format(entry.ts)}
+						</time>
+					</p>
+					<p class="gb-message">{entry.message}</p>
+				</li>
+			{/each}
+		</ol>
+		{#if entries.length < total}
+			<button class="gb-more" onclick={() => load(entries.length)}>Load more</button>
+		{/if}
+	{/if}
+</section>
diff --git a/src/routes/music/+page.svelte b/src/routes/music/+page.svelte
index 7a1f0fb..e960fac 100644
--- a/src/routes/music/+page.svelte
+++ b/src/routes/music/+page.svelte
@@ -25,7 +25,7 @@
 		type Track
 	} from '#lib/scripts/music.ts';
 
-	import { discordId } from '#lib';
+	import { discordId, apiBase, lfmApi, lrcLibHosts } from '#lib';
 
 	const SCROLL_KEYS = ['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '];
 
@@ -156,9 +156,9 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://doughmination.uk" crossorigin="" />
-	<link rel="preconnect" href="https://ws.audioscrobbler.com" crossorigin="" />
-	<link rel="preconnect" href="https://lyrics.doughmination.gay" crossorigin="" />
+	<link rel="preconnect" href={apiBase} crossorigin="" />
+	<link rel="preconnect" href={new URL(lfmApi).origin} crossorigin="" />
+	<link rel="preconnect" href={lrcLibHosts[0]} crossorigin="" />
 </svelte:head>
 
 <section class="hero">
diff --git a/src/routes/projects/+page.svelte b/src/routes/projects/+page.svelte
index c4ed5d8..d9be566 100644
--- a/src/routes/projects/+page.svelte
+++ b/src/routes/projects/+page.svelte
@@ -5,6 +5,7 @@
 <script lang="ts">
 	import Meta from '#lib/components/Meta.svelte';
 	import '#lib/styles/projects.css';
+	import { apiBase, authUrl, githubUrl, mediaBase } from '#lib';
 
 	type Project = {
 		title: string;
@@ -18,7 +19,7 @@
 
 	type Group = { heading: string; projects: Project[] };
 
-	const IMG_BASE = 'https://m.doughmination.gay/';
+	const IMG_BASE = mediaBase + '/';
 
 	const GROUPS: Group[] = [
 		{
@@ -27,21 +28,21 @@
 				{
 					title: 'Doughmination Auth',
 					bio: 'A public auth server, which is my auth for all my projects',
-					href: 'https://github.com/doughmination/auth-server',
-					live: 'https://auth.doughmination.gay',
+					href: githubUrl + '/auth-server',
+					live: authUrl,
 					img: 'favicons/favicon.png'
 				},
 				{
 					title: 'Doughmination API',
-					bio: 'My personal API, which I don\'t mind people hooking into',
-					href: 'https://github.com/doughmination/api',
-					live: 'https://doughmination.uk',
+					bio: "My personal API, which I don't mind people hooking into",
+					href: githubUrl + '/api',
+					live: apiBase,
 					img: 'favicons/favicon.png'
 				},
 				{
 					title: 'Doughmination Mail',
 					bio: 'My personal inbox',
-					href: 'https://github.com/doughmination/email',
+					href: githubUrl + '/email',
 					img: 'favicons/favicon.png'
 				}
 			]
@@ -84,7 +85,7 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://m.doughmination.gay" crossorigin="" />
+	<link rel="preconnect" href={mediaBase} crossorigin="" />
 </svelte:head>
 
 <section class="hero">
diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts
index 3e8590b..88a3c27 100644
--- a/src/routes/sitemap.xml/+server.ts
+++ b/src/routes/sitemap.xml/+server.ts
@@ -10,7 +10,7 @@ export const prerender = true;
 // Redirect-only routes (invite, dev-info) have no +page.svelte and are skipped.
 const pages = Object.keys(import.meta.glob('../**/+page.svelte'))
 	.map((file) => file.replace(/^\.\.|\/\+page\.svelte$/g, '') || '/')
-	.filter((path) => !path.includes('['))
+	.filter((path) => !path.includes('[') && !path.startsWith('/admin'))
 	.sort();
 
 export function GET() {
diff --git a/src/routes/stack/+page.svelte b/src/routes/stack/+page.svelte
index 810bee0..66b1aa4 100644
--- a/src/routes/stack/+page.svelte
+++ b/src/routes/stack/+page.svelte
@@ -5,6 +5,7 @@
 <script lang="ts">
 	import Meta from '#lib/components/Meta.svelte';
 	import '#lib/styles/stack.css';
+	import { apiBase } from '#lib';
 	import {
 		SiArchlinux,
 		SiArduino,
@@ -202,7 +203,7 @@
 />
 
 <svelte:head>
-	<link rel="preconnect" href="https://doughmination.uk" crossorigin="" />
+	<link rel="preconnect" href={apiBase} crossorigin="" />
 </svelte:head>
 
 <section class="hero">
diff --git a/static/robots.txt b/static/robots.txt
index b6dd667..4cc3fa2 100644
--- a/static/robots.txt
+++ b/static/robots.txt
@@ -1,3 +1,3 @@
 # allow crawling everything by default
 User-agent: *
-Disallow:
+Disallow: /admin