diff --git a/Configuration/InfoConfiguration.cs b/Configuration/InfoConfiguration.cs deleted file mode 100644 index c335103..0000000 --- a/Configuration/InfoConfiguration.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace BeatTogether.Status.Api.Configuration -{ - public class InfoConfiguration - { - public string ServerDisplayName { get; set; } = string.Empty; - public string ServerDescription { get; set; } = string.Empty; - public string ServerImageUrl { get; set; } = string.Empty; - public int MaxPlayers { get; set; } = 25; - public bool ServerSupportsPPModifiers { get; set; } = false; - public bool ServerSupportsPPDifficulties { get; set; } = false; - public bool ServerSupportsPPMaps { get; set; } = false; - } -} diff --git a/Configuration/StatusConfiguration.cs b/Configuration/StatusConfiguration.cs index c84157f..011cf97 100644 --- a/Configuration/StatusConfiguration.cs +++ b/Configuration/StatusConfiguration.cs @@ -14,5 +14,12 @@ public class StatusConfiguration /// Prefer SSL (DTLS) for dedicated server connections? /// public bool UseSsl { get; set; } = false; + public string ServerDisplayName { get; set; } = string.Empty; + public string ServerDescription { get; set; } = string.Empty; + public string ServerImageUrl { get; set; } = string.Empty; + public int MaxPlayers { get; set; } = 25; + public bool ServerSupportsPPModifiers { get; set; } = false; + public bool ServerSupportsPPDifficulties { get; set; } = false; + public bool ServerSupportsPPMaps { get; set; } = false; } } diff --git a/Controllers/InfoController.cs b/Controllers/InfoController.cs deleted file mode 100644 index a28648a..0000000 --- a/Controllers/InfoController.cs +++ /dev/null @@ -1,32 +0,0 @@ -using BeatTogether.Status.Api.Configuration; -using BeatTogether.Status.Api.Models; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; - -namespace BeatTogether.Status.Api.Controllers -{ - [ApiController] - [Route("info")] - public class InfoController - { - private readonly InfoConfiguration _configuration; - - public InfoController(IOptionsSnapshot configuration) - { - _configuration = configuration.Value; - } - - [HttpGet] - public MasterServerInfoData Get() - { - return new MasterServerInfoData( - _configuration.ServerDisplayName, - _configuration.ServerDescription, - _configuration.ServerImageUrl, - _configuration.MaxPlayers, - _configuration.ServerSupportsPPModifiers, - _configuration.ServerSupportsPPDifficulties, - _configuration.ServerSupportsPPMaps); - } - } -} diff --git a/Controllers/StatusController.cs b/Controllers/StatusController.cs index edcef0f..75fa0e0 100644 --- a/Controllers/StatusController.cs +++ b/Controllers/StatusController.cs @@ -19,7 +19,7 @@ public StatusController(IOptionsSnapshot configuration) } [HttpGet] - public MasterServerAvailabilityData Get() + public MasterServerStatusData Get() { var status = AvailabilityStatus.Online; var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); @@ -27,14 +27,21 @@ public MasterServerAvailabilityData Get() status = AvailabilityStatus.MaintenanceUpcoming; else if (timestamp < _configuration.MaintenanceEndTime) status = AvailabilityStatus.Offline; - return new MasterServerAvailabilityData( + return new MasterServerStatusData( _configuration.MinimumAppVersion, status, _configuration.MaintenanceStartTime, _configuration.MaintenanceEndTime, new UserMessage(_configuration.LocalizedMessages), _configuration.RequiredMods, - _configuration.UseSsl + _configuration.UseSsl, + _configuration.ServerDisplayName, + _configuration.ServerDescription, + _configuration.ServerImageUrl, + _configuration.MaxPlayers, + _configuration.ServerSupportsPPModifiers, + _configuration.ServerSupportsPPDifficulties, + _configuration.ServerSupportsPPMaps ); } } diff --git a/Models/MasterServerInfoData.cs b/Models/MasterServerInfoData.cs deleted file mode 100644 index da34e21..0000000 --- a/Models/MasterServerInfoData.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace BeatTogether.Status.Api.Models -{ - public record MasterServerInfoData( - string name, - string description, - string imageUrl, - int maxPlayers, - bool supportsPPModifiers, - bool supportsPPDifficulties, - bool supportsPPMaps); -} \ No newline at end of file diff --git a/Models/MasterServerAvailabilityData.cs b/Models/MasterServerStatusData.cs similarity index 55% rename from Models/MasterServerAvailabilityData.cs rename to Models/MasterServerStatusData.cs index 2bb12fb..71ec618 100644 --- a/Models/MasterServerAvailabilityData.cs +++ b/Models/MasterServerStatusData.cs @@ -1,14 +1,21 @@ -using BeatTogether.Status.Api.Enums; -using System.Collections.Generic; - -namespace BeatTogether.Status.Api.Models -{ - public record MasterServerAvailabilityData( - string minimumAppVersion, - AvailabilityStatus status, - long maintenanceStartTime, - long maintenanceEndTime, - UserMessage userMessage, - List requiredMods, - bool useSsl); -} +using BeatTogether.Status.Api.Enums; +using System.Collections.Generic; + +namespace BeatTogether.Status.Api.Models +{ + public record MasterServerStatusData( + string minimumAppVersion, + AvailabilityStatus status, + long maintenanceStartTime, + long maintenanceEndTime, + UserMessage userMessage, + List requiredMods, + bool useSsl, + string name, + string description, + string imageUrl, + int maxPlayers, + bool supportsPPModifiers, + bool supportsPPDifficulties, + bool supportsPPMaps); +} diff --git a/Models/RequiredMod.cs b/Models/RequiredMod.cs index dfa6b80..c7ef3e7 100644 --- a/Models/RequiredMod.cs +++ b/Models/RequiredMod.cs @@ -1,7 +1,18 @@ namespace BeatTogether.Status.Api.Models { - public record RequiredMod { + public record RequiredMod + { + /// + /// BSIPA Mod ID + /// public string id { get; set; } = string.Empty; + /// + /// Minimum version of the mod required, if installed + /// public string version { get; set; } = string.Empty; + /// + /// Indicates whether the mod must be installed + /// + public bool required { get; set; } = false; } -} +} \ No newline at end of file