Esxpose two endpoints for launcher to get mod-related data
This commit is contained in:
parent
e591ea9e8f
commit
91ec0144ed
@ -88,6 +88,17 @@ class LauncherCallbacks
|
|||||||
{
|
{
|
||||||
return this.httpResponse.noBody(this.launcherController.getCompatibleTarkovVersion());
|
return this.httpResponse.noBody(this.launcherController.getCompatibleTarkovVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getLoadedServerMods(): string
|
||||||
|
{
|
||||||
|
return this.httpResponse.noBody(this.launcherController.getLoadedServerMods());
|
||||||
|
}
|
||||||
|
|
||||||
|
public getServerModsProfileUsed(url: string, info: IEmptyRequestData, sessionId: string): string
|
||||||
|
{
|
||||||
|
return this.httpResponse.noBody(this.launcherController.getServerModsProfileUsed(sessionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { LauncherCallbacks };
|
export { LauncherCallbacks };
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import { inject, injectable } from "tsyringe";
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
import { HttpServerHelper } from "../helpers/HttpServerHelper";
|
||||||
|
import { ProfileHelper } from "../helpers/ProfileHelper";
|
||||||
|
import { PreAkiModLoader } from "../loaders/PreAkiModLoader";
|
||||||
import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
|
import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
|
||||||
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
|
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
|
||||||
import { IRegisterData } from "../models/eft/launcher/IRegisterData";
|
import { IRegisterData } from "../models/eft/launcher/IRegisterData";
|
||||||
import { Info } from "../models/eft/profile/IAkiProfile";
|
import { Info, ModDetails } from "../models/eft/profile/IAkiProfile";
|
||||||
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
|
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
|
||||||
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
||||||
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
|
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
|
||||||
|
import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData";
|
||||||
import { ConfigServer } from "../servers/ConfigServer";
|
import { ConfigServer } from "../servers/ConfigServer";
|
||||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||||
import { SaveServer } from "../servers/SaveServer";
|
import { SaveServer } from "../servers/SaveServer";
|
||||||
@ -23,8 +26,10 @@ export class LauncherController
|
|||||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||||
@inject("SaveServer") protected saveServer: SaveServer,
|
@inject("SaveServer") protected saveServer: SaveServer,
|
||||||
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
||||||
|
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||||
|
@inject("PreAkiModLoader") protected preAkiModLoader: PreAkiModLoader,
|
||||||
@inject("ConfigServer") protected configServer: ConfigServer
|
@inject("ConfigServer") protected configServer: ConfigServer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -160,4 +165,15 @@ export class LauncherController
|
|||||||
{
|
{
|
||||||
return this.coreConfig.compatibleTarkovVersion;
|
return this.coreConfig.compatibleTarkovVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getLoadedServerMods(): Record<string, IPackageJsonData>
|
||||||
|
{
|
||||||
|
return this.preAkiModLoader.getImportedModDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
public getServerModsProfileUsed(sessionId: string): ModDetails[]
|
||||||
|
{
|
||||||
|
const profile = this.profileHelper.getFullProfile(sessionId);
|
||||||
|
return profile?.aki?.mods;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ export class InRaidHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check an array of items and add an upd object to money items with a stack count of 1
|
* Check items array and add an upd object to money with a stack count of 1
|
||||||
* Single stack money items have no upd object and thus no StackObjectsCount, causing issues
|
* Single stack money items have no upd object and thus no StackObjectsCount, causing issues
|
||||||
* @param items Items array to check
|
* @param items Items array to check
|
||||||
*/
|
*/
|
||||||
|
@ -99,6 +99,22 @@ export class LauncherStaticRouter extends StaticRouter
|
|||||||
{
|
{
|
||||||
return this.launcherCallbacks.getServerVersion();
|
return this.launcherCallbacks.getServerVersion();
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/launcher/server/loadedServerMods",
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.launcherCallbacks.getLoadedServerMods();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/launcher/server/serverModsUsedByProfile",
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -27,6 +27,11 @@ export class HttpResponseUtil
|
|||||||
.replace(/[\\]/g, "");
|
.replace(/[\\]/g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return passed in data as JSON string
|
||||||
|
* @param data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
public noBody(data: any): any
|
public noBody(data: any): any
|
||||||
{
|
{
|
||||||
return this.clearString(this.jsonUtil.serialize(data));
|
return this.clearString(this.jsonUtil.serialize(data));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user