commit
Updates
diff --git a/src/apidata.ts b/src/apidata.ts
index 1577a43..8c21f4b 100644
--- a/src/apidata.ts
+++ b/src/apidata.ts
@@ -72,8 +72,8 @@ export const GROUPS: GroupDef[] = [
params: [],
example: 'GET /minecraft/capes → { count, capes: [ { source: "minecraft", cape_url } ] }' },
{ 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."]],
+ desc: "Hypixel stats for one of the operator's OWN Minecraft accounts: the player object (network level and per-game stats — Bedwars, SkyWars, Duels, and the rest) plus their SkyBlock profiles. Per Hypixel API policy this only serves the operator's allowlisted accounts — any other UUID returns 403. Cache-first with a 5-minute TTL (no manual cache-bypass). Always returns 200 for an allowed account; the 'source' field says whether each section loaded ('ok') or why it's null ('not_found' if the account never joined Hypixel, 'unavailable' if Hypixel data isn't configured). Not affiliated with or endorsed by Hypixel Inc.",
+ params: [["uuid", "Minecraft UUID (32 hex, dashes optional) — must be one of the operator's own accounts."]],
example: 'GET /minecraft/hypixel/853c80ef3c3749fdaa49938b674adae6 → { name, player: {…}, skyblock: [{…}], source: { player: "ok", skyblock: "ok" } }' },
],
},
diff --git a/src/docs.ts b/src/docs.ts
index cb7bfde..4332f92 100644
--- a/src/docs.ts
+++ b/src/docs.ts
@@ -72,6 +72,7 @@ export const DOCS_HTML = `<!doctype html>
h1 { margin: 0 0 4px; font-size: 21px; color: var(--fg); }
h1 .accent-dot { color: var(--accent); }
header p { margin: 0; color: var(--subtext0); font-size: 13.5px; }
+ header p.disclaimer { margin: 6px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }
header code { color: var(--pink); background: var(--surface0); border: 1px solid var(--line); word-break: break-all; }
.nav-toggle {
@@ -198,6 +199,7 @@ export const DOCS_HTML = `<!doctype html>
<div class="header-text">
<h1>Doughmination API reference</h1>
<p>Universal API: live Discord presence, Discord profiles, Minecraft skins & Hypixel stats, the plural system, and misc services. Base URL: <code>https://doughmination.uk/v2</code> · <a class="self" href="/openapi.json">OpenAPI spec</a> · <a class="self" href="/abuse">Abuse</a> · <a class="self" href="/terms">Terms</a> · <a class="self" href="/privacy">Privacy</a></p>
+ <p class="disclaimer">Not affiliated with, endorsed by, or associated with Hypixel Inc. or Mojang/Microsoft. Hypixel stats are provided via the Hypixel Public API for the operator's own accounts only.</p>
</div>
<button id="navToggle" class="nav-toggle" type="button" aria-expanded="false" aria-controls="nav">
<span aria-hidden="true">☰</span>
diff --git a/src/index.ts b/src/index.ts
index 8faa8f4..6b41d7a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -37,7 +37,7 @@ import { getProfile } from "./profile";
import { GatewayManager } from "./gateway";
import { getGuildInvite } from "./guild";
import { getGirlsResource, isGirlsIdType } from "./girls";
-import { getMinecraftGeneral, getMinecraftHypixel, getVanillaCapeList, normalizeMcUuid, MojangUpstreamError } from "./minecraft";
+import { getMinecraftGeneral, getMinecraftHypixel, getVanillaCapeList, normalizeMcUuid, isAllowedHypixelUuid, MojangUpstreamError } from "./minecraft";
import { getContributions } from "./contribapi";
import { DOCS_HTML } from "./docs";
import { ABUSE_HTML, ABUSE_CONTACT, securityTxt } from "./abuse";
@@ -362,9 +362,16 @@ export default {
}
}
- // ---- /v2/minecraft/hypixel/:uuid (raw Hypixel + SkyBlock) -----------
+ // ---- /v2/minecraft/hypixel/:uuid (Hypixel + SkyBlock) ---------------
// Only fetched when asked for. Returns 200 even when the player never
// joined Hypixel — `source` says why each section is null.
+ //
+ // Hypixel API policy compliance:
+ // - Allowlist: only owner-owned UUIDs (MINECRAFT_ALLOWED_UUIDS) are
+ // served, so this can't be used to proxy the Public API to third
+ // parties. An empty allowlist disables the endpoint (403).
+ // - No force-refresh: ?fresh/?nocache/?refresh are ignored here so the
+ // public can't bust the 5-min cache and hammer the upstream key.
const mch = path.match(/^\/v2\/minecraft\/hypixel\/(.+)$/);
if (mch) {
const short = normalizeMcUuid(safeDecode(mch[1]));
@@ -374,7 +381,13 @@ export default {
400,
);
}
- const data = await getMinecraftHypixel(env, short, ctx, wantsForce(url));
+ if (!isAllowedHypixelUuid(env, short)) {
+ return json(
+ { success: false, error: { code: "forbidden", message: "This endpoint only serves the operator's own Minecraft accounts." } },
+ 403,
+ );
+ }
+ const data = await getMinecraftHypixel(env, short, ctx, false);
return json<UnifiedMinecraftHypixel>({ success: true, data });
}
diff --git a/src/minecraft.ts b/src/minecraft.ts
index e8408d1..0c8b052 100644
--- a/src/minecraft.ts
+++ b/src/minecraft.ts
@@ -251,6 +251,28 @@ export async function getVanillaCapeList(env: Env): Promise<VanillaCapeList> {
return { count: capes.length, capes };
}
+/**
+ * The set of owner-owned UUIDs allowed on the keyed Hypixel endpoint, parsed
+ * from MINECRAFT_ALLOWED_UUIDS (any spelling, comma-separated) into normalized
+ * 32-char hex. Hypixel policy forbids proxying the Public API to third parties,
+ * so the keyed endpoint only ever answers for our own accounts. An empty/unset
+ * var yields an empty set — the route treats that as "disabled".
+ */
+export function allowedHypixelUuids(env: Env): Set<string> {
+ const raw = env.MINECRAFT_ALLOWED_UUIDS ?? "";
+ const out = new Set<string>();
+ for (const part of raw.split(",")) {
+ const norm = normalizeMcUuid(part.trim());
+ if (norm) out.add(norm);
+ }
+ return out;
+}
+
+/** True when `short` (normalized hex) is one of our own allowlisted accounts. */
+export function isAllowedHypixelUuid(env: Env, short: string): boolean {
+ return allowedHypixelUuids(env).has(undash(short));
+}
+
/** Fetch a Hypixel v2 endpoint and unwrap { success, <key> }.
* Returns [value, state] where state explains a null value. */
async function fetchHypixel<T>(
diff --git a/src/types.ts b/src/types.ts
index 7451fee..ca27b55 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -77,6 +77,11 @@ export interface Env {
* /v2/minecraft/general (Mojang profile + skin) still works, and
* /v2/minecraft/hypixel returns null sections with source "unavailable". */
HYPIXEL_API_KEY?: string;
+ /** Comma-separated allowlist of owner-owned Minecraft UUIDs (any spelling).
+ * Per Hypixel API policy the keyed /v2/minecraft/hypixel endpoint only serves
+ * our own accounts — arbitrary UUIDs are rejected so it can't be used to
+ * proxy the Public API to third parties. Empty = endpoint disabled. */
+ MINECRAFT_ALLOWED_UUIDS?: string;
}
export type DiscordStatus = "online" | "idle" | "dnd" | "offline";
diff --git a/wrangler.jsonc b/wrangler.jsonc
index 8fd2402..0acdb19 100644
--- a/wrangler.jsonc
+++ b/wrangler.jsonc
@@ -77,6 +77,15 @@
"ADMIN_USERNAME": "clove",
"ADMIN_DISPLAY_NAME": "Administrator",
"BASE_URL": "https://doughmination.uk",
- "CORS_ORIGINS": ""
+ "CORS_ORIGINS": "",
+
+ // Hypixel API policy: the keyed /v2/minecraft/hypixel endpoint only
+ // serves our OWN accounts, never arbitrary players (no proxying the
+ // Public API to third parties). Add every owned UUID here, comma-
+ // separated (any spelling). Empty = endpoint disabled (403).
+ // Accounts: TransCatgorl (main), FontaineDeFurina, ChooseEevee,
+ // MidnightCyan, RealUziDoorman, Doughmination, Genderfae, GothCuddles,
+ // LesbianGothMommy, MeowingForHRT, SpankedByGoths, TransGothicGirl.
+ "MINECRAFT_ALLOWED_UUIDS": "79ef438d69ea473c99cd6a5ec34c6736,d20b556ae2cc452dab726ae082d439af,33d473f2902e458a9da1b345654f5f22,d9ca235297fd4686b680e497432fb719,5387502156ff4f229cd1d1b95293c1ec,c6230d8f1b72449ba2db4c7e4ba9303a,536a2d64b89a423b9fa51ee182f7a118,b046a090cc0845e68e1c2635f4fbda5c,25335e08ea4f4a1880741435df784297,9f34197705164a05b6753a69fff675f7,28a75bbea78f4f7db1bea90e9d38f189,1bd448116a6e4912ab6772849bc89018"
}
}
\ No newline at end of file