initial commit
Some checks failed
deploy / build-and-deploy (push) Failing after 21s

This commit is contained in:
2025-05-18 13:16:20 +02:00
commit 60f3f8a096
148 changed files with 17900 additions and 0 deletions

14
src/util/minecraft.ts Normal file
View File

@ -0,0 +1,14 @@
export async function getJavaUuid(username: string) {
const response = await fetch(`https://api.mojang.com/users/profiles/minecraft/${username}`);
if (!response.ok) {
// rate limit
if (response.status == 429) return null;
// user doesn't exist
else if (response.status < 500) throw new Error();
return null;
}
const json = await response.json();
const id: string = json['id'];
// prettier-ignore
return `${id.substring(0, 8)}-${id.substring(8, 12)}-${id.substring(12, 16)}-${id.substring(16, 20)}-${id.substring(20)}`;
}