diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-03-15 21:17:59 -0500 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-03-15 21:17:59 -0500 |
commit | abd801c61c780af525086f372bbffb10263f5d2f (patch) | |
tree | 59ad475f1556a222f294be678363d5bbded0ad99 /src/mojang.ts | |
parent | d1758e3f0e8e9334bbfc160dbe2245d15a6cd859 (diff) | |
download | skyblock-api-abd801c61c780af525086f372bbffb10263f5d2f.tar.gz skyblock-api-abd801c61c780af525086f372bbffb10263f5d2f.tar.bz2 skyblock-api-abd801c61c780af525086f372bbffb10263f5d2f.zip |
change it to use the v1 ashcon api rather than v2
Diffstat (limited to 'src/mojang.ts')
-rw-r--r-- | src/mojang.ts | 15 |
1 files changed, 12 insertions, 3 deletions
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<AshconResponse> { +export async function mojangDataFromUser(user: string): Promise<AshconV1Response> { 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() |