make launcherV2 endpoints consistent, add new profile endpoint

This commit is contained in:
CWX
2025-02-14 17:12:09 +00:00
parent bff815e4b9
commit 2a172a6861
4 changed files with 36 additions and 3 deletions
@@ -109,4 +109,14 @@ public class LauncherV2Callbacks(
}
);
}
public object Profile(string? sessionId)
{
return _httpResponseUtil.NoBody(
new LauncherV2ProfileResponse
{
Response = _launcherV2Controller.GetProfile(sessionId)
}
);
}
}
@@ -1,5 +1,6 @@
using Core.Models.Eft.Common.Tables;
using Core.Models.Eft.Launcher;
using Core.Models.Eft.Profile;
using Core.Models.Spt.Config;
using Core.Models.Spt.Mod;
using Core.Models.Utils;
@@ -207,4 +208,9 @@ public class LauncherV2Controller(
return null;
}
public SptProfile GetProfile(string? sessionId)
{
return _saveServer.GetProfile(sessionId);
}
}
@@ -0,0 +1,13 @@
using Core.Models.Eft.Profile;
using Core.Models.Utils;
namespace Core.Models.Spt.Launcher;
public class LauncherV2ProfileResponse : IRequestData
{
public SptProfile Response
{
get;
set;
}
}
@@ -21,12 +21,12 @@ public class LauncherV2StaticRouter : StaticRouter
(url, _, sessionID, _) => launcherV2Callbacks.Types()
),
new RouteAction(
"/launcher/v2/Login",
"/launcher/v2/login",
(url, info, sessionID, _) => launcherV2Callbacks.Login(info as LoginRequestData),
typeof(LoginRequestData)
),
new RouteAction(
"/launcher/v2/Register",
"/launcher/v2/register",
(url, info, sessionID, _) => launcherV2Callbacks.Register(info as RegisterData),
typeof(RegisterData)
),
@@ -36,7 +36,7 @@ public class LauncherV2StaticRouter : StaticRouter
typeof(ChangeRequestData)
),
new RouteAction(
"/launcher/v2/Remove",
"/launcher/v2/remove",
(url, info, sessionID, _) => launcherV2Callbacks.Remove(info as LoginRequestData),
typeof(LoginRequestData)
),
@@ -51,6 +51,10 @@ public class LauncherV2StaticRouter : StaticRouter
new RouteAction(
"/launcher/v2/profiles",
(url, _, sessionID, _) => launcherV2Callbacks.Profiles()
),
new RouteAction(
"/launcher/v2/profile",
(url, _, sessionID, _) => launcherV2Callbacks.Profile(sessionID)
)
]
)