2023-03-03 15:23:46 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2023-10-19 17:21:17 +00:00
|
|
|
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
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks)
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
super([
|
2024-04-28 13:45:36 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/launcher/ping",
|
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
|
|
|
{
|
|
|
|
return this.launcherCallbacks.ping(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
new RouteAction(
|
|
|
|
"/launcher/server/connect",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.connect();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/login",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.login(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/register",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.register(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2024-04-28 13:45:36 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/get",
|
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
|
|
|
{
|
|
|
|
return this.launcherCallbacks.get(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/change/username",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.changeUsername(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/change/password",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.changePassword(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/change/wipe",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.wipe(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/remove",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.removeProfile(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/profile/compatibleTarkovVersion",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.getCompatibleTarkovVersion();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/server/version",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.getServerVersion();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/server/loadedServerMods",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.getLoadedServerMods();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/launcher/server/serverModsUsedByProfile",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]);
|
2023-03-03 15:23:46 +00:00
|
|
|
}
|
2023-11-13 11:12:17 -05:00
|
|
|
}
|