Skip to content

Commit

Permalink
add GetLauncherClientConfig route for XLCore
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Mar 9, 2024
1 parent f22f265 commit fd00aee
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions XLWebServices/Controllers/LauncherController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum LeaseFeatureFlags
{
None = 0,
GlobalDisableDalamud = 1,
GlobalDisableLogin = 1 << 1,
ForceProxyDalamudAndAssets = 1 << 1,
}

public class Lease
Expand Down Expand Up @@ -166,8 +166,8 @@ public async Task<IActionResult> 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)
{
Expand All @@ -187,6 +187,32 @@ public async Task<IActionResult> 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<IActionResult> 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<IActionResult> GetFile(string file)
{
Expand Down

0 comments on commit fd00aee

Please sign in to comment.