fix(api): mc_uuid 统一校验为 UUID,非法值返回 400 bad_mc_uuid 并按规范形式存储

This commit is contained in:
Lemon-miaow committed 2026-09-27 12:57:40 +08:00
1 parent 5b0686dc06
commit e91886822c
13 files changed
+159 -35

No files matched your search

+6
View File
@@ -438,6 +438,12 @@ describe("api access-control wire shapes", () => {
);
});
it("says what a Minecraft UUID looks like when the typed one is not", () => {
expect(humanizeError({ status: 400, code: "bad_mc_uuid" })).toBe(
"That isn't a Minecraft UUID. It looks like 069a79f4-44e9-4726-a5be-fca90e38aaf5, with or without the dashes.",
);
});
it("says email codes are off when the install has no mail relay", async () => {
const { humanizeError } = await import("./api");
expect(humanizeError({ status: 503, code: "mail_unavailable" })).toBe(
+2
View File
@@ -1002,6 +1002,8 @@ export function humanizeError(e: unknown): string {
return t("invalid_code");
case "already_linked":
return t("already_linked");
case "bad_mc_uuid":
return t("bad_mc_uuid");
case "otp_resend_cooldown":
return t("otp_resend_cooldown");
case "otp_locked":
+4
View File
@@ -3427,6 +3427,7 @@ export interface operations {
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};
@@ -3491,6 +3492,7 @@ export interface operations {
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};
@@ -3615,6 +3617,7 @@ export interface operations {
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};
@@ -6651,6 +6654,7 @@ export interface operations {
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
/** @description No linked account for this UUID. */