From fd00aee25330f6708d710de56f20054307180bb5 Mon Sep 17 00:00:00 2001 From: goat Date: Sat, 9 Mar 2024 18:11:13 +0100 Subject: [PATCH] add GetLauncherClientConfig route for XLCore --- .../Controllers/LauncherController.cs | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/XLWebServices/Controllers/LauncherController.cs b/XLWebServices/Controllers/LauncherController.cs index f2fd93f..a954d89 100644 --- a/XLWebServices/Controllers/LauncherController.cs +++ b/XLWebServices/Controllers/LauncherController.cs @@ -57,7 +57,7 @@ public enum LeaseFeatureFlags { None = 0, GlobalDisableDalamud = 1, - GlobalDisableLogin = 1 << 1, + ForceProxyDalamudAndAssets = 1 << 1, } public class Lease @@ -166,8 +166,8 @@ public async Task GetLease() if (_configuration["LauncherClientConfig:GlobalDisableDalamud"]?.ToLower() == "true") lease.Flags |= LeaseFeatureFlags.GlobalDisableDalamud; - if (_configuration["LauncherClientConfig:GlobalDisableLogin"]?.ToLower() == "true") - lease.Flags |= LeaseFeatureFlags.GlobalDisableLogin; + if (_configuration["LauncherClientConfig:ForceProxyDalamudAndAssets"]?.ToLower() == "true") + lease.Flags |= LeaseFeatureFlags.ForceProxyDalamudAndAssets; switch (track) { @@ -187,6 +187,32 @@ public async Task GetLease() return new JsonResult(lease); } + public class LauncherClientConfig + { + public string FrontierUrl { get; set; } + + public string? CutOffBootver { get; set; } + + public LeaseFeatureFlags Flags { get; set; } + } + + [HttpGet] + public async Task GetLauncherClientConfig() + { + var config = new LauncherClientConfig(); + config.FrontierUrl = _configuration["LauncherClientConfig:FrontierUrl"] ?? throw new Exception("No frontier URL in config!"); + config.CutOffBootver = _configuration["LauncherClientConfig:CutOffBootVer"]; + config.Flags = LeaseFeatureFlags.None; + + if (_configuration["LauncherClientConfig:GlobalDisableDalamud"]?.ToLower() == "true") + config.Flags |= LeaseFeatureFlags.GlobalDisableDalamud; + + if (_configuration["LauncherClientConfig:ForceProxyDalamudAndAssets"]?.ToLower() == "true") + config.Flags |= LeaseFeatureFlags.ForceProxyDalamudAndAssets; + + return new JsonResult(config); + } + [HttpGet("{file}")] public async Task GetFile(string file) {