2025-09-26 00:49:34 -05:00
|
|
|
using AutoMapper;
|
|
|
|
|
using LANCommander.Server.Services;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace LANCommander.Server.Endpoints;
|
|
|
|
|
|
|
|
|
|
public static class SettingsEndpoints
|
|
|
|
|
{
|
|
|
|
|
public static void MapSettingsEndpoints(this IEndpointRouteBuilder routes)
|
|
|
|
|
{
|
|
|
|
|
var group = routes.MapGroup("/api/Settings");
|
|
|
|
|
|
|
|
|
|
group.MapGet("/", GetAsync);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<IResult> GetAsync(
|
2025-11-16 12:31:25 -06:00
|
|
|
[FromServices] SettingsProvider<Settings.Settings> settingsProvider,
|
2025-09-26 00:49:34 -05:00
|
|
|
[FromServices] ServerService serverService,
|
|
|
|
|
[FromServices] IMapper mapper)
|
|
|
|
|
{
|
2025-10-06 23:21:26 -05:00
|
|
|
var clientSettings = new
|
|
|
|
|
{
|
|
|
|
|
IPXRelay = new
|
|
|
|
|
{
|
2025-11-16 12:31:25 -06:00
|
|
|
Host = settingsProvider.CurrentValue.Server.IPXRelay.Host,
|
|
|
|
|
Port = settingsProvider.CurrentValue.Server.IPXRelay.Port,
|
2025-10-06 23:21:26 -05:00
|
|
|
},
|
|
|
|
|
Library = new
|
|
|
|
|
{
|
2025-11-16 12:31:25 -06:00
|
|
|
EnableUserLibraries = settingsProvider.CurrentValue.Server.Library.EnableUserLibraries,
|
2025-10-06 23:21:26 -05:00
|
|
|
}
|
|
|
|
|
};
|
2025-09-26 00:49:34 -05:00
|
|
|
|
|
|
|
|
return TypedResults.Ok(clientSettings);
|
|
|
|
|
}
|
|
|
|
|
}
|