Replace axios with got, check for empty version in forgemod meta.

This commit is contained in:
Daniel Scalzi
2020-09-04 23:29:36 -04:00
parent f287388931
commit d2e317b4df
6 changed files with 528 additions and 161 deletions

View File

@@ -1,8 +1,12 @@
import { createLogger, format, transports, Logger } from 'winston'
import { SPLAT } from 'triple-beam'
import { SPLAT as SPLAT_Symbol } from 'triple-beam'
import moment from 'moment'
import { inspect } from 'util'
// Workaround until fixed.
// https://github.com/winstonjs/logform/issues/111
const SPLAT = SPLAT_Symbol as unknown as string
export class LoggerUtil {
public static getLogger(label: string): Logger {

View File

@@ -1,4 +1,4 @@
import Axios from 'axios'
import got from 'got'
import { PromotionsSlim } from '../model/forge/promotionsslim'
import { MinecraftVersion } from './MinecraftVersion'
import { LoggerUtil } from './LoggerUtil'
@@ -39,12 +39,12 @@ export class VersionUtil {
}
public static async getPromotionIndex(): Promise<PromotionsSlim> {
const response = await Axios({
const response = await got.get<PromotionsSlim>({
method: 'get',
url: 'https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json',
responseType: 'json'
})
return response.data as PromotionsSlim
return response.body
}
public static getPromotedVersionStrict(index: PromotionsSlim, minecraftVersion: MinecraftVersion, promotion: string): string {