Server/project/src/routers/static/LauncherStaticRouter.ts

110 lines
4.5 KiB
TypeScript
Raw Normal View History

2023-03-03 15:23:46 +00:00
import { inject, injectable } from "tsyringe";
import { LauncherCallbacks } from "@spt-aki/callbacks/LauncherCallbacks";
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
2023-03-03 15:23:46 +00:00
@injectable()
2023-11-13 11:12:17 -05:00
export class LauncherStaticRouter extends StaticRouter
2023-03-03 15:23:46 +00:00
{
constructor(
2023-11-13 11:12:17 -05:00
@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks,
)
2023-03-03 15:23:46 +00:00
{
super(
[
new RouteAction(
"/launcher/ping",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.ping(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/server/connect",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.connect();
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/login",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
2023-11-13 11:12:17 -05:00
return this.launcherCallbacks.login(url, info, sessionID);
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/register",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.register(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/get",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.get(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/change/username",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.changeUsername(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/change/password",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.changePassword(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/change/wipe",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.wipe(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/remove",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.removeProfile(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/profile/compatibleTarkovVersion",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.getCompatibleTarkovVersion();
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/launcher/server/version",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.launcherCallbacks.getServerVersion();
2023-11-13 11:12:17 -05:00
},
),
new RouteAction(
"/launcher/server/loadedServerMods",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.getLoadedServerMods();
2023-11-13 11:12:17 -05:00
},
),
new RouteAction(
"/launcher/server/serverModsUsedByProfile",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
),
],
2023-03-03 15:23:46 +00:00
);
}
2023-11-13 11:12:17 -05:00
}