From 5431d9b19e7836ffb4bdd83b5864a04e4ac2ecd0 Mon Sep 17 00:00:00 2001 From: trippyone <137233897+trippyone@users.noreply.github.com> Date: Wed, 22 Nov 2023 23:38:15 -0500 Subject: [PATCH] support all bundle file extension This issue was brought up by SiulSC on Discord. If bundle files have a different extension than .bundle, SPT will return an UNHANDLED exception and won't download the bundle correctly. However, custom bundle extensions are managed on normal standard SPT, so not sure why we're getting this issue with SITCoop. This PR aims to fix this issue. Tested using this mod: https://hub.sp-tarkov.com/files/file/889-goblin-king/ which is using .goblin with some of its bundles. Confirmed to be working with this PR. --- src/StayInTarkovMod.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/StayInTarkovMod.ts b/src/StayInTarkovMod.ts index 4f350aad..12d9ed8a 100644 --- a/src/StayInTarkovMod.ts +++ b/src/StayInTarkovMod.ts @@ -45,6 +45,7 @@ import { CoopMatchResponse } from "./CoopMatchResponse"; import { friendlyAI } from "./FriendlyAI"; import { SITCustomTraders } from "./Traders/SITCustomTraders"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; +import { BundleCallbacks } from "@spt-aki/callbacks/BundleCallbacks"; // ------------------------------------------------------------------------- @@ -70,6 +71,7 @@ export class StayInTarkovMod implements IPreAkiLoadMod, IPostDBLoadMod resolvedExternalIP: string; profileHelper: ProfileHelper; httpServerHelper: HttpServerHelper; + bundleCallbacks: BundleCallbacks; public traders: any[] = []; @@ -114,6 +116,7 @@ export class StayInTarkovMod implements IPreAkiLoadMod, IPostDBLoadMod this.bundleLoader = container.resolve("BundleLoader"); this.profileHelper = container.resolve("ProfileHelper"); this.httpServerHelper = container.resolve("HttpServerHelper"); + this.bundleCallbacks = container.resolve("BundleCallbacks"); // this.traders.push(new SITCustomTraders(), new CoopGroupTrader(), new UsecTrader(), new BearTrader()); this.traders.push(new SITCustomTraders()); @@ -200,6 +203,14 @@ export class StayInTarkovMod implements IPreAkiLoadMod, IPostDBLoadMod output = JSON.stringify(friendlyAI); return output; } + ), + new RouteAction( + "/files/bundle", + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (url: string, info: any, sessionID: string, output: string): any => + { + return this.bundleCallbacks.getBundle(url, info, sessionID); + } ) ] ,"aki"