2024-05-21 17:59:04 +00:00
|
|
|
import { ClientLogController } from "@spt/controllers/ClientLogController";
|
|
|
|
import { ModLoadOrder } from "@spt/loaders/ModLoadOrder";
|
|
|
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
|
|
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
|
|
|
import { IBsgLogging, ICoreConfig, IRelease } from "@spt/models/spt/config/ICoreConfig";
|
|
|
|
import { IClientLogRequest } from "@spt/models/spt/logging/IClientLogRequest";
|
|
|
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
|
|
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
|
|
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
2024-07-23 11:12:53 -04:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2023-10-26 09:44:17 +00:00
|
|
|
|
|
|
|
/** Handle client logging related events */
|
|
|
|
@injectable()
|
2024-07-23 11:12:53 -04:00
|
|
|
export class ClientLogCallbacks {
|
2023-10-26 09:44:17 +00:00
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
2023-11-15 20:35:05 -05:00
|
|
|
@inject("ClientLogController") protected clientLogController: ClientLogController,
|
2024-03-07 18:16:55 +00:00
|
|
|
@inject("ConfigServer") protected configServer: ConfigServer,
|
|
|
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
2024-03-11 22:03:14 +00:00
|
|
|
@inject("ModLoadOrder") protected modLoadOrder: ModLoadOrder,
|
2024-07-23 11:12:53 -04:00
|
|
|
) {}
|
2023-10-26 09:44:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/log
|
|
|
|
*/
|
2024-07-23 11:12:53 -04:00
|
|
|
public clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData {
|
2023-10-26 09:44:17 +00:00
|
|
|
this.clientLogController.clientLog(info);
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
2024-03-07 18:16:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/release
|
|
|
|
*/
|
2024-07-23 11:12:53 -04:00
|
|
|
public releaseNotes(): string {
|
2024-03-07 18:16:55 +00:00
|
|
|
const data: IRelease = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).release;
|
2024-03-11 22:03:14 +00:00
|
|
|
|
2024-03-17 08:55:02 +00:00
|
|
|
data.betaDisclaimerText = globalThis.G_MODS_ENABLED
|
|
|
|
? this.localisationService.getText("release-beta-disclaimer-mods-enabled")
|
|
|
|
: this.localisationService.getText("release-beta-disclaimer");
|
|
|
|
|
2024-03-11 22:03:14 +00: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 08:45:05 +00:00
|
|
|
data.isBeta = globalThis.G_WATERMARK_ENABLED;
|
|
|
|
data.isModdable = globalThis.G_MODS_ENABLED;
|
2024-07-23 17:30:20 +01:00
|
|
|
data.isModded = this.modLoadOrder.getLoadOrder().length > 0;
|
2024-03-11 08:45:05 +00:00
|
|
|
|
2024-03-07 18:16:55 +00:00
|
|
|
return this.httpResponse.noBody(data);
|
|
|
|
}
|
2024-03-16 21:03:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle /singleplayer/enableBSGlogging
|
|
|
|
*/
|
|
|
|
|
2024-07-23 11:12:53 -04:00
|
|
|
public bsgLogging(): string {
|
2024-03-16 21:03:52 +00:00
|
|
|
const data: IBsgLogging = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).bsgLogging;
|
|
|
|
return this.httpResponse.noBody(data);
|
|
|
|
}
|
2023-11-15 20:35:05 -05:00
|
|
|
}
|