commit
Better docs
diff --git a/LICENCE.md b/LICENCE.md
index 933c8ac..6bb8c0f 100644
--- a/LICENCE.md
+++ b/LICENCE.md
@@ -1,8 +1,8 @@
# The Estrogen Source-Available Licence
-**Version 2.0**
+**Version 2.1**
-This Licence may be referred to as the **Estrogen Source-Available Licence (ESAL)**. This specific version may be referred to as **ESAL-2.0**.
+This Licence may be referred to as the **Estrogen Source-Available Licence (ESAL)**. This specific version may be referred to as **ESAL-2.1**.
Copyright © 2026 Clove Nytrix Doughmination Twilight.
@@ -76,7 +76,7 @@ If a party is not listed within the official licensing repository or accompanyin
Official licensing records:
-https://git.gay/doughmination/licencing
+https://codeberg.org/clove/licencing
---
diff --git a/src/docs.ts b/src/docs.ts
index 4f2dc32..2056fef 100644
--- a/src/docs.ts
+++ b/src/docs.ts
@@ -190,7 +190,7 @@ export const DOCS_HTML = `<!doctype html>
<header>
<div class="header-text">
<h1>Doughmination API reference</h1>
- <p>Universal API: live Discord presence (Lanyard), Discord profiles, the plural system, and misc services. Base URL: <code>https://doughmination.uk</code></p>
+ <p>Universal API: live Discord presence (Lanyard), Discord profiles, the plural system, and misc services. Base URL: <code>https://doughmination.uk/v2</code></p>
</div>
<button id="navToggle" class="nav-toggle" type="button" aria-expanded="false" aria-controls="nav">
<span aria-hidden="true">☰</span>
@@ -212,41 +212,41 @@ var GROUPS = [
id: "auth-overview", name: "Authentication", blurb: "How protected endpoints are secured.",
endpoints: [
{ m: "GET", path: "Bearer JWT", auth: "jwt",
- desc: "Most /v2/plural write endpoints require a JWT. Obtain one from POST /v2/plural/login, then send it as 'Authorization: Bearer <token>'. Tokens last 24h. Roles: admin, owner, pet gate specific routes.",
+ desc: "Most /plural write endpoints require a JWT. Obtain one from POST /plural/login, then send it as 'Authorization: Bearer <token>'. Tokens last 24h. Roles: admin, owner, pet gate specific routes.",
note: "Passwords are hashed with PBKDF2 (Web Crypto)." },
{ m: "GET", path: "X-Battery-Key", auth: "key",
- desc: "POST /v2/battery requires the 'X-Battery-Key' header matching one of the comma-separated keys in BATTERY_API_KEYS." },
+ desc: "POST /battery requires the 'X-Battery-Key' header matching one of the comma-separated keys in BATTERY_API_KEYS." },
{ m: "GET", path: "Bot token", auth: "bot",
- desc: "The /v2/plural/bot/* endpoints require BOTH 'User-Agent: CloveShortcuts/<version>' and 'Authorization: Bearer <DOUGH_BOT_TOKEN>'." }
+ desc: "The /plural/bot/* endpoints require BOTH 'User-Agent: CloveShortcuts/<version>' and 'Authorization: Bearer <DOUGH_BOT_TOKEN>'." }
]
},
{
id: "lanyard", name: "Lanyard — live presence", blurb: "Real-time Discord presence, backed by the gateway Durable Object.",
endpoints: [
- { m: "GET", path: "/v2/lanyard/users/:id", auth: "public",
+ { m: "GET", path: "/lanyard/users/:id", auth: "public",
desc: "Live presence for one user: status, activities, Spotify, platform (desktop/mobile/web). 404 if the user shares no monitored guild with the bot.",
params: [["id", "Discord user snowflake (16–21 digits)."]] },
- { m: "GET", path: "/v2/lanyard/users?ids=a,b,c", auth: "public",
+ { m: "GET", path: "/lanyard/users?ids=a,b,c", auth: "public",
desc: "Batch presence for up to 100 users in one round-trip. Returns a map of id → presence (or null).",
params: [["ids", "Comma-separated snowflakes, max 100."]] },
- { m: "WS", path: "/v2/lanyard/ws", auth: "public",
+ { m: "WS", path: "/lanyard/ws", auth: "public",
desc: "WebSocket speaking the Lanyard socket protocol (op1 Hello, op2 Initialize, op3 Heartbeat, op0 INIT_STATE / PRESENCE_UPDATE)." },
- { m: "GET", path: "/v2/lanyard/status", auth: "public",
+ { m: "GET", path: "/lanyard/status", auth: "public",
desc: "Gateway health/debug: connected state, tracked user count, last close code, reconnect attempts." }
]
},
{
id: "discord", name: "Discord — profiles & guilds", blurb: "Profile, badges, and guild/role info from Discord.",
endpoints: [
- { m: "GET", path: "/v2/discord/users/:id", auth: "public",
+ { m: "GET", path: "/discord/users/:id", auth: "public",
desc: "Full user record: profile + badges + connected accounts + (when a user token is configured) bio/pronouns/reviews, MERGED with live presence. This is the shape the website's presence cards render.",
params: [["id", "Discord user snowflake."], ["?fresh / ?nocache / ?refresh", "Bypass caches and re-fetch."]] },
- { m: "GET", path: "/v2/discord/users?ids=a,b,c", auth: "public",
+ { m: "GET", path: "/discord/users?ids=a,b,c", auth: "public",
desc: "Batch of the merged record above, up to 100 ids, in one round-trip (one DO call for presence + parallel KV-cached profiles). Map of id → record (or null)." },
- { m: "GET", path: "/v2/discord/guilds/:invite", auth: "public",
+ { m: "GET", path: "/discord/guilds/:invite", auth: "public",
desc: "Public guild info resolved from an invite code: name, icon/banner/splash, member + online counts.",
params: [["invite", "Invite code (the part after discord.gg/)."]] },
- { m: "GET", path: "/v2/discord/girls/:idType/:id", auth: "public",
+ { m: "GET", path: "/discord/girls/:idType/:id", auth: "public",
desc: "Resolve a role or member within the configured 'girls' guild.",
params: [["idType", "'role' or 'member'."], ["id", "Role id or member (user) id."]] }
]
@@ -254,124 +254,124 @@ var GROUPS = [
{
id: "plural-auth", name: "Plural — accounts & auth", blurb: "Login, signup, and the current user.",
endpoints: [
- { m: "POST", path: "/v2/plural/login", auth: "public",
+ { m: "POST", path: "/plural/login", auth: "public",
desc: "Log in. Accepts JSON { username, password, turnstile_token } (Turnstile-verified) or legacy form data. Returns { access_token, token_type, success }.",
example: 'POST body: { "username": "admin", "password": "…", "turnstile_token": "…" } → { "access_token": "…", "token_type": "bearer", "success": true }' },
- { m: "POST", path: "/v2/plural/signup", auth: "public",
+ { m: "POST", path: "/plural/signup", auth: "public",
desc: "Create a non-admin account. Body { username, password (≥10 chars), display_name?, turnstile_token }." },
- { m: "GET", path: "/v2/plural/users/check-username?username=", auth: "public",
+ { m: "GET", path: "/plural/users/check-username?username=", auth: "public",
desc: "Check username availability. Returns { username, exists, available }." },
- { m: "GET", path: "/v2/plural/user_info", auth: "auth",
+ { m: "GET", path: "/plural/user_info", auth: "auth",
desc: "The current authenticated user (no password hash)." },
- { m: "GET", path: "/v2/plural/auth/is_admin", auth: "auth", desc: "{ isAdmin } for the current user." },
- { m: "GET", path: "/v2/plural/auth/is_owner", auth: "auth", desc: "{ isOwner } for the current user." },
- { m: "GET", path: "/v2/plural/auth/is_pet", auth: "auth", desc: "{ isPet } for the current user." }
+ { m: "GET", path: "/plural/auth/is_admin", auth: "auth", desc: "{ isAdmin } for the current user." },
+ { m: "GET", path: "/plural/auth/is_owner", auth: "auth", desc: "{ isOwner } for the current user." },
+ { m: "GET", path: "/plural/auth/is_pet", auth: "auth", desc: "{ isPet } for the current user." }
]
},
{
id: "plural-system", name: "Plural — system & mental state", blurb: "PluralKit system info and the tracked mental state.",
endpoints: [
- { m: "GET", path: "/v2/plural/system", auth: "public",
+ { m: "GET", path: "/plural/system", auth: "public",
desc: "PluralKit system info (name, description, tag) with the current mental_state attached." },
- { m: "GET", path: "/v2/plural/mental-state", auth: "public",
+ { m: "GET", path: "/plural/mental-state", auth: "public",
desc: "Current mental state: { level, updated_at, notes }." },
- { m: "POST", path: "/v2/plural/mental-state", auth: "admin",
- desc: "Update mental state. Body { level, notes? }. Broadcasts a mental_state_update over /v2/plural/ws." }
+ { m: "POST", path: "/plural/mental-state", auth: "admin",
+ desc: "Update mental state. Body { level, notes? }. Broadcasts a mental_state_update over /plural/ws." }
]
},
{
id: "plural-members", name: "Plural — members & tags", blurb: "System members, their tags and custom status.",
endpoints: [
- { m: "GET", path: "/v2/plural/members", auth: "public",
+ { m: "GET", path: "/plural/members", auth: "public",
desc: "All members enriched with tags and custom status." },
- { m: "GET", path: "/v2/plural/member/:member_id", auth: "public",
+ { m: "GET", path: "/plural/member/:member_id", auth: "public",
desc: "One member by id OR name (case-insensitive), enriched with tags + status.",
params: [["member_id", "PluralKit member id or name."]] },
- { m: "GET", path: "/v2/plural/member-tags", auth: "admin", desc: "The full member → tags map." },
- { m: "POST", path: "/v2/plural/member-tags/:member_identifier", auth: "admin",
+ { m: "GET", path: "/plural/member-tags", auth: "admin", desc: "The full member → tags map." },
+ { m: "POST", path: "/plural/member-tags/:member_identifier", auth: "admin",
desc: "Replace a member's tag list. Body: string[] (JSON array of tags)." },
- { m: "POST", path: "/v2/plural/member-tags/:member_identifier/add", auth: "admin",
+ { m: "POST", path: "/plural/member-tags/:member_identifier/add", auth: "admin",
desc: "Add one tag. Body { tag }." },
- { m: "DELETE", path: "/v2/plural/member-tags/:member_identifier/:tag", auth: "admin",
+ { m: "DELETE", path: "/plural/member-tags/:member_identifier/:tag", auth: "admin",
desc: "Remove one tag from a member." },
- { m: "GET", path: "/v2/plural/members/:member_identifier/status", auth: "public",
+ { m: "GET", path: "/plural/members/:member_identifier/status", auth: "public",
desc: "A member's custom status ({ text, emoji, updated_at }) or null." },
- { m: "POST", path: "/v2/plural/members/:member_identifier/status", auth: "admin",
+ { m: "POST", path: "/plural/members/:member_identifier/status", auth: "admin",
desc: "Set/update a member's status. Body { text (≤100 chars), emoji? }." },
- { m: "DELETE", path: "/v2/plural/members/:member_identifier/status", auth: "admin",
+ { m: "DELETE", path: "/plural/members/:member_identifier/status", auth: "admin",
desc: "Clear a member's status." }
]
},
{
id: "plural-fronting", name: "Plural — fronting", blurb: "Who is fronting, and switching.",
endpoints: [
- { m: "GET", path: "/v2/plural/fronters", auth: "public",
+ { m: "GET", path: "/plural/fronters", auth: "public",
desc: "Current fronters, enriched with tags + status. { members: [...] }." },
- { m: "POST", path: "/v2/plural/switch", auth: "auth",
+ { m: "POST", path: "/plural/switch", auth: "auth",
desc: "Set the front to a list. Body { members: string[] }. Broadcasts fronters_update." },
- { m: "POST", path: "/v2/plural/switch_front", auth: "auth",
+ { m: "POST", path: "/plural/switch_front", auth: "auth",
desc: "Switch to a single fronter. Body { member_id }." },
- { m: "POST", path: "/v2/plural/multi_switch", auth: "auth",
+ { m: "POST", path: "/plural/multi_switch", auth: "auth",
desc: "Switch to several fronters with detailed feedback. Body { member_ids: string[] }." }
]
},
{
id: "plural-users", name: "Plural — user management", blurb: "Admin CRUD over accounts.",
endpoints: [
- { m: "GET", path: "/v2/plural/users", auth: "admin", desc: "List all users (no password hashes)." },
- { m: "POST", path: "/v2/plural/users", auth: "admin",
+ { m: "GET", path: "/plural/users", auth: "admin", desc: "List all users (no password hashes)." },
+ { m: "POST", path: "/plural/users", auth: "admin",
desc: "Create a user. Body { username, password, display_name?, is_admin?, is_pet? }." },
- { m: "PUT", path: "/v2/plural/users/:user_id", auth: "auth",
+ { m: "PUT", path: "/plural/users/:user_id", auth: "auth",
desc: "Update a user (admin, or the user themselves). Body may include display_name, current_password + new_password, avatar_url (an EXTERNAL image URL — uploads were removed), is_admin, is_pet." },
- { m: "DELETE", path: "/v2/plural/users/:user_id", auth: "admin",
+ { m: "DELETE", path: "/plural/users/:user_id", auth: "admin",
desc: "Delete a user. Cannot delete yourself or the owner." }
]
},
{
id: "plural-metrics", name: "Plural — metrics", blurb: "Fronting analytics.",
endpoints: [
- { m: "GET", path: "/v2/plural/metrics/fronting-time?days=30", auth: "auth",
+ { m: "GET", path: "/plural/metrics/fronting-time?days=30", auth: "auth",
desc: "Per-member fronting time across 24h/48h/5d/7d/30d windows and totals." },
- { m: "GET", path: "/v2/plural/metrics/switch-frequency?days=30", auth: "auth",
+ { m: "GET", path: "/plural/metrics/switch-frequency?days=30", auth: "auth",
desc: "Switch counts per window and average switches/day." }
]
},
{
id: "plural-realtime", name: "Plural — realtime & admin", blurb: "WebSocket + broadcast controls.",
endpoints: [
- { m: "WS", path: "/v2/plural/ws", auth: "public",
+ { m: "WS", path: "/plural/ws", auth: "public",
desc: "Realtime socket. On connect emits connection_established; pushes fronters_update, mental_state_update, and force_refresh. Send 'ping' → 'pong', or 'subscribe'.",
note: "Hibernatable — idle sockets don't keep the Durable Object awake." },
- { m: "POST", path: "/v2/plural/admin/refresh", auth: "admin",
- desc: "Broadcast a force_refresh to every connected /v2/plural/ws client." }
+ { m: "POST", path: "/plural/admin/refresh", auth: "admin",
+ desc: "Broadcast a force_refresh to every connected /plural/ws client." }
]
},
{
id: "plural-bot", name: "Plural — bot API", blurb: "For the Discord bot (User-Agent + bot token).",
endpoints: [
- { m: "GET", path: "/v2/plural/bot/health", auth: "bot", desc: "Liveness check." },
- { m: "GET", path: "/v2/plural/bot/system/info", auth: "bot", desc: "System info wrapped as { success, data }." },
- { m: "GET", path: "/v2/plural/bot/members", auth: "bot", desc: "Members with tags + status." },
- { m: "GET", path: "/v2/plural/bot/fronters", auth: "bot", desc: "Current fronters." },
- { m: "POST", path: "/v2/plural/bot/switch", auth: "bot",
+ { m: "GET", path: "/plural/bot/health", auth: "bot", desc: "Liveness check." },
+ { m: "GET", path: "/plural/bot/system/info", auth: "bot", desc: "System info wrapped as { success, data }." },
+ { m: "GET", path: "/plural/bot/members", auth: "bot", desc: "Members with tags + status." },
+ { m: "GET", path: "/plural/bot/fronters", auth: "bot", desc: "Current fronters." },
+ { m: "POST", path: "/plural/bot/switch", auth: "bot",
desc: "Switch fronters with validation. Body { member_ids: string[] }." },
- { m: "POST", path: "/v2/plural/bot/token/regenerate", auth: "owner",
+ { m: "POST", path: "/plural/bot/token/regenerate", auth: "owner",
desc: "Gone — returns 410. The bot token is now set manually via the DOUGH_BOT_TOKEN secret." }
]
},
{
id: "plural-seo", name: "Plural — SEO", blurb: "Data-driven crawler files.",
endpoints: [
- { m: "GET", path: "/v2/plural/robots.txt", auth: "public", desc: "robots.txt." },
- { m: "GET", path: "/v2/plural/sitemap.xml", auth: "public", desc: "Sitemap generated from the member list." }
+ { m: "GET", path: "/plural/robots.txt", auth: "public", desc: "robots.txt." },
+ { m: "GET", path: "/plural/sitemap.xml", auth: "public", desc: "Sitemap generated from the member list." }
]
},
{
id: "battery", name: "Battery", blurb: "Latest known battery level per device.",
endpoints: [
- { m: "GET", path: "/v2/battery", auth: "public", desc: "All devices → { device, level, updated_at }." },
- { m: "GET", path: "/v2/battery/:device", auth: "public", desc: "One device, or 404." },
- { m: "POST", path: "/v2/battery?device=iphone&level=25", auth: "key",
+ { m: "GET", path: "/battery", auth: "public", desc: "All devices → { device, level, updated_at }." },
+ { m: "GET", path: "/battery/:device", auth: "public", desc: "One device, or 404." },
+ { m: "POST", path: "/battery?device=iphone&level=25", auth: "key",
desc: "Report a level (0–100) for a device. Send the X-Battery-Key header.",
params: [["device", "1–64 chars."], ["level", "Integer 0–100."]] }
]
@@ -379,22 +379,22 @@ var GROUPS = [
{
id: "system-data", name: "System-data — visitor logs", blurb: "Visit logging + an admin log viewer (DO SQLite).",
endpoints: [
- { m: "POST", path: "/v2/system-data/helper", auth: "public",
+ { m: "POST", path: "/system-data/helper", auth: "public",
desc: "Log a page visit (the frontend pings this on navigation). Body { path? }." },
- { m: "GET", path: "/v2/system-data/helper?path=", auth: "public", desc: "GET variant (sendBeacon / no-CORS)." },
- { m: "GET", path: "/v2/system-data", auth: "admin", desc: "HTML log viewer (single page)." },
- { m: "GET", path: "/v2/system-data/api/stats", auth: "admin", desc: "Totals, unique IPs, last-24h, top paths." },
- { m: "GET", path: "/v2/system-data/api/recent?limit=100", auth: "admin", desc: "Recent visits." },
- { m: "GET", path: "/v2/system-data/api/by-ip/:ip", auth: "admin", desc: "Visits from an IP." },
- { m: "GET", path: "/v2/system-data/api/by-path?q=", auth: "admin", desc: "Visits matching a path substring." },
- { m: "GET", path: "/v2/system-data/api/suspicious", auth: "admin", desc: ">20 hits/hour from one IP." },
- { m: "GET", path: "/v2/system-data/api/entry/:id", auth: "admin", desc: "One full log row." }
+ { m: "GET", path: "/system-data/helper?path=", auth: "public", desc: "GET variant (sendBeacon / no-CORS)." },
+ { m: "GET", path: "/system-data", auth: "admin", desc: "HTML log viewer (single page)." },
+ { m: "GET", path: "/system-data/api/stats", auth: "admin", desc: "Totals, unique IPs, last-24h, top paths." },
+ { m: "GET", path: "/system-data/api/recent?limit=100", auth: "admin", desc: "Recent visits." },
+ { m: "GET", path: "/system-data/api/by-ip/:ip", auth: "admin", desc: "Visits from an IP." },
+ { m: "GET", path: "/system-data/api/by-path?q=", auth: "admin", desc: "Visits matching a path substring." },
+ { m: "GET", path: "/system-data/api/suspicious", auth: "admin", desc: ">20 hits/hour from one IP." },
+ { m: "GET", path: "/system-data/api/entry/:id", auth: "admin", desc: "One full log row." }
]
},
{
id: "contrib", name: "Contrib", blurb: "Merged git contribution heatmaps.",
endpoints: [
- { m: "GET", path: "/v2/contribapi", auth: "public",
+ { m: "GET", path: "/contribapi", auth: "public",
desc: "Merged contribution heatmaps across configured forges (GitHub + Codeberg). Edge-cached for one hour.",
note: "Configured via GITHUB_USERNAME/GITHUB_TOKEN and CODEBERG_USERNAME." }
]
diff --git a/src/index.ts b/src/index.ts
index b374b8a..1c644ed 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -155,31 +155,9 @@ export default {
data: {
service: "Doughmination API",
description: "Universal API: live Discord presence + profiles + plural system.",
- licence: "ESAL-2.0",
+ licence: "ESAL-2.1",
repository_url: "https://github.com/doughmination/restful",
docs: "/docs",
- namespaces: {
- lanyard: [
- "/v2/lanyard/users/:id (presence)",
- "/v2/lanyard/users?ids=a,b,c (batch presence, up to 100)",
- "/v2/lanyard/ws (realtime socket)",
- "/v2/lanyard/status (gateway health)",
- ],
- discord: [
- "/v2/discord/users/:id (profile + badges + live presence)",
- "/v2/discord/users?ids=a,b,c (batch, up to 100)",
- "/v2/discord/guilds/:invite",
- "/v2/discord/girls/:idType/:id (idType: role | member)",
- ],
- plural: [
- "/v2/plural/system, /v2/plural/members, /v2/plural/fronters, ...",
- "/v2/plural/ws (realtime socket)",
- ],
- contrib: [
- "/v2/contribapi (merged git contribution heatmaps)",
- ],
- misc: ["/v2/battery, /v2/battery/:device", "/v2/system-data (visitor logs)"],
- },
},
} as never);
}