Update Profile v2 endpoint to use miniprofile and allow v2 endpoint to get miniprofile from only loginrequest

This commit is contained in:
CWX
2025-09-19 18:46:05 +01:00
parent 1bc3ef63f4
commit ca28cb2926
5 changed files with 17 additions and 7 deletions
@@ -92,10 +92,10 @@ public class LauncherV2Callbacks(
);
}
public ValueTask<string> Profile(MongoId sessionId)
public ValueTask<string> Profile(LoginRequestData sessionId)
{
return new ValueTask<string>(
httpResponseUtil.NoBody(new LauncherV2ProfileResponse { Response = launcherV2Controller.GetProfile(sessionId) })
httpResponseUtil.NoBody(new LauncherV2ProfileResponse { Response = launcherV2Controller.GetMiniProfileFromUsername(sessionId) })
);
}
}
@@ -19,7 +19,8 @@ public class LauncherV2Controller(
DatabaseService databaseService,
ServerLocalisationService serverLocalisationService,
ConfigServer configServer,
Watermark watermark
Watermark watermark,
ProfileController profileController
)
{
protected readonly CoreConfig CoreConfig = configServer.GetConfig<CoreConfig>();
@@ -192,4 +193,9 @@ public class LauncherV2Controller(
{
return saveServer.GetProfile(sessionId);
}
public MiniProfile? GetMiniProfileFromUsername(LoginRequestData info)
{
return profileController.GetMiniProfile(GetSessionId(info));
}
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Eft.Launcher;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Models.Spt.Launcher;
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Eft.Launcher;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Utils;
@@ -6,5 +7,5 @@ namespace SPTarkov.Server.Core.Models.Spt.Launcher;
public class LauncherV2ProfileResponse : IRequestData
{
public SptProfile Response { get; set; }
public MiniProfile Response { get; set; }
}
@@ -39,9 +39,11 @@ public class LauncherV2StaticRouter(LauncherV2Callbacks launcherV2Callbacks, Jso
"/launcher/v2/profiles",
async (url, _, sessionID, _) => await launcherV2Callbacks.Profiles()
),
new RouteAction<EmptyRequestData>(
new RouteAction<LoginRequestData>(
"/launcher/v2/profile",
async (url, _, sessionID, _) => await launcherV2Callbacks.Profile(sessionID)
async (url, info, sessionID, _) => await launcherV2Callbacks.Profile(info)
),
]
) { }
)
{
}