50c7a26a58
This is the first pass of ESLint on the codebase. ESLint formatting is less strict when it comes to line-length and line-breaks then dprint/biome, so if you see formatting that you don't like... fix it! It shouldn't require a configuration change. - This should merge clean into master (when the time comes). - This will not merge clean into `3.9.0-DEV`, but the conflicts aren't that bad.
71 lines
3.2 KiB
TypeScript
71 lines
3.2 KiB
TypeScript
import { inject, injectable } from "tsyringe";
|
|
import { ClientLogController } from "@spt-aki/controllers/ClientLogController";
|
|
import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder";
|
|
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
|
import { IBsgLogging, ICoreConfig, IRelease } from "@spt-aki/models/spt/config/ICoreConfig";
|
|
import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest";
|
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
|
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
|
|
|
/** Handle client logging related events */
|
|
@injectable()
|
|
export class ClientLogCallbacks
|
|
{
|
|
constructor(
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
@inject("ClientLogController") protected clientLogController: ClientLogController,
|
|
@inject("ConfigServer") protected configServer: ConfigServer,
|
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
|
@inject("ModLoadOrder") protected modLoadOrder: ModLoadOrder,
|
|
)
|
|
{}
|
|
|
|
/**
|
|
* Handle /singleplayer/log
|
|
*/
|
|
public clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData
|
|
{
|
|
this.clientLogController.clientLog(info);
|
|
return this.httpResponse.nullResponse();
|
|
}
|
|
|
|
/**
|
|
* Handle /singleplayer/release
|
|
*/
|
|
public releaseNotes(): string
|
|
{
|
|
const data: IRelease = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).release;
|
|
|
|
data.betaDisclaimerText = globalThis.G_MODS_ENABLED
|
|
? this.localisationService.getText("release-beta-disclaimer-mods-enabled")
|
|
: this.localisationService.getText("release-beta-disclaimer");
|
|
|
|
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");
|
|
|
|
data.isBeta = globalThis.G_WATERMARK_ENABLED;
|
|
data.isModdable = globalThis.G_MODS_ENABLED;
|
|
data.isModded = this.modLoadOrder.getLoadOrder().length > 0 ? true : false;
|
|
|
|
return this.httpResponse.noBody(data);
|
|
}
|
|
|
|
/**
|
|
* Handle /singleplayer/enableBSGlogging
|
|
*/
|
|
|
|
public bsgLogging(): string
|
|
{
|
|
const data: IBsgLogging = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).bsgLogging;
|
|
return this.httpResponse.noBody(data);
|
|
}
|
|
}
|