Add the ability to disable matchmaking in configuration

This commit is contained in:
sudokoko 2024-03-17 18:51:43 -04:00
parent b4d67d4016
commit 5035dbb63d
No known key found for this signature in database
GPG key ID: 248D68C664937395
3 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,6 @@
#nullable enable
using System.Text.Json;
using LBPUnion.ProjectLighthouse.Configuration;
using LBPUnion.ProjectLighthouse.Database;
using LBPUnion.ProjectLighthouse.Extensions;
using LBPUnion.ProjectLighthouse.Helpers;
@ -42,6 +43,9 @@ public class MatchController : ControllerBase
UserEntity? user = await this.database.UserFromGameToken(token);
if (user == null) return this.Forbid();
// Do not allow matchmaking if it has been disabled
if (!ServerConfiguration.Instance.Matchmaking.MatchmakingEnabled) return this.Forbid();
#region Parse match data
// Example POST /match: [UpdateMyPlayerData,["Player":"FireGamer9872"]]

View file

@ -0,0 +1,6 @@
namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories;
public class MatchmakingConfiguration
{
public bool MatchmakingEnabled { get; set; } = true;
}

View file

@ -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.
// If you are modifying anything here, this value MUST be incremented.
// Thanks for listening~
public override int ConfigVersion { get; set; } = 24;
public override int ConfigVersion { get; set; } = 25;
public override string ConfigName { get; set; } = "lighthouse.yml";
public string WebsiteListenUrl { get; set; } = "http://localhost:10060";
@ -35,6 +35,7 @@ public class ServerConfiguration : ConfigurationBase<ServerConfiguration>
public AuthenticationConfiguration Authentication { get; set; } = new();
public CaptchaConfiguration Captcha { get; set; } = new();
public DigestKeyConfiguration DigestKey { get; set; } = new();
public MatchmakingConfiguration Matchmaking { get; set; } = new();
public GoogleAnalyticsConfiguration GoogleAnalytics { get; set; } = new();
public MailConfiguration Mail { get; set; } = new();
public UserGeneratedContentLimitConfiguration UserGeneratedContentLimits { get; set; } = new();