From abd801c61c780af525086f372bbffb10263f5d2f Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Mon, 15 Mar 2021 21:17:59 -0500 Subject: change it to use the v1 ashcon api rather than v2 --- src/mojang.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mojang.ts b/src/mojang.ts index 3ec274e..a340ae0 100644 --- a/src/mojang.ts +++ b/src/mojang.ts @@ -22,7 +22,7 @@ interface AshconTextures { raw: { value: string, signature: string } } -interface AshconResponse { +interface AshconV2Response { uuid: string username: string username_history: AshconHistoryItem[] @@ -30,12 +30,21 @@ interface AshconResponse { created_at?: string } +interface AshconV1Response { + uuid: string + username: string + username_history: AshconHistoryItem[] + textures: AshconTextures + cached_at?: string +} + /** * Get mojang api data from ashcon.app */ -export async function mojangDataFromUser(user: string): Promise { +export async function mojangDataFromUser(user: string): Promise { const fetchResponse = await fetch( - 'https://api.ashcon.app/mojang/v2/user/' + user, + // we use v1 rather than v2 since its more stable + `https://api.ashcon.app/mojang/v1/user/${user}`, { agent: () => httpsAgent } ) return await fetchResponse.json() -- cgit