2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2023-10-19 19:21:17 +02:00
|
|
|
import { LauncherController } from "@spt-aki/controllers/LauncherController";
|
|
|
|
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
|
|
|
import { IChangeRequestData } from "@spt-aki/models/eft/launcher/IChangeRequestData";
|
|
|
|
import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData";
|
|
|
|
import { IRegisterData } from "@spt-aki/models/eft/launcher/IRegisterData";
|
|
|
|
import { IRemoveProfileData } from "@spt-aki/models/eft/launcher/IRemoveProfileData";
|
|
|
|
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
|
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
|
|
|
import { Watermark } from "@spt-aki/utils/Watermark";
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
2023-11-10 21:19:56 +01:00
|
|
|
export class LauncherCallbacks
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
|
|
@inject("LauncherController") protected launcherController: LauncherController,
|
|
|
|
@inject("SaveServer") protected saveServer: SaveServer,
|
2023-11-10 21:19:56 +01:00
|
|
|
@inject("Watermark") protected watermark: Watermark,
|
2023-03-03 16:23:46 +01:00
|
|
|
)
|
2023-11-10 21:19:56 +01:00
|
|
|
{}
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
2023-08-10 15:29:09 +02:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|