2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2023-10-19 19:21:17 +02:00
|
|
|
import { OnLoad } from "@spt-aki/di/OnLoad";
|
|
|
|
import { PostAkiModLoader } from "@spt-aki/loaders/PostAkiModLoader";
|
|
|
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
|
|
|
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
|
|
|
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
|
|
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
|
|
|
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
|
|
|
import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil";
|
|
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
2023-11-10 21:19:56 +01:00
|
|
|
export class ModCallbacks implements OnLoad
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
protected httpConfig: IHttpConfig;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
@inject("WinstonLogger") protected logger: ILogger,
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
|
|
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
|
|
|
@inject("PostAkiModLoader") protected postAkiModLoader: PostAkiModLoader,
|
|
|
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
2023-11-10 21:19:56 +01:00
|
|
|
@inject("ConfigServer") protected configServer: ConfigServer,
|
2023-03-03 16:23:46 +01:00
|
|
|
)
|
|
|
|
{
|
|
|
|
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP);
|
|
|
|
}
|
2023-11-10 21:19:56 +01:00
|
|
|
|
2023-03-03 16:23:46 +01:00
|
|
|
public async onLoad(): Promise<void>
|
|
|
|
{
|
|
|
|
if (globalThis.G_MODS_ENABLED)
|
|
|
|
{
|
|
|
|
await this.postAkiModLoader.load();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public getRoute(): string
|
|
|
|
{
|
|
|
|
return "aki-mods";
|
|
|
|
}
|
|
|
|
}
|