d13e86ba46
Rebranded src code and scripts to SPT Co-authored-by: clodan <clodan@clodan.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/345 Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com> Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
94 lines
3.3 KiB
TypeScript
94 lines
3.3 KiB
TypeScript
import { inject, injectable } from "tsyringe";
|
|
import { LauncherController } from "@spt/controllers/LauncherController";
|
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
|
import { IChangeRequestData } from "@spt/models/eft/launcher/IChangeRequestData";
|
|
import { ILoginRequestData } from "@spt/models/eft/launcher/ILoginRequestData";
|
|
import { IRegisterData } from "@spt/models/eft/launcher/IRegisterData";
|
|
import { IRemoveProfileData } from "@spt/models/eft/launcher/IRemoveProfileData";
|
|
import { SaveServer } from "@spt/servers/SaveServer";
|
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
|
import { Watermark } from "@spt/utils/Watermark";
|
|
|
|
@injectable()
|
|
export class LauncherCallbacks
|
|
{
|
|
constructor(
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
@inject("LauncherController") protected launcherController: LauncherController,
|
|
@inject("SaveServer") protected saveServer: SaveServer,
|
|
@inject("Watermark") protected watermark: Watermark,
|
|
)
|
|
{}
|
|
|
|
public connect(): string
|
|
{
|
|
return this.httpResponse.noBody(this.launcherController.connect());
|
|
}
|
|
|
|
public login(url: string, info: ILoginRequestData, sessionID: string): string
|
|
{
|
|
const output = this.launcherController.login(info);
|
|
return !output ? "FAILED" : output;
|
|
}
|
|
|
|
public register(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK"
|
|
{
|
|
const output = this.launcherController.register(info);
|
|
return !output ? "FAILED" : "OK";
|
|
}
|
|
|
|
public get(url: string, info: ILoginRequestData, sessionID: string): string
|
|
{
|
|
const output = this.launcherController.find(this.launcherController.login(info));
|
|
return this.httpResponse.noBody(output);
|
|
}
|
|
|
|
public changeUsername(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK"
|
|
{
|
|
const output = this.launcherController.changeUsername(info);
|
|
return !output ? "FAILED" : "OK";
|
|
}
|
|
|
|
public changePassword(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK"
|
|
{
|
|
const output = this.launcherController.changePassword(info);
|
|
return !output ? "FAILED" : "OK";
|
|
}
|
|
|
|
public wipe(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK"
|
|
{
|
|
const output = this.launcherController.wipe(info);
|
|
return !output ? "FAILED" : "OK";
|
|
}
|
|
|
|
public getServerVersion(): string
|
|
{
|
|
return this.httpResponse.noBody(this.watermark.getVersionTag());
|
|
}
|
|
|
|
public ping(url: string, info: IEmptyRequestData, sessionID: string): string
|
|
{
|
|
return this.httpResponse.noBody("pong!");
|
|
}
|
|
|
|
public removeProfile(url: string, info: IRemoveProfileData, sessionID: string): string
|
|
{
|
|
return this.httpResponse.noBody(this.saveServer.removeProfile(sessionID));
|
|
}
|
|
|
|
public getCompatibleTarkovVersion(): string
|
|
{
|
|
return this.httpResponse.noBody(this.launcherController.getCompatibleTarkovVersion());
|
|
}
|
|
|
|
public getLoadedServerMods(): string
|
|
{
|
|
return this.httpResponse.noBody(this.launcherController.getLoadedServerMods());
|
|
}
|
|
|
|
public getServerModsProfileUsed(url: string, info: IEmptyRequestData, sessionId: string): string
|
|
{
|
|
return this.httpResponse.noBody(this.launcherController.getServerModsProfileUsed(sessionId));
|
|
}
|
|
}
|