From b6a7a91c6de9f33e7006b0e901a204b5ea04f99f Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Wed, 2 Nov 2022 04:00:55 +0800 Subject: [PATCH] fix: FEST upload failed --- CHANGELOG | 4 ++++ src/constant.ts | 2 +- src/exporters/stat.ink.ts | 11 ++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b26909c..0d61231 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +0.1.14 + +fix: FEST upload failed + 0.1.13 feat: auto track after promotion challenge success diff --git a/src/constant.ts b/src/constant.ts index a546657..062e94f 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -1,7 +1,7 @@ import type { StatInkPostBody, VsHistoryDetail } from "./types.ts"; export const AGENT_NAME = "s3si.ts"; -export const S3SI_VERSION = "0.1.13"; +export const S3SI_VERSION = "0.1.14"; export const NSOAPP_VERSION = "2.3.1"; export const WEB_VIEW_VERSION = "1.0.0-5644e7a2"; export const S3SI_LINK = "https://github.com/spacemeowx2/s3si.ts"; diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index d0d17b5..f09a11b 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -56,9 +56,12 @@ export class StatInkExporter implements GameExporter { "Authorization": `Bearer ${this.statInkApiKey}`, }; } + isTriColor({ vsMode }: VsHistoryDetail): boolean { + return vsMode.mode === "FEST" && b64Number(vsMode.id) === 8; + } async exportGame(game: VsInfo | CoopInfo) { - if (game.type === "CoopInfo") { - // TODO: support coop + if (game.type === "CoopInfo" || (this.isTriColor(game.detail))) { + // TODO: support coop and tri-color fest return {}; } const body = await this.mapBattle(game); @@ -130,11 +133,13 @@ export class StatInkExporter implements GameExporter { } else if (vsMode === "PRIVATE") { return "private"; } else if (vsMode === "FEST") { - const modeId = b64Number(vsDetail.id); + const modeId = b64Number(vsDetail.vsMode.id); if (modeId === 6) { return "splatfest_open"; } else if (modeId === 7) { return "splatfest_challenge"; + } else if (modeId === 8) { + throw new Error("Tri-color battle is not supported"); } }