mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
Сделал автоматическую ссылку на QR, а так же в appsettings есть возможность выбора порта
This commit is contained in:
1 parent
2482e30cb3
commit
4b78e211f6
9 files changed
+69
-24
No files matched your search
@@ -6,7 +6,7 @@ namespace CartriX.Api.Controllers.Network
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class NetworkController : ControllerBase
|
||||
public class NetworkController(IConfiguration configuration) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Доступность
|
||||
@@ -39,5 +39,20 @@ namespace CartriX.Api.Controllers.Network
|
||||
[ProducesResponseType(typeof(bool), StatusCodes.Status404NotFound)]
|
||||
[HttpGet(nameof(Ping))]
|
||||
public async Task<ActionResult> Ping([FromQuery] string IpAddressOrHostname) => (await NetworkHelper.PingHostAsync(IpAddressOrHostname)) ? StatusCode(200, true) : StatusCode(404, false);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Получить адрес
|
||||
/// </summary>
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[HttpGet(nameof(BaseAddress))]
|
||||
public async Task<ActionResult> BaseAddress()
|
||||
{
|
||||
var port = configuration.GetValue<int>("Server:Port");
|
||||
var ip = NetworkHelper.GetLocalIp();
|
||||
return Ok(new Uri($"http://{ip}:{port}"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user