This commit is contained in:
2026-01-18 17:59:01 +08:00
parent ef2e821611
commit b9daa46b0a
22 changed files with 1048 additions and 0 deletions

39
Api/InfoController.cs Normal file
View File

@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using System.Text.Json.Serialization;
namespace CatLink.Api
{
public class RelayInfoResponse
{
[JsonPropertyName("relayHost")]
public string RelayHost { get; set; } = string.Empty;
[JsonPropertyName("relayPort")]
public int RelayPort { get; set; }
}
[ApiController]
[Route("info")]
public class InfoController : ControllerBase
{
private readonly IConfiguration _configuration;
public InfoController(IConfiguration configuration)
{
_configuration = configuration;
}
[HttpGet]
public IActionResult GetInfo()
{
var host = _configuration.GetValue<string>("Host") ?? "localhost";
var relayPort = _configuration.GetValue<int>("RelayPort");
return Ok(new RelayInfoResponse
{
RelayHost = host,
RelayPort = relayPort
});
}
}
}