commit
Minecraft endpoints and better docs lol
diff --git a/.dev.vars.example b/.dev.vars.example
index a20c472..e9ea8d6 100644
--- a/.dev.vars.example
+++ b/.dev.vars.example
@@ -54,3 +54,10 @@ CODEBERG_USERNAME=
# contribution calendar. https://github.com/settings/personal-access-tokens
GITHUB_USERNAME=
GITHUB_TOKEN=
+
+# ---- minecraft (/v2/minecraft/:uuid) ---------------------------------------
+# Hypixel API key, sent as the `API-Key` header. Generate one at
+# https://developer.hypixel.net/. Leave blank to disable /minecraft/hypixel
+# (its sections return null with source "unavailable"); /minecraft/general
+# (Mojang profile + skin) needs no key and always works.
+HYPIXEL_API_KEY=
diff --git a/src/docs.ts b/src/docs.ts
index 2056fef..3924a75 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/v2</code></p>
+ <p>Universal API: live Discord presence (Lanyard), Discord profiles, Minecraft skins & Hypixel stats, 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,50 +212,63 @@ var GROUPS = [
id: "auth-overview", name: "Authentication", blurb: "How protected endpoints are secured.",
endpoints: [
{ m: "GET", path: "Bearer JWT", auth: "jwt",
- 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)." },
+ desc: "Most /plural write endpoints need a login token. Get one from POST /plural/login, then send it as 'Authorization: Bearer <token>'. Tokens last 24 hours. Some routes additionally require an admin, owner, or pet role." },
{ m: "GET", path: "X-Battery-Key", auth: "key",
- desc: "POST /battery requires the 'X-Battery-Key' header matching one of the comma-separated keys in BATTERY_API_KEYS." },
+ desc: "Reporting a battery level (POST /battery) needs your device key, sent as the 'X-Battery-Key' header." },
{ m: "GET", path: "Bot token", auth: "bot",
- desc: "The /plural/bot/* endpoints require BOTH 'User-Agent: CloveShortcuts/<version>' and 'Authorization: Bearer <DOUGH_BOT_TOKEN>'." }
+ desc: "The /plural/bot/* endpoints are for the companion Discord bot: they need both a 'User-Agent: CloveShortcuts/<version>' header and the bot's token as 'Authorization: Bearer <token>'." }
]
},
{
- id: "lanyard", name: "Lanyard — live presence", blurb: "Real-time Discord presence, backed by the gateway Durable Object.",
+ id: "lanyard", name: "Lanyard — live presence", blurb: "Real-time Discord presence.",
endpoints: [
{ 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)."]] },
+ desc: "A user's live presence: online status, current activities, Spotify, and which platforms they're on (desktop/mobile/web). Returns 404 if the user doesn't share a tracked server with the bot.",
+ params: [["id", "Discord user ID."]] },
{ 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."]] },
+ desc: "Live presence for up to 100 users at once. Returns a map of user ID → presence (or null).",
+ params: [["ids", "Comma-separated Discord user IDs, max 100."]] },
{ 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: "/lanyard/status", auth: "public",
- desc: "Gateway health/debug: connected state, tracked user count, last close code, reconnect attempts." }
+ desc: "Live-presence connection health: whether it's connected, how many users are tracked, and recent reconnect activity." }
]
},
{
id: "discord", name: "Discord — profiles & guilds", blurb: "Profile, badges, and guild/role info from Discord.",
endpoints: [
{ 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."]] },
+ desc: "A user's full profile — avatar, banner, badges, connected accounts, and (when available) bio, pronouns and reviews — combined with their live presence.",
+ params: [["id", "Discord user ID."], ["?fresh / ?nocache / ?refresh", "Skip the cache and fetch fresh."]] },
{ 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)." },
+ desc: "The same full profile for up to 100 users at once. Returns a map of user ID → profile (or null if not found).",
+ params: [["ids", "Comma-separated Discord user IDs, max 100."]] },
{ 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: "/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."]] }
+ desc: "Look up a role or a member inside the 'girls' server.",
+ params: [["idType", "'role' or 'member'."], ["id", "The role ID or member (user) ID."]] }
+ ]
+ },
+ {
+ id: "minecraft", name: "Minecraft", blurb: "Skins and Hypixel stats for a Minecraft account.",
+ endpoints: [
+ { m: "GET", path: "/minecraft/general/:uuid", auth: "public",
+ desc: "A player's Mojang identity: username, UUID (both dashed and short forms), skin and cape texture URLs, the skin's arm model (classic or slim), and ready-to-embed avatar / head / body render images. Returns 404 if no Minecraft account has that UUID.",
+ params: [["uuid", "Minecraft UUID — 32 hex characters, dashes optional."], ["?fresh / ?nocache / ?refresh", "Skip the cache and fetch fresh."]],
+ example: 'GET /minecraft/general/853c80ef3c3749fdaa49938b674adae6 → { name, uuid, skin_url, cape_url, skin_model, render: { avatar, head, body } }' },
+ { m: "GET", path: "/minecraft/hypixel/:uuid", auth: "public",
+ desc: "A player's Hypixel stats: the full player object (network level and every game's stats — Bedwars, SkyWars, Duels, and the rest) plus their SkyBlock profiles. Always returns 200; the 'source' field tells you whether each section loaded ('ok') or why it's null — 'not_found' if the player has never joined Hypixel, 'unavailable' if this server isn't serving Hypixel data.",
+ params: [["uuid", "Minecraft UUID — 32 hex characters, dashes optional."], ["?fresh / ?nocache / ?refresh", "Skip the cache and fetch fresh."]],
+ example: 'GET /minecraft/hypixel/853c80ef3c3749fdaa49938b674adae6 → { name, player: {…}, skyblock: [{…}], source: { player: "ok", skyblock: "ok" } }' }
]
},
{
id: "plural-auth", name: "Plural — accounts & auth", blurb: "Login, signup, and the current user.",
endpoints: [
{ 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 }.",
+ desc: "Log in with your username and password (plus a Turnstile captcha token). Returns an access token to use on protected endpoints.",
example: 'POST body: { "username": "admin", "password": "…", "turnstile_token": "…" } → { "access_token": "…", "token_type": "bearer", "success": true }' },
{ m: "POST", path: "/plural/signup", auth: "public",
desc: "Create a non-admin account. Body { username, password (≥10 chars), display_name?, turnstile_token }." },
@@ -340,8 +353,7 @@ var GROUPS = [
id: "plural-realtime", name: "Plural — realtime & admin", blurb: "WebSocket + broadcast controls.",
endpoints: [
{ 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." },
+ desc: "Realtime updates over WebSocket. On connect you get a connection_established message, then live fronters_update, mental_state_update, and force_refresh events as they happen. Send 'ping' to get 'pong'." },
{ m: "POST", path: "/plural/admin/refresh", auth: "admin",
desc: "Broadcast a force_refresh to every connected /plural/ws client." }
]
@@ -356,7 +368,7 @@ var GROUPS = [
{ m: "POST", path: "/plural/bot/switch", auth: "bot",
desc: "Switch fronters with validation. Body { member_ids: string[] }." },
{ 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." }
+ desc: "No longer available — returns 410. The bot token is now set manually by the server operator." }
]
},
{
@@ -377,11 +389,11 @@ var GROUPS = [
]
},
{
- id: "system-data", name: "System-data — visitor logs", blurb: "Visit logging + an admin log viewer (DO SQLite).",
+ id: "system-data", name: "System-data — visitor logs", blurb: "Visit logging plus an admin-only log viewer.",
endpoints: [
{ m: "POST", path: "/system-data/helper", auth: "public",
desc: "Log a page visit (the frontend pings this on navigation). Body { path? }." },
- { m: "GET", path: "/system-data/helper?path=", auth: "public", desc: "GET variant (sendBeacon / no-CORS)." },
+ { m: "GET", path: "/system-data/helper?path=", auth: "public", desc: "Log a page visit via a plain GET, for cases where a POST isn't convenient." },
{ 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." },
@@ -395,8 +407,7 @@ var GROUPS = [
id: "contrib", name: "Contrib", blurb: "Merged git contribution heatmaps.",
endpoints: [
{ 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." }
+ desc: "A single contribution heatmap that merges activity from GitHub and Codeberg. Updated at most hourly." }
]
},
{
diff --git a/src/index.ts b/src/index.ts
index 1c644ed..7bf351b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -21,11 +21,14 @@ import type {
UnifiedGuildInvite,
UnifiedGirlsRole,
UnifiedGirlsMember,
+ UnifiedMinecraftGeneral,
+ UnifiedMinecraftHypixel,
} from "./types";
import { getProfile } from "./profile";
import { GatewayManager } from "./gateway";
import { getGuildInvite } from "./guild";
import { getGirlsResource, isGirlsIdType } from "./girls";
+import { getMinecraftGeneral, getMinecraftHypixel, isMinecraftUuid } from "./minecraft";
import { getContributions } from "./contribapi";
import { DOCS_HTML } from "./docs";
import { SystemState } from "./system/do";
@@ -118,6 +121,16 @@ function wantsForce(url: URL): boolean {
export default {
async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const url = new URL(req.url);
+
+ // ---- Enforce HTTPS ---------------------------------------------------
+ // Anything arriving over plain http is 301-redirected to the https URL
+ // before any routing runs. Cloudflare terminates TLS, so the original
+ // client scheme is read from the URL, x-forwarded-proto, or cf-visitor.
+ if (isInsecure(req, url)) {
+ url.protocol = "https:";
+ return Response.redirect(url.toString(), 301);
+ }
+
const path = url.pathname.replace(/\/+$/, "") || "/";
// ---- SystemState DO (plural / battery / system-data) -----------------
@@ -220,6 +233,41 @@ export default {
}
}
+ // ---- /v2/minecraft/general/:uuid (Mojang profile + skin) ------------
+ // Just Mojang identity + skin/cape, so callers that only want a skin
+ // don't trigger the Hypixel round-trips.
+ const mcg = path.match(/^\/v2\/minecraft\/general\/([0-9a-fA-F-]{32,36})$/);
+ if (mcg) {
+ const uuid = mcg[1];
+ if (!isMinecraftUuid(uuid)) {
+ return json(
+ { success: false, error: { code: "invalid_uuid", message: "Not a Minecraft UUID (32 hex chars, dashes optional)." } },
+ 400,
+ );
+ }
+ const data = await getMinecraftGeneral(env, uuid, ctx, wantsForce(url));
+ if (!data) {
+ return json({ success: false, error: { code: "not_found", message: "No Minecraft account with that UUID." } }, 404);
+ }
+ return json<UnifiedMinecraftGeneral>({ success: true, data });
+ }
+
+ // ---- /v2/minecraft/hypixel/:uuid (raw Hypixel + SkyBlock) -----------
+ // Only fetched when asked for. Returns 200 even when the player never
+ // joined Hypixel — `source` says why each section is null.
+ const mch = path.match(/^\/v2\/minecraft\/hypixel\/([0-9a-fA-F-]{32,36})$/);
+ if (mch) {
+ const uuid = mch[1];
+ if (!isMinecraftUuid(uuid)) {
+ return json(
+ { success: false, error: { code: "invalid_uuid", message: "Not a Minecraft UUID (32 hex chars, dashes optional)." } },
+ 400,
+ );
+ }
+ const data = await getMinecraftHypixel(env, uuid, ctx, wantsForce(url));
+ return json<UnifiedMinecraftHypixel>({ success: true, data });
+ }
+
// ---- /v2/lanyard/users (batch presence) -----------------------------
if (path === "/v2/lanyard/users") {
const ids = parseIds(url);
@@ -302,6 +350,18 @@ export default {
},
};
+/** True when the request reached us over plain http (so we should redirect to
+ * https). Cloudflare terminates TLS, so we check the URL scheme plus the
+ * proxy headers that carry the original client scheme. */
+function isInsecure(req: Request, url: URL): boolean {
+ if (url.protocol === "http:") return true;
+ const xfProto = req.headers.get("x-forwarded-proto");
+ if (xfProto && xfProto.split(",")[0].trim().toLowerCase() === "http") return true;
+ const visitor = req.headers.get("cf-visitor");
+ if (visitor && /"scheme"\s*:\s*"http"/i.test(visitor)) return true;
+ return false;
+}
+
function parseIds(url: URL): string[] {
return Array.from(
new Set(
diff --git a/src/minecraft.ts b/src/minecraft.ts
new file mode 100644
index 0000000..d8aedec
--- /dev/null
+++ b/src/minecraft.ts
@@ -0,0 +1,187 @@
+/* =====================================================================
+ * minecraft.ts — resolve a Minecraft UUID -> profile / Hypixel stats.
+ *
+ * Split into two endpoints so callers only pay for what they use:
+ * /v2/minecraft/general/:uuid -> Mojang name + skin/cape textures.
+ * /v2/minecraft/hypixel/:uuid -> raw Hypixel player + SkyBlock profiles.
+ *
+ * Hypixel needs an API key (HYPIXEL_API_KEY, sent as the `API-Key` header);
+ * without it the Hypixel sections come back null with source "unavailable".
+ * Both endpoints are cache-first (~5 min) since the upstreams drift slowly
+ * and would rather not be hammered.
+ * ===================================================================== */
+
+import type {
+ Env,
+ MinecraftSourceState,
+ UnifiedMinecraftGeneral,
+ UnifiedMinecraftHypixel,
+} from "./types";
+
+const MOJANG_PROFILE = "https://sessionserver.mojang.com/session/minecraft/profile";
+const HYPIXEL_BASE = "https://api.hypixel.net/v2";
+const CRAFTHEAD = "https://crafthead.net";
+const TTL_SECONDS = 300;
+
+/** Strip dashes and lowercase — the form Mojang/Hypixel expect in URLs. */
+function undash(uuid: string): string {
+ return uuid.replace(/-/g, "").toLowerCase();
+}
+
+/** Insert dashes into a 32-char hex uuid -> canonical 8-4-4-4-12 form. */
+function dash(short: string): string {
+ return `${short.slice(0, 8)}-${short.slice(8, 12)}-${short.slice(12, 16)}-${short.slice(16, 20)}-${short.slice(20)}`;
+}
+
+/** True for a 32-hex-char uuid with or without dashes. */
+export function isMinecraftUuid(uuid: string): boolean {
+ return /^[0-9a-fA-F]{32}$/.test(undash(uuid));
+}
+
+const generalKey = (short: string) => `minecraft:general:${short}`;
+const hypixelKey = (short: string) => `minecraft:hypixel:${short}`;
+
+interface MojangTexturePayload {
+ textures?: {
+ SKIN?: { url?: string; metadata?: { model?: string } };
+ CAPE?: { url?: string };
+ };
+}
+
+interface MojangProfileResponse {
+ id: string;
+ name: string;
+ properties?: Array<{ name: string; value: string }>;
+}
+
+/** Fetch a Hypixel v2 endpoint and unwrap { success, <key> }.
+ * Returns [value, state] where state explains a null value. */
+async function fetchHypixel<T>(
+ env: Env,
+ path: string,
+ key: string,
+): Promise<[T | null, MinecraftSourceState]> {
+ const apiKey = env.HYPIXEL_API_KEY;
+ if (!apiKey) return [null, "unavailable"];
+ try {
+ const res = await fetch(`${HYPIXEL_BASE}${path}`, {
+ headers: { "API-Key": apiKey, Accept: "application/json" },
+ });
+ if (!res.ok) return [null, "error"];
+ const body = (await res.json()) as Record<string, unknown> & { success?: boolean };
+ if (!body.success) return [null, "error"];
+ const value = body[key] as T | null | undefined;
+ // Hypixel returns success:true with player:null for accounts that never
+ // logged in — treat that as not_found rather than an error.
+ if (value === null || value === undefined) return [null, "not_found"];
+ return [value, "ok"];
+ } catch {
+ return [null, "error"];
+ }
+}
+
+/**
+ * Mojang identity + skin/cape for a UUID. Cache-first (~5 min). Returns null
+ * only when the UUID doesn't map to a Mojang account (so the caller can 404).
+ */
+export async function getMinecraftGeneral(
+ env: Env,
+ uuid: string,
+ ctx?: ExecutionContext,
+ force = false,
+): Promise<UnifiedMinecraftGeneral | null> {
+ const short = undash(uuid);
+
+ if (!force) {
+ const cached = (await env.PROFILE_CACHE.get(generalKey(short), "json")) as UnifiedMinecraftGeneral | null;
+ if (cached) return cached;
+ }
+
+ let name: string | null = null;
+ let skin_url: string | null = null;
+ let cape_url: string | null = null;
+ let skin_model: "classic" | "slim" | null = null;
+ try {
+ const res = await fetch(`${MOJANG_PROFILE}/${short}`, { headers: { Accept: "application/json" } });
+ if (!res.ok) return null;
+ const data = (await res.json()) as MojangProfileResponse;
+ name = data.name ?? null;
+ const texturesB64 = data.properties?.find((p) => p.name === "textures")?.value;
+ if (texturesB64) {
+ try {
+ const decoded = JSON.parse(atob(texturesB64)) as MojangTexturePayload;
+ skin_url = decoded.textures?.SKIN?.url ?? null;
+ cape_url = decoded.textures?.CAPE?.url ?? null;
+ if (skin_url) skin_model = decoded.textures?.SKIN?.metadata?.model === "slim" ? "slim" : "classic";
+ } catch {
+ /* malformed texture blob — leave nulls */
+ }
+ }
+ } catch {
+ return null;
+ }
+
+ const result: UnifiedMinecraftGeneral = {
+ uuid: dash(short),
+ uuid_short: short,
+ name,
+ skin_url,
+ skin_model,
+ cape_url,
+ render: {
+ avatar: `${CRAFTHEAD}/avatar/${short}`,
+ head: `${CRAFTHEAD}/head/${short}`,
+ body: `${CRAFTHEAD}/body/${short}`,
+ },
+ updated_at: Date.now(),
+ };
+
+ const write = env.PROFILE_CACHE.put(generalKey(short), JSON.stringify(result), {
+ expirationTtl: TTL_SECONDS,
+ });
+ if (ctx) ctx.waitUntil(write);
+ else await write;
+
+ return result;
+}
+
+/**
+ * Raw Hypixel player object + SkyBlock profiles for a UUID. Cache-first
+ * (~5 min). Never returns null: Hypixel gaps degrade gracefully via `source`
+ * (unavailable / not_found / error), so the caller gets a 200 either way.
+ */
+export async function getMinecraftHypixel(
+ env: Env,
+ uuid: string,
+ ctx?: ExecutionContext,
+ force = false,
+): Promise<UnifiedMinecraftHypixel> {
+ const short = undash(uuid);
+
+ if (!force) {
+ const cached = (await env.PROFILE_CACHE.get(hypixelKey(short), "json")) as UnifiedMinecraftHypixel | null;
+ if (cached) return cached;
+ }
+
+ const [[player, playerState], [skyblock, skyblockState]] = await Promise.all([
+ fetchHypixel<Record<string, unknown>>(env, `/player?uuid=${short}`, "player"),
+ fetchHypixel<unknown[]>(env, `/skyblock/profiles?uuid=${short}`, "profiles"),
+ ]);
+
+ const result: UnifiedMinecraftHypixel = {
+ uuid: dash(short),
+ name: (player?.displayname as string | undefined) ?? null,
+ player,
+ skyblock,
+ updated_at: Date.now(),
+ source: { player: playerState, skyblock: skyblockState },
+ };
+
+ const write = env.PROFILE_CACHE.put(hypixelKey(short), JSON.stringify(result), {
+ expirationTtl: TTL_SECONDS,
+ });
+ if (ctx) ctx.waitUntil(write);
+ else await write;
+
+ return result;
+}
diff --git a/src/types.ts b/src/types.ts
index 5c807e6..bc24915 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -68,6 +68,12 @@ export interface Env {
GITHUB_TOKEN?: string;
/** Codeberg/Forgejo username whose heatmap is fetched (no token needed). */
CODEBERG_USERNAME?: string;
+
+ // ---- minecraft (/v2/minecraft/:uuid) -----------------------------------
+ /** Hypixel API key (sent as the `API-Key` header). When unset,
+ * /v2/minecraft/general (Mojang profile + skin) still works, and
+ * /v2/minecraft/hypixel returns null sections with source "unavailable". */
+ HYPIXEL_API_KEY?: string;
}
export type DiscordStatus = "online" | "idle" | "dnd" | "offline";
@@ -416,6 +422,47 @@ export interface UnifiedGirlsMember {
communication_disabled_until: string | null;
}
+/** Mojang identity + skin/cape for a Minecraft account
+ * (/v2/minecraft/general/:uuid). */
+export interface UnifiedMinecraftGeneral {
+ /** Dashed UUID (canonical form). */
+ uuid: string;
+ /** Undashed UUID (as Mojang/Hypixel return it). */
+ uuid_short: string;
+ name: string | null;
+ /** Raw skin texture file URL (textures.minecraft.net); null if none. */
+ skin_url: string | null;
+ /** "classic" (Steve) or "slim" (Alex) arm model; null if unknown. */
+ skin_model: "classic" | "slim" | null;
+ /** Raw cape texture file URL; null if the account has no cape. */
+ cape_url: string | null;
+ /** Ready-to-embed render URLs from the public crafthead.net proxy. */
+ render: { avatar: string; head: string; body: string };
+ updated_at: number;
+}
+
+/** Hypixel stats for a Minecraft account (/v2/minecraft/hypixel/:uuid).
+ * `player`/`skyblock` are the raw upstream objects, passed through as-is. */
+export interface UnifiedMinecraftHypixel {
+ uuid: string;
+ /** Hypixel display name, when the player object provides one. */
+ name: string | null;
+ /** Raw Hypixel `player` object; null when unavailable (see source.player). */
+ player: Record<string, unknown> | null;
+ /** Raw Hypixel SkyBlock `profiles` array; null when unavailable. */
+ skyblock: unknown[] | null;
+ updated_at: number;
+ source: {
+ player: MinecraftSourceState;
+ skyblock: MinecraftSourceState;
+ };
+}
+
+/** Why a Hypixel section is (or isn't) present.
+ * ok = loaded, unavailable = Hypixel not configured on this deployment,
+ * not_found = the player has never joined Hypixel, error = upstream failure. */
+export type MinecraftSourceState = "ok" | "unavailable" | "not_found" | "error";
+
export interface ApiEnvelope<T> {
success: boolean;
data?: T;