From acbe57afb140b7e33a580c7fc8dde44f6f33fa46 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Wed, 15 Jun 2022 08:25:47 +0800 Subject: [PATCH] fix scrumplex --- src/utils/remoteVersions.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/utils/remoteVersions.ts b/src/utils/remoteVersions.ts index 6f259cf..c786679 100644 --- a/src/utils/remoteVersions.ts +++ b/src/utils/remoteVersions.ts @@ -1,5 +1,5 @@ interface MetaPackage { - formatVersion: int; + formatVersion: number; name: string; recommended: string[]; uid: string; @@ -11,14 +11,18 @@ interface SimplifiedGHReleases { // TODO: caching export async function getLatestMinecraftVersion(): Promise { - const f = await fetch('https://meta.polymc.org/v1/net.minecraft/package.json'); - const package = await f.json() as MetaPackage; - return package.recommended[0]; + const f = await fetch( + 'https://meta.polymc.org/v1/net.minecraft/package.json' + ); + + const minecraft = (await f.json()) as MetaPackage; + return minecraft.recommended[0]; } // TODO: caching export async function getLatestPolyMCVersion(): Promise { const f = await fetch('https://api.github.com/repos/PolyMC/PolyMC/releases'); - const versions = await f.json() as SimplifiedGHReleases[]; + const versions = (await f.json()) as SimplifiedGHReleases[]; + return versions[0].tag_name; }