2023-10-26 11:44:17 +02:00
|
|
|
import { ClientLogController } from "@spt-aki/controllers/ClientLogController";
|
2024-03-11 23:03:14 +01:00
|
|
|
import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder";
|
2023-10-26 11:44:17 +02:00
|
|
|
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
2024-03-07 19:16:55 +01:00
|
|
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
2024-03-16 22:03:52 +01:00
|
|
|
import { IBsgLogging, ICoreConfig, IRelease } from "@spt-aki/models/spt/config/ICoreConfig";
|
2023-10-26 11:44:17 +02:00
|
|
|
import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest";
|
2024-03-07 19:16:55 +01:00
|
|
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
|
|
|
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
2023-10-26 11:44:17 +02:00
|
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
|
|
|
/** Handle client logging related events */
|
|
|
|
@injectable()
|
|
|
|
export class ClientLogCallbacks
|
|
|
|
{
|
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
2023-11-16 02:35:05 +01:00
|
|
|
@inject("ClientLogController") protected clientLogController: ClientLogController,
|
2024-03-07 19:16:55 +01:00
|
|
|
@inject("ConfigServer") protected configServer: ConfigServer,
|
|
|
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
2024-03-11 23:03:14 +01:00
|
|
|
@inject("ModLoadOrder") protected modLoadOrder: ModLoadOrder,
|
2023-11-16 02:35:05 +01:00
|
|
|
)
|
|
|
|
{}
|
2023-10-26 11:44:17 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/log
|
|
|
|
*/
|
|
|
|
public clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
this.clientLogController.clientLog(info);
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
2024-03-07 19:16:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/release
|
|
|
|
*/
|
|
|
|
public releaseNotes(): string
|
|
|
|
{
|
|
|
|
const data: IRelease = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).release;
|
2024-03-11 23:03:14 +01:00
|
|
|
|
2024-03-17 09:55:02 +01:00
|
|
|
data.betaDisclaimerText = globalThis.G_MODS_ENABLED
|
|
|
|
? this.localisationService.getText("release-beta-disclaimer-mods-enabled")
|
|
|
|
: this.localisationService.getText("release-beta-disclaimer");
|
|
|
|
|
2024-03-11 23:03:14 +01:00
|
|
|
data.betaDisclaimerAcceptText = this.localisationService.getText("release-beta-disclaimer-accept");
|
|
|
|
data.serverModsLoadedText = this.localisationService.getText("release-server-mods-loaded");
|
|
|
|
data.serverModsLoadedDebugText = this.localisationService.getText("release-server-mods-debug-message");
|
|
|
|
data.clientModsLoadedText = this.localisationService.getText("release-plugins-loaded");
|
|
|
|
data.clientModsLoadedDebugText = this.localisationService.getText("release-plugins-loaded-debug-message");
|
|
|
|
data.illegalPluginsLoadedText = this.localisationService.getText("release-illegal-plugins-loaded");
|
|
|
|
data.illegalPluginsExceptionText = this.localisationService.getText("release-illegal-plugins-exception");
|
|
|
|
data.releaseSummaryText = this.localisationService.getText("release-summary");
|
|
|
|
|
2024-03-11 09:45:05 +01:00
|
|
|
data.isBeta = globalThis.G_WATERMARK_ENABLED;
|
|
|
|
data.isModdable = globalThis.G_MODS_ENABLED;
|
2024-03-11 23:03:14 +01:00
|
|
|
data.isModded = this.modLoadOrder.getLoadOrder().length > 0 ? true : false;
|
2024-03-11 09:45:05 +01:00
|
|
|
|
2024-03-07 19:16:55 +01:00
|
|
|
return this.httpResponse.noBody(data);
|
|
|
|
}
|
2024-03-16 22:03:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/enableBSGlogging
|
|
|
|
*/
|
|
|
|
|
|
|
|
public bsgLogging(): string
|
|
|
|
{
|
|
|
|
const data: IBsgLogging = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).bsgLogging;
|
|
|
|
return this.httpResponse.noBody(data);
|
|
|
|
}
|
2023-11-16 02:35:05 +01:00
|
|
|
}
|