using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.DI.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Routers.Static; using SPTarkov.Server.Core.Utils; namespace PersonalAuthMod; [Injectable(TypePriority = OnLoadOrder.PostSptModLoader + 100)] public class AuthRouter : StaticRouter { public AuthRouter( JsonUtil jsonUtil, LauncherCallbacks launcherCallbacks, ProfileCallbacks profileCallbacks, DatabaseManager dbManager ) : base(jsonUtil, [ // Get Profile (Filter / Validate) new RouteAction( "/launcher/profile/get", async (url, info, sessionID, _) => { // Rely on native SPT memory session validation via launcherCallbacks. // We enforce authentication separately at the /login endpoint. return await launcherCallbacks.Get(url, info, sessionID); } ), // Remove Profile (Protect) new RouteAction( "/launcher/profile/remove", async (url, info, sessionID, _) => { return await launcherCallbacks.RemoveProfile(url, info, sessionID); } ) ]) { } }