2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 19:59:04 +02:00
|
|
|
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";
|
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(
|
2024-05-28 16:04:20 +02:00
|
|
|
@inject("PrimaryLogger") protected logger: ILogger,
|
2023-03-03 16:23:46 +01:00
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
|
|
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
2024-05-21 19:59:04 +02:00
|
|
|
@inject("PostSptModLoader") protected postSptModLoader: PostSptModLoader,
|
2023-03-03 16:23:46 +01:00
|
|
|
@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)
|
|
|
|
{
|
2024-05-21 19:59:04 +02:00
|
|
|
await this.postSptModLoader.load();
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public getRoute(): string
|
|
|
|
{
|
2024-05-21 19:59:04 +02:00
|
|
|
return "spt-mods";
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
}
|