Implement IRelease interface, add new route action and data to core.json (!249)

This will need merged with: https://dev.sp-tarkov.com/SPT-AKI/Modules/pulls/90

Added
- IRelease interface
- betaDisclaimer: Beta text to be shown in the client
- betaDisclaimerTimeoutDelay: delay before the client exits if `OK` isnt pressed
- releaseSummary: a place to add release notes shown on first run, or if version has changed.

- new route for the client to request beta and changelog information

Im not the most familiar with the server, so if any of this needs moved to a different class or a new class made for it, ping me and let me know and I'll adjust it accordingly.

Co-authored-by: Cj <161484149+CJ-SPT@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/249
Co-authored-by: Cj <cj@noreply.dev.sp-tarkov.com>
Co-committed-by: Cj <cj@noreply.dev.sp-tarkov.com>
This commit is contained in:
Cj 2024-03-07 18:16:55 +00:00 committed by chomp
parent b79fc89d11
commit d4ee8f64d4
5 changed files with 41 additions and 1 deletions

View File

@ -5,6 +5,10 @@
"serverName": "SPT Server", "serverName": "SPT Server",
"profileSaveIntervalSeconds": 15, "profileSaveIntervalSeconds": 15,
"sptFriendNickname": "SPT", "sptFriendNickname": "SPT",
"release": {
"isBeta": true,
"betaDisclaimerTimeoutDelay": 30
},
"fixes": { "fixes": {
"fixShotgunDispersion": true, "fixShotgunDispersion": true,
"removeModItemsFromProfile": false, "removeModItemsFromProfile": false,

View File

@ -597,5 +597,7 @@
"launcher-profile_spteasystart": "Lots of Roubles/Dollars/Euros, Some QoL skills are level 20, trader rep maxed, starting level is 15, no quests completed", "launcher-profile_spteasystart": "Lots of Roubles/Dollars/Euros, Some QoL skills are level 20, trader rep maxed, starting level is 15, no quests completed",
"launcher-profile_sptzerotohero": "Start with almost nothing, no Roubles/Dollars/Euros, no trader rep, 1 knife, no quests completed", "launcher-profile_sptzerotohero": "Start with almost nothing, no Roubles/Dollars/Euros, no trader rep, 1 knife, no quests completed",
"launcher-profile_sptdeveloper": "Testing profile, starting level is 69, lots of Roubles/Dollars/Euros, USEC start with all quests ready to start, BEAR start with all quests ready to hand in, invincibility balaclava", "launcher-profile_sptdeveloper": "Testing profile, starting level is 69, lots of Roubles/Dollars/Euros, USEC start with all quests ready to start, BEAR start with all quests ready to hand in, invincibility balaclava",
"launcher-missing_property": "Profile: %s is missing a descriptionLocaleKey property" "launcher-missing_property": "Profile: %s is missing a descriptionLocaleKey property",
"beta-disclaimer": "By pressing OK you agree that no support is offered and that this is for bug testing only. NOT actual gameplay. Mods are disabled. New profiles may be required frequently. Report all bugs in the reports channel in discord, or on the issues page on the website. If you don't press OK by the time specified, the game will close.",
"release-summary": ""
} }

View File

@ -1,6 +1,10 @@
import { ClientLogController } from "@spt-aki/controllers/ClientLogController"; import { ClientLogController } from "@spt-aki/controllers/ClientLogController";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { ICoreConfig, IRelease } from "@spt-aki/models/spt/config/ICoreConfig";
import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest"; import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
@ -11,6 +15,8 @@ export class ClientLogCallbacks
constructor( constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("ClientLogController") protected clientLogController: ClientLogController, @inject("ClientLogController") protected clientLogController: ClientLogController,
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("LocalisationService") protected localisationService: LocalisationService,
) )
{} {}
@ -22,4 +28,15 @@ export class ClientLogCallbacks
this.clientLogController.clientLog(info); this.clientLogController.clientLog(info);
return this.httpResponse.nullResponse(); return this.httpResponse.nullResponse();
} }
/**
* Handle /singleplayer/release
*/
public releaseNotes(): string
{
const data: IRelease = this.configServer.getConfig<ICoreConfig>(ConfigTypes.CORE).release;
data.betaDisclaimer = this.localisationService.getText("beta-disclaimer");
data.releaseSummary = this.localisationService.getText("release-summary");
return this.httpResponse.noBody(data);
}
} }

View File

@ -9,6 +9,7 @@ export interface ICoreConfig extends IBaseConfig
serverName: string; serverName: string;
profileSaveIntervalSeconds: number; profileSaveIntervalSeconds: number;
sptFriendNickname: string; sptFriendNickname: string;
release: IRelease;
fixes: IGameFixes; fixes: IGameFixes;
features: IServerFeatures; features: IServerFeatures;
/** Commit hash build server was created from */ /** Commit hash build server was created from */
@ -17,6 +18,18 @@ export interface ICoreConfig extends IBaseConfig
buildTime?: string; buildTime?: string;
} }
export interface IRelease
{
// Enables the cool watermark in-game
isBeta: boolean;
// Disclaimer outlining the intended usage of bleeding edge
betaDisclaimer?: string;
// How long before the messagebox times out and closes the game
betaDisclaimerTimeoutDelay: number;
// Summary of release changes
releaseSummary?: string;
}
export interface IGameFixes export interface IGameFixes
{ {
/** Shotguns use a different value than normal guns causing huge pellet dispersion */ /** Shotguns use a different value than normal guns causing huge pellet dispersion */

View File

@ -13,6 +13,10 @@ export class ClientLogStaticRouter extends StaticRouter
{ {
return this.clientLogCallbacks.clientLog(url, info, sessionID); return this.clientLogCallbacks.clientLog(url, info, sessionID);
}), }),
new RouteAction("/singleplayer/release", (url: string, info: any, sessionID: string, output: string) =>
{
return this.clientLogCallbacks.releaseNotes();
}),
]); ]);
} }
} }