aboutsummaryrefslogtreecommitdiff
path: root/src/mojang.ts
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-15 21:17:59 -0500
committermat <27899617+mat-1@users.noreply.github.com>2021-03-15 21:17:59 -0500
commitabd801c61c780af525086f372bbffb10263f5d2f (patch)
tree59ad475f1556a222f294be678363d5bbded0ad99 /src/mojang.ts
parentd1758e3f0e8e9334bbfc160dbe2245d15a6cd859 (diff)
downloadskyblock-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.ts15
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()