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
@@ -1,5 +1,6 @@
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace CartriX.Api.Classes
|
||||
{
|
||||
@@ -38,5 +39,24 @@ namespace CartriX.Api.Classes
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLocalIp()
|
||||
{
|
||||
foreach (var ni in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
if (ni.OperationalStatus != OperationalStatus.Up) continue;
|
||||
if (ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) continue;
|
||||
|
||||
var props = ni.GetIPProperties();
|
||||
foreach (var ua in props.UnicastAddresses)
|
||||
{
|
||||
if (ua.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
return ua.Address.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user