mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-05 08:29:40 +00:00
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using System.Globalization;
|
|
|
|
namespace AIStudio.Tools.Mail;
|
|
|
|
public static class MailServerHosts
|
|
{
|
|
/// <summary>
|
|
/// The host in the form certificates and the allowed hosts for root certificates use.
|
|
/// </summary>
|
|
/// <param name="host">The host as somebody wrote it, e.g., with umlauts or surrounding white space.</param>
|
|
/// <param name="idnHost">The host in its ASCII form, or an IP address as written.</param>
|
|
/// <returns>True when the text is a host name or an IP address.</returns>
|
|
public static bool TryGetIdnHost(string host, out string idnHost)
|
|
{
|
|
idnHost = host.Trim();
|
|
switch (Uri.CheckHostName(idnHost))
|
|
{
|
|
case UriHostNameType.IPv4:
|
|
case UriHostNameType.IPv6:
|
|
return true;
|
|
|
|
case UriHostNameType.Dns:
|
|
try
|
|
{
|
|
idnHost = new IdnMapping().GetAscii(idnHost);
|
|
return true;
|
|
}
|
|
catch (ArgumentException)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether two hosts name the same server, however each was written.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Case, umlauts against their ASCII form, and a closing dot make no difference. A text which
|
|
/// is no host at all is the same as nothing.
|
|
/// </remarks>
|
|
/// <param name="host">The one host.</param>
|
|
/// <param name="otherHost">The other host.</param>
|
|
/// <returns>True when both are hosts and name the same server.</returns>
|
|
public static bool AreSame(string host, string otherHost) =>
|
|
TryGetIdnHost(host, out var idnHost) &&
|
|
TryGetIdnHost(otherHost, out var otherIdnHost) &&
|
|
idnHost.TrimEnd('.').Equals(otherIdnHost.TrimEnd('.'), StringComparison.OrdinalIgnoreCase);
|
|
} |