Server/project/src/callbacks/ModCallbacks.ts
Alex 8727f6150e primery-dependencies (!355)
Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/355
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-28 14:04:20 +00:00

42 lines
1.4 KiB
TypeScript

import { inject, injectable } from "tsyringe";
import { OnLoad } from "@spt/di/OnLoad";
import { PostSptModLoader } from "@spt/loaders/PostSptModLoader";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { LocalisationService } from "@spt/services/LocalisationService";
import { HttpFileUtil } from "@spt/utils/HttpFileUtil";
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
@injectable()
export class ModCallbacks implements OnLoad
{
protected httpConfig: IHttpConfig;
constructor(
@inject("PrimaryLogger") protected logger: ILogger,
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
@inject("PostSptModLoader") protected postSptModLoader: PostSptModLoader,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer,
)
{
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP);
}
public async onLoad(): Promise<void>
{
if (globalThis.G_MODS_ENABLED)
{
await this.postSptModLoader.load();
}
}
public getRoute(): string
{
return "spt-mods";
}
}