First iteration of async work on callbacks (!311)
Co-authored-by: clodan <clodan@clodan.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/311 Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com> Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
44583f40ac
commit
2172c29640
@ -58,13 +58,13 @@ export class BotCallbacks
|
||||
* Handle client/game/bot/generate
|
||||
* @returns IGetBodyResponseData
|
||||
*/
|
||||
public generateBots(
|
||||
public async generateBots(
|
||||
url: string,
|
||||
info: IGenerateBotsRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IBotBase[]>
|
||||
): Promise<IGetBodyResponseData<IBotBase[]>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.botController.generate(sessionID, info));
|
||||
return this.httpResponse.getBody(await this.botController.generate(sessionID, info));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,13 +17,13 @@ export class ItemEventCallbacks
|
||||
)
|
||||
{}
|
||||
|
||||
public handleEvents(
|
||||
public async handleEvents(
|
||||
url: string,
|
||||
info: IItemEventRouterRequest,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IItemEventRouterResponse>
|
||||
): Promise<IGetBodyResponseData<IItemEventRouterResponse>>
|
||||
{
|
||||
const eventResponse = this.itemEventRouter.handleEvents(info, sessionID);
|
||||
const eventResponse = await this.itemEventRouter.handleEvents(info, sessionID);
|
||||
const result = (this.isCriticalError(eventResponse.warnings))
|
||||
? this.httpResponse.getBody(
|
||||
eventResponse,
|
||||
|
@ -6,7 +6,7 @@ import { BotGenerator } from "@spt-aki/generators/BotGenerator";
|
||||
import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
|
||||
import { BotHelper } from "@spt-aki/helpers/BotHelper";
|
||||
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
||||
import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData";
|
||||
import { Condition, IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData";
|
||||
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
||||
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
|
||||
import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore";
|
||||
@ -179,7 +179,7 @@ export class BotController
|
||||
* @param info bot generation request info
|
||||
* @returns IBotBase array
|
||||
*/
|
||||
public generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]
|
||||
public async generate(sessionId: string, info: IGenerateBotsRequestData): Promise<IBotBase[]>
|
||||
{
|
||||
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
|
||||
|
||||
@ -199,11 +199,11 @@ export class BotController
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(
|
||||
protected async generateBotsFirstTime(
|
||||
request: IGenerateBotsRequestData,
|
||||
pmcProfile: IPmcData,
|
||||
sessionId: string,
|
||||
): IBotBase[]
|
||||
): Promise<IBotBase[]>
|
||||
{
|
||||
// Clear bot cache before any work starts
|
||||
this.botGenerationCacheService.clearStoredBots();
|
||||
@ -211,6 +211,7 @@ export class BotController
|
||||
const allPmcsHaveSameNameAsPlayer = this.randomUtil.getChance100(
|
||||
this.pmcConfig.allPMCsHavePlayerNameWithRandomPrefixChance,
|
||||
);
|
||||
const conditionPromises: Promise<void>[] = [];
|
||||
for (const condition of request.conditions)
|
||||
{
|
||||
const botGenerationDetails: BotGenerationDetails = {
|
||||
@ -227,45 +228,80 @@ export class BotController
|
||||
allPmcsHaveSameNameAsPlayer: allPmcsHaveSameNameAsPlayer,
|
||||
};
|
||||
|
||||
// Event bots need special actions to occur, set data up for them
|
||||
const isEventBot = condition.Role.toLowerCase().includes("event");
|
||||
if (isEventBot)
|
||||
{
|
||||
// Add eventRole data + reassign role property to be base type
|
||||
botGenerationDetails.eventRole = condition.Role;
|
||||
botGenerationDetails.role = this.seasonalEventService.getBaseRoleForEventBot(
|
||||
botGenerationDetails.eventRole,
|
||||
);
|
||||
}
|
||||
conditionPromises.push(this.generateWithBotDetails(condition, botGenerationDetails, sessionId));
|
||||
}
|
||||
|
||||
// Custom map waves can have spt roles in them
|
||||
// Is bot type sptusec/sptbear, set is pmc true and set side
|
||||
if (this.botHelper.botRoleIsPmc(condition.Role))
|
||||
{
|
||||
botGenerationDetails.isPmc = true;
|
||||
botGenerationDetails.side = this.botHelper.getPmcSideByRole(condition.Role);
|
||||
}
|
||||
await Promise.all(conditionPromises).then((p) => Promise.all(p));
|
||||
|
||||
// Loop over and make x bots for this bot wave
|
||||
const cacheKey = `${
|
||||
botGenerationDetails.eventRole ?? botGenerationDetails.role
|
||||
}${botGenerationDetails.botDifficulty}`;
|
||||
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
|
||||
{
|
||||
// Generate and add bot to cache
|
||||
const detailsClone = this.jsonUtil.clone(botGenerationDetails);
|
||||
const botToCache = this.botGenerator.prepareAndGenerateBot(sessionId, detailsClone);
|
||||
this.botGenerationCacheService.storeBots(cacheKey, [botToCache]);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate many bots and store then on the cache
|
||||
* @param condition the condition details to generate the bots with
|
||||
* @param botGenerationDetails the bot details to generate the bot with
|
||||
* @param sessionId Session id
|
||||
* @returns A promise for the bots to be done generating
|
||||
*/
|
||||
protected async generateWithBotDetails(
|
||||
condition: Condition,
|
||||
botGenerationDetails: BotGenerationDetails,
|
||||
sessionId: string,
|
||||
): Promise<void>
|
||||
{
|
||||
const isEventBot = condition.Role.toLowerCase().includes("event");
|
||||
if (isEventBot)
|
||||
{
|
||||
// Add eventRole data + reassign role property to be base type
|
||||
botGenerationDetails.eventRole = condition.Role;
|
||||
botGenerationDetails.role = this.seasonalEventService.getBaseRoleForEventBot(
|
||||
botGenerationDetails.eventRole,
|
||||
);
|
||||
}
|
||||
|
||||
// Custom map waves can have spt roles in them
|
||||
// Is bot type sptusec/sptbear, set is pmc true and set side
|
||||
if (this.botHelper.botRoleIsPmc(condition.Role))
|
||||
{
|
||||
botGenerationDetails.isPmc = true;
|
||||
botGenerationDetails.side = this.botHelper.getPmcSideByRole(condition.Role);
|
||||
}
|
||||
|
||||
// Loop over and make x bots for this bot wave
|
||||
const cacheKey = `${
|
||||
botGenerationDetails.eventRole ?? botGenerationDetails.role
|
||||
}${botGenerationDetails.botDifficulty}`;
|
||||
const botPromises: Promise<void>[] = [];
|
||||
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
|
||||
{
|
||||
const detailsClone = this.jsonUtil.clone(botGenerationDetails);
|
||||
botPromises.push(this.generateSingleBotAndStoreInCache(detailsClone, sessionId, cacheKey));
|
||||
}
|
||||
return Promise.all(botPromises).then(() =>
|
||||
{
|
||||
this.logger.debug(
|
||||
`Generated ${botGenerationDetails.botCountToGenerate} ${botGenerationDetails.role} (${
|
||||
botGenerationDetails.eventRole ?? ""
|
||||
}) ${botGenerationDetails.botDifficulty} bots`,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return [];
|
||||
/**
|
||||
* Generate a single bot and store it in the cache
|
||||
* @param botGenerationDetails the bot details to generate the bot with
|
||||
* @param sessionId Session id
|
||||
* @param cacheKey the cache key to store the bot with
|
||||
* @returns A promise for the bot to be stored
|
||||
*/
|
||||
protected async generateSingleBotAndStoreInCache(
|
||||
botGenerationDetails: BotGenerationDetails,
|
||||
sessionId: string,
|
||||
cacheKey: string,
|
||||
): Promise<void>
|
||||
{
|
||||
const botToCache = this.botGenerator.prepareAndGenerateBot(sessionId, botGenerationDetails);
|
||||
this.botGenerationCacheService.storeBots(cacheKey, [botToCache]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,7 +310,7 @@ export class BotController
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[]
|
||||
protected async returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>
|
||||
{
|
||||
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
|
||||
const requestedBot = request.conditions[0];
|
||||
@ -334,18 +370,21 @@ export class BotController
|
||||
// Check cache for bot using above key
|
||||
if (!this.botGenerationCacheService.cacheHasBotOfRole(cacheKey))
|
||||
{
|
||||
const botPromises: Promise<void>[] = [];
|
||||
// No bot in cache, generate new and return one
|
||||
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
|
||||
{
|
||||
const botToCache = this.botGenerator.prepareAndGenerateBot(sessionId, botGenerationDetails);
|
||||
this.botGenerationCacheService.storeBots(cacheKey, [botToCache]);
|
||||
botPromises.push(this.generateSingleBotAndStoreInCache(botGenerationDetails, sessionId, cacheKey));
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
`Generated ${botGenerationDetails.botCountToGenerate} ${botGenerationDetails.role} (${
|
||||
botGenerationDetails.eventRole ?? ""
|
||||
}) ${botGenerationDetails.botDifficulty} bots`,
|
||||
);
|
||||
await Promise.all(botPromises).then(() =>
|
||||
{
|
||||
this.logger.debug(
|
||||
`Generated ${botGenerationDetails.botCountToGenerate} ${botGenerationDetails.role} (${
|
||||
botGenerationDetails.eventRole ?? ""
|
||||
}) ${botGenerationDetails.botDifficulty} bots`,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const desiredBot = this.botGenerationCacheService.getBot(cacheKey);
|
||||
|
@ -42,7 +42,7 @@ export class StaticRouter extends Router
|
||||
super();
|
||||
}
|
||||
|
||||
public handleStatic(url: string, info: any, sessionID: string, output: string): any
|
||||
public async handleStatic(url: string, info: any, sessionID: string, output: string): Promise<any>
|
||||
{
|
||||
return this.routes.find((route) => route.url === url).action(url, info, sessionID, output);
|
||||
}
|
||||
@ -60,7 +60,7 @@ export class DynamicRouter extends Router
|
||||
super();
|
||||
}
|
||||
|
||||
public handleDynamic(url: string, info: any, sessionID: string, output: string): any
|
||||
public async handleDynamic(url: string, info: any, sessionID: string, output: string): Promise<any>
|
||||
{
|
||||
return this.routes.find((r) => url.includes(r.url)).action(url, info, sessionID, output);
|
||||
}
|
||||
@ -75,13 +75,13 @@ export class DynamicRouter extends Router
|
||||
// So instead I added the definition
|
||||
export class ItemEventRouterDefinition extends Router
|
||||
{
|
||||
public handleItemEvent(
|
||||
public async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
output: IItemEventRouterResponse,
|
||||
): void
|
||||
): Promise<any>
|
||||
{
|
||||
throw new Error("This method needs to be overrode by the router classes");
|
||||
}
|
||||
@ -103,6 +103,9 @@ export class HandledRoute
|
||||
|
||||
export class RouteAction
|
||||
{
|
||||
constructor(public url: string, public action: (url: string, info: any, sessionID: string, output: string) => any)
|
||||
constructor(
|
||||
public url: string,
|
||||
public action: (url: string, info: any, sessionID: string, output: string) => Promise<any>,
|
||||
)
|
||||
{}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export class HttpRouter
|
||||
return map;
|
||||
}
|
||||
|
||||
public getResponse(req: IncomingMessage, info: any, sessionID: string): string
|
||||
public async getResponse(req: IncomingMessage, info: any, sessionID: string): Promise<string>
|
||||
{
|
||||
const wrapper: ResponseWrapper = new ResponseWrapper("");
|
||||
let url = req.url;
|
||||
@ -41,10 +41,10 @@ export class HttpRouter
|
||||
{
|
||||
url = url.split("?retry=")[0];
|
||||
}
|
||||
const handled = this.handleRoute(url, info, sessionID, wrapper, this.staticRouters, false);
|
||||
const handled = await this.handleRoute(url, info, sessionID, wrapper, this.staticRouters, false);
|
||||
if (!handled)
|
||||
{
|
||||
this.handleRoute(url, info, sessionID, wrapper, this.dynamicRoutes, true);
|
||||
await this.handleRoute(url, info, sessionID, wrapper, this.dynamicRoutes, true);
|
||||
}
|
||||
|
||||
// TODO: Temporary hack to change ItemEventRouter response sessionID binding to what client expects
|
||||
@ -56,14 +56,14 @@ export class HttpRouter
|
||||
return wrapper.output;
|
||||
}
|
||||
|
||||
protected handleRoute(
|
||||
protected async handleRoute(
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
wrapper: ResponseWrapper,
|
||||
routers: Router[],
|
||||
dynamic: boolean,
|
||||
): boolean
|
||||
): Promise<boolean>
|
||||
{
|
||||
let matched = false;
|
||||
for (const route of routers)
|
||||
@ -72,11 +72,11 @@ export class HttpRouter
|
||||
{
|
||||
if (dynamic)
|
||||
{
|
||||
wrapper.output = (route as DynamicRouter).handleDynamic(url, info, sessionID, wrapper.output);
|
||||
wrapper.output = await (route as DynamicRouter).handleDynamic(url, info, sessionID, wrapper.output);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrapper.output = (route as StaticRouter).handleStatic(url, info, sessionID, wrapper.output);
|
||||
wrapper.output = await (route as StaticRouter).handleStatic(url, info, sessionID, wrapper.output);
|
||||
}
|
||||
matched = true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export class ItemEventRouter
|
||||
* @param sessionID Session id
|
||||
* @returns Item response
|
||||
*/
|
||||
public handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse
|
||||
public async handleEvents(info: IItemEventRouterRequest, sessionID: string): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||
|
||||
@ -39,7 +39,7 @@ export class ItemEventRouter
|
||||
if (eventRouter)
|
||||
{
|
||||
this.logger.debug(`event: ${body.Action}`);
|
||||
eventRouter.handleItemEvent(body.Action, pmcData, body, sessionID, output);
|
||||
await eventRouter.handleItemEvent(body.Action, pmcData, body, sessionID, output);
|
||||
if (output.warnings.length > 0)
|
||||
{
|
||||
break;
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { BotCallbacks } from "@spt-aki/callbacks/BotCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { Difficulties } from "@spt-aki/models/eft/common/tables/IBotType";
|
||||
|
||||
@injectable()
|
||||
export class BotDynamicRouter extends DynamicRouter
|
||||
@ -11,35 +12,45 @@ export class BotDynamicRouter extends DynamicRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/bot/limit/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.botCallbacks.getBotLimit(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/bot/difficulty/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.botCallbacks.getBotDifficulty(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
<<<<<<< HEAD
|
||||
"/singleplayer/settings/bot/difficulties/",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<Record<string, Difficulties>> =>
|
||||
=======
|
||||
"/singleplayer/settings/bot/difficulties",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
>>>>>>> 3.9.0-DEV
|
||||
{
|
||||
return this.botCallbacks.getAllBotDifficulties(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/bot/maxCap",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.botCallbacks.getBotCap();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/bot/getBotBehaviours/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.botCallbacks.getBotBehaviours();
|
||||
},
|
||||
|
@ -9,10 +9,13 @@ export class BundleDynamicRouter extends DynamicRouter
|
||||
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction(".bundle", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.bundleCallbacks.getBundle(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
".bundle",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.bundleCallbacks.getBundle(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { ISuit } from "@spt-aki/models/eft/common/tables/ITrader";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class CustomizationDynamicRouter extends DynamicRouter
|
||||
@ -11,7 +13,12 @@ export class CustomizationDynamicRouter extends DynamicRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/trading/customization/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ISuit[]>> =>
|
||||
{
|
||||
return this.customizationCallbacks.getTraderSuits(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { DataCallbacks } from "@spt-aki/callbacks/DataCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { IGetItemPricesResponse } from "@spt-aki/models/eft/game/IGetItemPricesResponse";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class DataDynamicRouter extends DynamicRouter
|
||||
@ -9,18 +11,37 @@ export class DataDynamicRouter extends DynamicRouter
|
||||
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/menu/locale/", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/locale/", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/items/prices/", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getItemPrices(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/menu/locale/",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesMenu(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/locale/",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesGlobal(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/items/prices/",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetItemPricesResponse>> =>
|
||||
{
|
||||
return this.dataCallbacks.getItemPrices(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -9,18 +9,27 @@ export class HttpDynamicRouter extends DynamicRouter
|
||||
constructor(@inject("ImageRouter") protected imageRouter: ImageRouter)
|
||||
{
|
||||
super([
|
||||
new RouteAction(".jpg", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
}),
|
||||
new RouteAction(".png", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
}),
|
||||
new RouteAction(".ico", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
}),
|
||||
new RouteAction(
|
||||
".jpg",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
".png",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
".ico",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.imageRouter.getImage();
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { InraidCallbacks } from "@spt-aki/callbacks/InraidCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
|
||||
@injectable()
|
||||
export class InraidDynamicRouter extends DynamicRouter
|
||||
@ -11,14 +12,14 @@ export class InraidDynamicRouter extends DynamicRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/location/getLocalloot",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.inraidCallbacks.registerPlayer(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/traderServices/getTraderServices/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getTraderServices(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { LocationCallbacks } from "@spt-aki/callbacks/LocationCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class LocationDynamicRouter extends DynamicRouter
|
||||
@ -11,7 +13,12 @@ export class LocationDynamicRouter extends DynamicRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/location/getLocalloot",
|
||||
(url: string, info: any, sessionID: string, _output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
_output: string,
|
||||
): Promise<IGetBodyResponseData<ILocationBase>> =>
|
||||
{
|
||||
return this.locationCallbacks.getLocation(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { NotifierCallbacks } from "@spt-aki/callbacks/NotifierCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class NotifierDynamicRouter extends DynamicRouter
|
||||
@ -9,21 +10,40 @@ export class NotifierDynamicRouter extends DynamicRouter
|
||||
constructor(@inject("NotifierCallbacks") protected notifierCallbacks: NotifierCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/?last_id", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.notifierCallbacks.notify(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/notifierServer", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.notifierCallbacks.notify(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/push/notifier/get/", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.notifierCallbacks.getNotifier(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/?last_id",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.notifierCallbacks.notify(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/notifierServer",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.notifierCallbacks.notify(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/push/notifier/get/",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.notifierCallbacks.getNotifier(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/push/notifier/getwebsocket/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.notifierCallbacks.getNotifier(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { TraderCallbacks } from "@spt-aki/callbacks/TraderCallbacks";
|
||||
import { DynamicRouter, RouteAction } from "@spt-aki/di/Router";
|
||||
import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class TraderDynamicRouter extends DynamicRouter
|
||||
@ -11,14 +13,24 @@ export class TraderDynamicRouter extends DynamicRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/trading/api/getTrader/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ITraderBase>> =>
|
||||
{
|
||||
return this.traderCallbacks.getTrader(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/trading/api/getTraderAssort/",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ITraderAssort>> =>
|
||||
{
|
||||
return this.traderCallbacks.getAssort(url, info, sessionID);
|
||||
},
|
||||
|
@ -20,12 +20,12 @@ export class CustomizationItemEventRouter extends ItemEventRouterDefinition
|
||||
return [new HandledRoute("CustomizationWear", false), new HandledRoute("CustomizationBuy", false)];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -24,12 +24,12 @@ export class HealthItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -32,13 +32,13 @@ export class HideoutItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
output: IItemEventRouterResponse,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -20,12 +20,12 @@ export class InsuranceItemEventRouter extends ItemEventRouterDefinition
|
||||
return [new HandledRoute("Insure", false)];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -46,13 +46,13 @@ export class InventoryItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
output: IItemEventRouterResponse,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -25,12 +25,12 @@ export class NoteItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: INoteActionData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -27,12 +27,12 @@ export class QuestItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
eventAction: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
this.logger.debug(`${eventAction} ${body.qid}`);
|
||||
switch (eventAction)
|
||||
|
@ -22,12 +22,12 @@ export class RagfairItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -18,12 +18,12 @@ export class RepairItemEventRouter extends ItemEventRouterDefinition
|
||||
return [new HandledRoute("Repair", false), new HandledRoute("TraderRepair", false)];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -22,12 +22,12 @@ export class TradeItemEventRouter extends ItemEventRouterDefinition
|
||||
];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -18,12 +18,12 @@ export class WishlistItemEventRouter extends ItemEventRouterDefinition
|
||||
return [new HandledRoute("AddToWishList", false), new HandledRoute("RemoveFromWishList", false)];
|
||||
}
|
||||
|
||||
public override handleItemEvent(
|
||||
public override async handleItemEvent(
|
||||
url: string,
|
||||
pmcData: IPmcData,
|
||||
body: any,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
): Promise<IItemEventRouterResponse>
|
||||
{
|
||||
switch (url)
|
||||
{
|
||||
|
@ -2,6 +2,9 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { AchievementCallbacks } from "@spt-aki/callbacks/AchievementCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
|
||||
import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse";
|
||||
|
||||
@injectable()
|
||||
export class AchievementStaticRouter extends StaticRouter
|
||||
@ -12,7 +15,12 @@ export class AchievementStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/achievement/list",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetAchievementsResponse>> =>
|
||||
{
|
||||
return this.achievementCallbacks.getAchievements(url, info, sessionID);
|
||||
},
|
||||
@ -21,7 +29,12 @@ export class AchievementStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/achievement/statistic",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ICompletedAchievementsResponse>> =>
|
||||
{
|
||||
return this.achievementCallbacks.statistic(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { BotCallbacks } from "@spt-aki/callbacks/BotCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class BotStaticRouter extends StaticRouter
|
||||
@ -11,7 +13,12 @@ export class BotStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/game/bot/generate",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IBotBase[]>> =>
|
||||
{
|
||||
return this.botCallbacks.generateBots(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,9 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { BuildsCallbacks } from "@spt-aki/callbacks/BuildsCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
|
||||
|
||||
@injectable()
|
||||
export class BuildsStaticRouter extends StaticRouter
|
||||
@ -12,7 +15,12 @@ export class BuildsStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/builds/list",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IUserBuilds>> =>
|
||||
{
|
||||
return this.buildsCallbacks.getBuilds(url, info, sessionID);
|
||||
},
|
||||
@ -20,7 +28,7 @@ export class BuildsStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/builds/magazine/save",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.buildsCallbacks.createMagazineTemplate(url, info, sessionID);
|
||||
},
|
||||
@ -28,7 +36,7 @@ export class BuildsStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/builds/weapon/save",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.buildsCallbacks.setWeapon(url, info, sessionID);
|
||||
},
|
||||
@ -36,7 +44,7 @@ export class BuildsStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/builds/equipment/save",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.buildsCallbacks.setEquipment(url, info, sessionID);
|
||||
},
|
||||
@ -44,7 +52,7 @@ export class BuildsStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/builds/delete",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.buildsCallbacks.deleteBuild(url, info, sessionID);
|
||||
},
|
||||
|
@ -9,10 +9,13 @@ export class BundleStaticRouter extends StaticRouter
|
||||
constructor(@inject("BundleCallbacks") protected bundleCallbacks: BundleCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/singleplayer/bundles", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.bundleCallbacks.getBundles(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/singleplayer/bundles",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.bundleCallbacks.getBundles(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ClientLogCallbacks } from "@spt-aki/callbacks/ClientLogCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
|
||||
@injectable()
|
||||
export class ClientLogStaticRouter extends StaticRouter
|
||||
@ -9,17 +10,23 @@ export class ClientLogStaticRouter extends StaticRouter
|
||||
constructor(@inject("ClientLogCallbacks") protected clientLogCallbacks: ClientLogCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/singleplayer/log", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.clientLogCallbacks.clientLog(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/singleplayer/release", (url: string, info: any, sessionID: string, output: string) =>
|
||||
{
|
||||
return this.clientLogCallbacks.releaseNotes();
|
||||
}),
|
||||
new RouteAction(
|
||||
"/singleplayer/log",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.clientLogCallbacks.clientLog(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/release",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.clientLogCallbacks.releaseNotes();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/enableBSGlogging",
|
||||
(url: string, info: any, sessionID: string, output: string) =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.clientLogCallbacks.bsgLogging();
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { CustomizationCallbacks } from "@spt-aki/callbacks/CustomizationCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetSuitsResponse } from "@spt-aki/models/eft/customization/IGetSuitsResponse";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class CustomizationStaticRouter extends StaticRouter
|
||||
@ -11,7 +13,12 @@ export class CustomizationStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/trading/customization/storage",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetSuitsResponse>> =>
|
||||
{
|
||||
return this.customizationCallbacks.getSuits(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,15 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { DataCallbacks } from "@spt-aki/callbacks/DataCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGlobals } from "@spt-aki/models/eft/common/IGlobals";
|
||||
import { ICustomizationItem } from "@spt-aki/models/eft/common/tables/ICustomizationItem";
|
||||
import { IHandbookBase } from "@spt-aki/models/eft/common/tables/IHandbookBase";
|
||||
import { IHideoutArea } from "@spt-aki/models/eft/hideout/IHideoutArea";
|
||||
import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction";
|
||||
import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase";
|
||||
import { IHideoutSettingsBase } from "@spt-aki/models/eft/hideout/IHideoutSettingsBase";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { ISettingsBase } from "@spt-aki/models/spt/server/ISettingsBase";
|
||||
|
||||
@injectable()
|
||||
export class DataStaticRouter extends StaticRouter
|
||||
@ -9,68 +18,136 @@ export class DataStaticRouter extends StaticRouter
|
||||
constructor(@inject("DataCallbacks") protected dataCallbacks: DataCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/settings", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getSettings(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/globals", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getGlobals(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/items", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateItems(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/settings",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ISettingsBase>> =>
|
||||
{
|
||||
return this.dataCallbacks.getSettings(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/globals",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGlobals>> =>
|
||||
{
|
||||
return this.dataCallbacks.getGlobals(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/items",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateItems(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/handbook/templates",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IHandbookBase>> =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateHandbook(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/customization", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/customization",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<Record<string, ICustomizationItem>>> =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateSuits(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/account/customization",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string[]>> =>
|
||||
{
|
||||
return this.dataCallbacks.getTemplateCharacter(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/hideout/production/recipes",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IHideoutProduction[]>> =>
|
||||
{
|
||||
return this.dataCallbacks.gethideoutProduction(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/hideout/settings",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IHideoutSettingsBase>> =>
|
||||
{
|
||||
return this.dataCallbacks.getHideoutSettings(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/hideout/areas", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/hideout/areas",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IHideoutArea[]>> =>
|
||||
{
|
||||
return this.dataCallbacks.getHideoutAreas(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/hideout/production/scavcase/recipes",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IHideoutScavCase[]>> =>
|
||||
{
|
||||
return this.dataCallbacks.getHideoutScavcase(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/languages", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/languages",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<Record<string, string>>> =>
|
||||
{
|
||||
return this.dataCallbacks.getLocalesLanguages(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/hideout/qte/list",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.dataCallbacks.getQteList(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,14 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { DialogueCallbacks } from "@spt-aki/callbacks/DialogueCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer";
|
||||
import { IFriendRequestSendResponse } from "@spt-aki/models/eft/dialog/IFriendRequestSendResponse";
|
||||
import { IGetAllAttachmentsResponse } from "@spt-aki/models/eft/dialog/IGetAllAttachmentsResponse";
|
||||
import { IGetFriendListDataResponse } from "@spt-aki/models/eft/dialog/IGetFriendListDataResponse";
|
||||
import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetMailDialogViewResponseData";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
|
||||
|
||||
@injectable()
|
||||
export class DialogStaticRouter extends StaticRouter
|
||||
@ -11,138 +19,237 @@ export class DialogStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/chatServer/list",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IChatServer[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getChatServerList(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/list",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<DialogueInfo[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getMailDialogList(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/view",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetMailDialogViewResponseData>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getMailDialogView(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/info",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<DialogueInfo>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getMailDialogInfo(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/remove",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.removeDialog(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/pin",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.pinDialog(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/unpin",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.unpinDialog(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/read",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.setRead(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/remove",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.removeMail(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/getAllAttachments",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetAllAttachmentsResponse>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getAllAttachments(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/mail/msg/send", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dialogueCallbacks.sendMessage(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/mail/msg/send",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.sendMessage(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/mail/dialog/clear",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.clearMail(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/friend/list", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dialogueCallbacks.getFriendList(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/friend/list",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetFriendListDataResponse>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.getFriendList(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/request/list/outbox",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.listOutbox(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/request/list/inbox",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<any[]>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.listInbox(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/request/send",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IFriendRequestSendResponse>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/request/accept",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/request/cancel",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/friend/delete", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/friend/delete",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.dialogueCallbacks.deleteFriend(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/ignore/set",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.dialogueCallbacks.ignoreFriend(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/friend/ignore/remove",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.dialogueCallbacks.unIgnoreFriend(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,17 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { GameCallbacks } from "@spt-aki/callbacks/GameCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { ICheckVersionResponse } from "@spt-aki/models/eft/game/ICheckVersionResponse";
|
||||
import { ICurrentGroupResponse } from "@spt-aki/models/eft/game/ICurrentGroupResponse";
|
||||
import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse";
|
||||
import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse";
|
||||
import { IGameLogoutResponseData } from "@spt-aki/models/eft/game/IGameLogoutResponseData";
|
||||
import { IGameModeResponse } from "@spt-aki/models/eft/game/IGameModeResponse";
|
||||
import { IGameStartResponse } from "@spt-aki/models/eft/game/IGameStartResponse";
|
||||
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
|
||||
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
|
||||
@injectable()
|
||||
export class GameStaticRouter extends StaticRouter
|
||||
@ -9,61 +20,119 @@ export class GameStaticRouter extends StaticRouter
|
||||
constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/game/config", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.getGameConfig(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/game/mode", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.getGameMode(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.getServer(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/game/config",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGameConfigResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.getGameConfig(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/mode",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGameModeResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.getGameMode(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/server/list",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IServerDetails[]>> =>
|
||||
{
|
||||
return this.gameCallbacks.getServer(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/current",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ICurrentGroupResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.getCurrentGroup(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/version/validate",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.gameCallbacks.versionValidate(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/game/start", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.gameStart(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/game/logout", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.gameLogout(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/checkVersion", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/game/start",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGameStartResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.gameStart(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/logout",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGameLogoutResponseData>> =>
|
||||
{
|
||||
return this.gameCallbacks.gameLogout(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/checkVersion",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ICheckVersionResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/keepalive",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGameKeepAliveResponse>> =>
|
||||
{
|
||||
return this.gameCallbacks.gameKeepalive(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/version",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.gameCallbacks.getVersion(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/reports/lobby/send",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.gameCallbacks.reportNickname(url, info, sessionID);
|
||||
},
|
||||
@ -71,7 +140,7 @@ export class GameStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/getRaidTime",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<IGetRaidTimeResponse> =>
|
||||
{
|
||||
return this.gameCallbacks.getRaidTime(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { HealthCallbacks } from "@spt-aki/callbacks/HealthCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class HealthStaticRouter extends StaticRouter
|
||||
@ -9,13 +10,26 @@ export class HealthStaticRouter extends StaticRouter
|
||||
constructor(@inject("HealthCallbacks") protected healthCallbacks: HealthCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/player/health/sync", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.healthCallbacks.syncHealth(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/player/health/sync",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.healthCallbacks.syncHealth(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/hideout/workout",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.healthCallbacks.handleWorkoutEffects(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { InraidCallbacks } from "@spt-aki/callbacks/InraidCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
|
||||
@injectable()
|
||||
export class InraidStaticRouter extends StaticRouter
|
||||
@ -9,55 +10,58 @@ export class InraidStaticRouter extends StaticRouter
|
||||
constructor(@inject("InraidCallbacks") protected inraidCallbacks: InraidCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/raid/profile/save", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.inraidCallbacks.saveProgress(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/raid/profile/save",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.inraidCallbacks.saveProgress(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/raid/endstate",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getRaidEndState();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/settings/raid/menu",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getRaidMenuSettings();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/airdrop/config",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getAirdropConfig();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/btr/config",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getBTRConfig();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/traderServices/itemDelivery",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.inraidCallbacks.itemDelivery(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/scav/traitorscavhostile",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getTraitorScavHostileChance(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/sandbox/maxpatrol",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getSandboxMaxPatrolValue(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { InsuranceCallbacks } from "@spt-aki/callbacks/InsuranceCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData";
|
||||
|
||||
@injectable()
|
||||
export class InsuranceStaticRouter extends StaticRouter
|
||||
@ -11,7 +13,12 @@ export class InsuranceStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/insurance/items/list/cost",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetInsuranceCostResponseData>> =>
|
||||
{
|
||||
return this.insuranceCallbacks.getInsuranceCost(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ItemEventCallbacks } from "@spt-aki/callbacks/ItemEventCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
|
||||
@injectable()
|
||||
export class ItemEventStaticRouter extends StaticRouter
|
||||
@ -11,7 +13,12 @@ export class ItemEventStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/game/profile/items/moving",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IItemEventRouterResponse>> =>
|
||||
{
|
||||
return this.itemEventCallbacks.handleEvents(url, info, sessionID);
|
||||
},
|
||||
|
@ -9,87 +9,93 @@ export class LauncherStaticRouter extends StaticRouter
|
||||
constructor(@inject("LauncherCallbacks") protected launcherCallbacks: LauncherCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/launcher/ping", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.launcherCallbacks.ping(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/launcher/ping",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.ping(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/server/connect",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.connect();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/login",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.login(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/register",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.register(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/launcher/profile/get", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.launcherCallbacks.get(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/launcher/profile/get",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.get(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/change/username",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.changeUsername(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/change/password",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.changePassword(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/change/wipe",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.wipe(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/remove",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.removeProfile(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/compatibleTarkovVersion",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.getCompatibleTarkovVersion();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/server/version",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.getServerVersion();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/server/loadedServerMods",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.getLoadedServerMods();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/server/serverModsUsedByProfile",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.launcherCallbacks.getServerModsProfileUsed(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { LocationCallbacks } from "@spt-aki/callbacks/LocationCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { ILocationsGenerateAllResponse } from "@spt-aki/models/eft/common/ILocationsSourceDestinationBase";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class LocationStaticRouter extends StaticRouter
|
||||
@ -9,13 +11,21 @@ export class LocationStaticRouter extends StaticRouter
|
||||
constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/locations", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.locationCallbacks.getLocationData(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/locations",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ILocationsGenerateAllResponse>> =>
|
||||
{
|
||||
return this.locationCallbacks.getLocationData(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/location/getAirdropLoot",
|
||||
(url: string, info: any, sessionID: string, _output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, _output: string): Promise<string> =>
|
||||
{
|
||||
return this.locationCallbacks.getAirdropLoot(url, info, sessionID);
|
||||
},
|
||||
|
@ -3,6 +3,11 @@ import { inject, injectable } from "tsyringe";
|
||||
import { MatchCallbacks } from "@spt-aki/callbacks/MatchCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
|
||||
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
|
||||
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
|
||||
|
||||
@injectable()
|
||||
export class MatchStaticRouter extends StaticRouter
|
||||
@ -12,138 +17,202 @@ export class MatchStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/match/available",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.matchCallbacks.serverAvailable(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/updatePing",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.updatePing(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/match/join", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.matchCallbacks.joinMatch(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction("/client/match/exit", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.matchCallbacks.exitMatch(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/match/join",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
|
||||
{
|
||||
return this.matchCallbacks.joinMatch(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/exit",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.exitMatch(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/delete",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.deleteGroup(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/leave",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.matchCallbacks.leaveGroup(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/status",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetGroupStatusResponse>> =>
|
||||
{
|
||||
return this.matchCallbacks.getGroupStatus(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/start_game",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
|
||||
{
|
||||
return this.matchCallbacks.joinMatch(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/exit_from_menu",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.exitToMenu(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/looking/start",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.startGroupSearch(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/looking/stop",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.stopGroupSearch(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/invite/send",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.matchCallbacks.sendGroupInvite(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/invite/accept",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IAcceptGroupInviteResponse[]>> =>
|
||||
{
|
||||
return this.matchCallbacks.acceptGroupInvite(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/invite/decline",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<IGetBodyResponseData<any>> =>
|
||||
{
|
||||
return this.matchCallbacks.declineGroupInvite(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/invite/cancel",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.matchCallbacks.cancelGroupInvite(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/invite/cancel-all",
|
||||
(url: string, info: IEmptyRequestData, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/transfer",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<boolean>> =>
|
||||
{
|
||||
return this.matchCallbacks.transferGroup(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/offline/end",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.endOfflineRaid(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/client/putMetrics", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.matchCallbacks.putMetrics(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/putMetrics",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.putMetrics(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/getMetricsConfig",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.matchCallbacks.getMetrics(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/raid/configuration",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.getRaidConfiguration(url, info, sessionID);
|
||||
},
|
||||
@ -151,14 +220,14 @@ export class MatchStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/raid/configuration-by-profile",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.getConfigurationByProfile(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/match/group/player/remove",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,9 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { NotifierCallbacks } from "@spt-aki/callbacks/NotifierCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INotifierChannel } from "@spt-aki/models/eft/notifier/INotifier";
|
||||
import { ISelectProfileResponse } from "@spt-aki/models/eft/notifier/ISelectProfileResponse";
|
||||
|
||||
@injectable()
|
||||
export class NotifierStaticRouter extends StaticRouter
|
||||
@ -11,14 +14,24 @@ export class NotifierStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/notifier/channel/create",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<INotifierChannel>> =>
|
||||
{
|
||||
return this.notifierCallbacks.createNotifierChannel(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/select",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ISelectProfileResponse>> =>
|
||||
{
|
||||
return this.notifierCallbacks.selectProfile(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,13 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ProfileCallbacks } from "@spt-aki/callbacks/ProfileCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
|
||||
import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse";
|
||||
import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse";
|
||||
import { ISearchFriendResponse } from "@spt-aki/models/eft/profile/ISearchFriendResponse";
|
||||
|
||||
@injectable()
|
||||
export class ProfileStaticRouter extends StaticRouter
|
||||
@ -11,56 +18,81 @@ export class ProfileStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/game/profile/create",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ICreateProfileResponse>> =>
|
||||
{
|
||||
return this.profileCallbacks.createProfile(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/list",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IPmcData[]>> =>
|
||||
{
|
||||
return this.profileCallbacks.getProfileData(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/savage/regenerate",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IPmcData[]>> =>
|
||||
{
|
||||
return this.profileCallbacks.regenerateScav(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/voice/change",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.profileCallbacks.changeVoice(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/nickname/change",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<IGetBodyResponseData<any>> =>
|
||||
{
|
||||
return this.profileCallbacks.changeNickname(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/nickname/validate",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<IGetBodyResponseData<any>> =>
|
||||
{
|
||||
return this.profileCallbacks.validateNickname(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/nickname/reserved",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.profileCallbacks.getReservedNickname(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/profile/status",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<GetProfileStatusResponseData>> =>
|
||||
{
|
||||
return this.profileCallbacks.getProfileStatus(url, info, sessionID);
|
||||
},
|
||||
@ -68,36 +100,54 @@ export class ProfileStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/profile/view",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetOtherProfileResponse>> =>
|
||||
{
|
||||
return this.profileCallbacks.getOtherProfile(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/profile/settings",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<string>> =>
|
||||
{
|
||||
return this.profileCallbacks.getProfileSettings(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/game/profile/search",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ISearchFriendResponse[]>> =>
|
||||
{
|
||||
return this.profileCallbacks.searchFriend(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/launcher/profile/info",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.profileCallbacks.getMiniProfile(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction("/launcher/profiles", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/launcher/profiles",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.profileCallbacks.getAllMiniProfiles(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { QuestCallbacks } from "@spt-aki/callbacks/QuestCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest";
|
||||
import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class QuestStaticRouter extends StaticRouter
|
||||
@ -9,13 +12,26 @@ export class QuestStaticRouter extends StaticRouter
|
||||
constructor(@inject("QuestCallbacks") protected questCallbacks: QuestCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/quest/list", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.questCallbacks.listQuests(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/quest/list",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IQuest[]>> =>
|
||||
{
|
||||
return this.questCallbacks.listQuests(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/client/repeatalbeQuests/activityPeriods",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IPmcDataRepeatableQuest[]>> =>
|
||||
{
|
||||
return this.questCallbacks.activityPeriods(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,11 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { RagfairCallbacks } from "@spt-aki/callbacks/RagfairCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
|
||||
import { IGetItemPriceResult } from "@spt-aki/models/eft/ragfair/IGetItemPriceResult";
|
||||
import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult";
|
||||
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
|
||||
|
||||
@injectable()
|
||||
export class RagfairStaticRouter extends StaticRouter
|
||||
@ -12,7 +17,12 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/ragfair/search",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetOffersResult>> =>
|
||||
{
|
||||
return this.ragfairCallbacks.search(url, info, sessionID);
|
||||
},
|
||||
@ -20,7 +30,12 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/ragfair/find",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetOffersResult>> =>
|
||||
{
|
||||
return this.ragfairCallbacks.search(url, info, sessionID);
|
||||
},
|
||||
@ -28,7 +43,12 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/ragfair/itemMarketPrice",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IGetItemPriceResult>> =>
|
||||
{
|
||||
return this.ragfairCallbacks.getMarketPrice(url, info, sessionID);
|
||||
},
|
||||
@ -36,7 +56,7 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/ragfair/offerfees",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.ragfairCallbacks.storePlayerOfferTaxAmount(url, info, sessionID);
|
||||
},
|
||||
@ -44,7 +64,7 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/reports/ragfair/send",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.ragfairCallbacks.sendReport(url, info, sessionID);
|
||||
},
|
||||
@ -52,7 +72,12 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/items/prices",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<Record<string, number>>> =>
|
||||
{
|
||||
return this.ragfairCallbacks.getFleaPrices(url, info, sessionID);
|
||||
},
|
||||
@ -60,7 +85,12 @@ export class RagfairStaticRouter extends StaticRouter
|
||||
new RouteAction(
|
||||
"/client/ragfair/offer/findbyid",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IRagfairOffer>> =>
|
||||
{
|
||||
return this.ragfairCallbacks.getFleaOfferById(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { TraderCallbacks } from "@spt-aki/callbacks/TraderCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
|
||||
@injectable()
|
||||
export class TraderStaticRouter extends StaticRouter
|
||||
@ -11,7 +13,12 @@ export class TraderStaticRouter extends StaticRouter
|
||||
super([
|
||||
new RouteAction(
|
||||
"/client/trading/api/traderSettings",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<ITraderBase[]>> =>
|
||||
{
|
||||
return this.traderCallbacks.getTraderSettings(url, info, sessionID);
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { WeatherCallbacks } from "@spt-aki/callbacks/WeatherCallbacks";
|
||||
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
|
||||
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { IWeatherData } from "@spt-aki/models/eft/weather/IWeatherData";
|
||||
|
||||
@injectable()
|
||||
export class WeatherStaticRouter extends StaticRouter
|
||||
@ -9,10 +11,18 @@ export class WeatherStaticRouter extends StaticRouter
|
||||
constructor(@inject("WeatherCallbacks") protected weatherCallbacks: WeatherCallbacks)
|
||||
{
|
||||
super([
|
||||
new RouteAction("/client/weather", (url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.weatherCallbacks.getWeather(url, info, sessionID);
|
||||
}),
|
||||
new RouteAction(
|
||||
"/client/weather",
|
||||
async (
|
||||
url: string,
|
||||
info: any,
|
||||
sessionID: string,
|
||||
output: string,
|
||||
): Promise<IGetBodyResponseData<IWeatherData>> =>
|
||||
{
|
||||
return this.weatherCallbacks.getWeather(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ export class AkiHttpListener implements IHttpListener
|
||||
return ["GET", "PUT", "POST"].includes(req.method);
|
||||
}
|
||||
|
||||
public handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void
|
||||
public async handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>
|
||||
{
|
||||
switch (req.method)
|
||||
{
|
||||
case "GET":
|
||||
{
|
||||
const response = this.getResponse(sessionId, req, null);
|
||||
const response = await this.getResponse(sessionId, req, null);
|
||||
this.sendResponse(sessionId, req, resp, null, response);
|
||||
break;
|
||||
}
|
||||
@ -58,7 +58,7 @@ export class AkiHttpListener implements IHttpListener
|
||||
written += data.length;
|
||||
});
|
||||
|
||||
req.on("end", () =>
|
||||
req.on("end", async () =>
|
||||
{
|
||||
// Contrary to reasonable expectations, the content-encoding is _not_ actually used to
|
||||
// determine if the payload is compressed. All PUT requests are, and POST requests without
|
||||
@ -73,7 +73,7 @@ export class AkiHttpListener implements IHttpListener
|
||||
this.logger.debug(value.toString(), true);
|
||||
}
|
||||
|
||||
const response = this.getResponse(sessionId, req, value);
|
||||
const response = await this.getResponse(sessionId, req, value);
|
||||
this.sendResponse(sessionId, req, resp, value, response);
|
||||
});
|
||||
|
||||
@ -136,7 +136,7 @@ export class AkiHttpListener implements IHttpListener
|
||||
}
|
||||
}
|
||||
|
||||
public getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string
|
||||
public async getResponse(sessionID: string, req: IncomingMessage, body: Buffer): Promise<string>
|
||||
{
|
||||
const info = this.getBodyInfo(body, req.url);
|
||||
if (globalThis.G_LOG_REQUESTS)
|
||||
@ -148,7 +148,7 @@ export class AkiHttpListener implements IHttpListener
|
||||
this.requestsLogger.info(`REQUEST=${this.jsonUtil.serialize(log)}`);
|
||||
}
|
||||
|
||||
let output = this.httpRouter.getResponse(req, info, sessionID);
|
||||
let output = await this.httpRouter.getResponse(req, info, sessionID);
|
||||
/* route doesn't exist or response is not properly set up */
|
||||
if (!output)
|
||||
{
|
||||
|
@ -3,5 +3,5 @@ import { IncomingMessage, ServerResponse } from "node:http";
|
||||
export interface IHttpListener
|
||||
{
|
||||
canHandle(sessionId: string, req: IncomingMessage): boolean;
|
||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
|
||||
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export class HttpListenerMod implements IHttpListener
|
||||
return this.canHandleOverride(sessionId, req);
|
||||
}
|
||||
|
||||
public handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void
|
||||
public async handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>
|
||||
{
|
||||
this.handleOverride(sessionId, req, resp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user