mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-01 09:48:37 +00:00
Implement refresh autodiscover (#1091)
* Implement refresh autodiscover * Make record fields required * Implement checking for the Patchwork user agent (#1090) * Implement checking for the Patchwork user agent, move logout into standalone method * Quick fixes (awesome name) * 403 user at login instead of logging out at /announce * Move configuration and revert logout changes * Rework parsing to check against GameVersion enum and game token GameVersion * Fix logic error oopsie * Fix Zaprit suggestions * Simplify patchwork game version test * Test patchwork user agent with regex instead * Fix Qodana warnings * Fix remaining Qodana warnings * Implement refresh autodiscover * Make record fields required * Update ProjectLighthouse.Servers.Website/Controllers/AutoDiscoverController.cs Co-authored-by: Josh <josh@slendy.pw> --------- Co-authored-by: FeTetra <166051662+FeTetra@users.noreply.github.com> Co-authored-by: Josh <josh@slendy.pw>
This commit is contained in:
parent
aeba706391
commit
9258469a1d
4 changed files with 48 additions and 1 deletions
|
@ -0,0 +1,26 @@
|
||||||
|
using LBPUnion.ProjectLighthouse.Configuration;
|
||||||
|
using LBPUnion.ProjectLighthouse.Servers.Website.Types;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
public class AutoDiscoverController: ControllerBase
|
||||||
|
{
|
||||||
|
[ResponseCache(Duration = 86400)]
|
||||||
|
[HttpGet("autodiscover")]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public IActionResult AutoDiscover()
|
||||||
|
{
|
||||||
|
AutoDiscoverResponse resp = new()
|
||||||
|
{
|
||||||
|
Version = 3,
|
||||||
|
Url = ServerConfiguration.Instance.GameApiExternalUrl,
|
||||||
|
ServerBrand = ServerConfiguration.Instance.Customization.ServerName,
|
||||||
|
UsesCustomDigestKey = false,
|
||||||
|
BannerImageUrl = null,
|
||||||
|
ServerDescription = ServerConfiguration.Instance.Customization.ServerDescription,
|
||||||
|
};
|
||||||
|
return this.Ok(resp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Types;
|
||||||
|
|
||||||
|
public record AutoDiscoverResponse
|
||||||
|
{
|
||||||
|
[JsonProperty("version")]
|
||||||
|
public required uint Version { get; set; }
|
||||||
|
[JsonProperty("serverBrand")]
|
||||||
|
public required string ServerBrand { get; set; }
|
||||||
|
[JsonProperty("serverDescription")]
|
||||||
|
public required string ServerDescription { get; set; }
|
||||||
|
[JsonProperty("url")]
|
||||||
|
public required string Url { get; set; }
|
||||||
|
[JsonProperty("bannerImageUrl")]
|
||||||
|
public string? BannerImageUrl { get; set; }
|
||||||
|
[JsonProperty("usesCustomDigestKey")]
|
||||||
|
public required bool UsesCustomDigestKey { get; set; }
|
||||||
|
}
|
|
@ -4,4 +4,5 @@ public class CustomizationConfiguration
|
||||||
{
|
{
|
||||||
public string ServerName { get; set; } = "Project Lighthouse";
|
public string ServerName { get; set; } = "Project Lighthouse";
|
||||||
public string EnvironmentName { get; set; } = "project-lighthouse";
|
public string EnvironmentName { get; set; } = "project-lighthouse";
|
||||||
|
public string ServerDescription { get; set; } = "A Project Lighthouse Server";
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ public class ServerConfiguration : ConfigurationBase<ServerConfiguration>
|
||||||
// This is so Lighthouse can properly identify outdated configurations and update them with newer settings accordingly.
|
// This is so Lighthouse can properly identify outdated configurations and update them with newer settings accordingly.
|
||||||
// If you are modifying anything here, this value MUST be incremented.
|
// If you are modifying anything here, this value MUST be incremented.
|
||||||
// Thanks for listening~
|
// Thanks for listening~
|
||||||
public override int ConfigVersion { get; set; } = 30;
|
public override int ConfigVersion { get; set; } = 31;
|
||||||
|
|
||||||
public override string ConfigName { get; set; } = "lighthouse.yml";
|
public override string ConfigName { get; set; } = "lighthouse.yml";
|
||||||
public string WebsiteListenUrl { get; set; } = "http://localhost:10060";
|
public string WebsiteListenUrl { get; set; } = "http://localhost:10060";
|
||||||
|
@ -31,6 +31,7 @@ public class ServerConfiguration : ConfigurationBase<ServerConfiguration>
|
||||||
public bool CheckForUnsafeFiles { get; set; } = true;
|
public bool CheckForUnsafeFiles { get; set; } = true;
|
||||||
public bool LogChatFiltering { get; set; } = false;
|
public bool LogChatFiltering { get; set; } = false;
|
||||||
public bool LogChatMessages { get; set; } = false;
|
public bool LogChatMessages { get; set; } = false;
|
||||||
|
|
||||||
public AuthenticationConfiguration Authentication { get; set; } = new();
|
public AuthenticationConfiguration Authentication { get; set; } = new();
|
||||||
public CaptchaConfiguration Captcha { get; set; } = new();
|
public CaptchaConfiguration Captcha { get; set; } = new();
|
||||||
public DigestKeyConfiguration DigestKey { get; set; } = new();
|
public DigestKeyConfiguration DigestKey { get; set; } = new();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue