mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-21 05:00:39 +02:00
fix mono build
This commit is contained in:
parent
0a0f8abe5f
commit
e221902088
|
@ -26,6 +26,46 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||||
return GetLocalIpAddressesFallback();
|
return GetLocalIpAddressesFallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInLocalNetwork(string endpoint)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(endpoint))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("endpoint");
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress address;
|
||||||
|
if (!IPAddress.TryParse(endpoint, out address))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int lengthMatch = 4;
|
||||||
|
|
||||||
|
if (endpoint.Length >= lengthMatch)
|
||||||
|
{
|
||||||
|
var prefix = endpoint.Substring(0, lengthMatch);
|
||||||
|
|
||||||
|
if (GetLocalIpAddresses()
|
||||||
|
.Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private address space:
|
||||||
|
// http://en.wikipedia.org/wiki/Private_network
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
// If url was requested with computer name, we may see this
|
||||||
|
endpoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
|
|
||||||
|
endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
endpoint.StartsWith("192.", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
endpoint.StartsWith("172.", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<IPAddress> GetIPsDefault()
|
private IEnumerable<IPAddress> GetIPsDefault()
|
||||||
{
|
{
|
||||||
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
|
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace MediaBrowser.ServerApplication.Native
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
|
public static Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
|
||||||
PackageVersionClass updateLevel,
|
PackageVersionClass updateLevel,
|
||||||
IInstallationManager installationManager,
|
IInstallationManager installationManager,
|
||||||
CancellationToken cancellationToken,
|
CancellationToken cancellationToken,
|
||||||
|
|
|
@ -44,46 +44,6 @@ namespace MediaBrowser.ServerApplication.Networking
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInLocalNetwork(string endpoint)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(endpoint))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("endpoint");
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress address;
|
|
||||||
if (!IPAddress.TryParse(endpoint, out address))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int lengthMatch = 4;
|
|
||||||
|
|
||||||
if (endpoint.Length >= lengthMatch)
|
|
||||||
{
|
|
||||||
var prefix = endpoint.Substring(0, lengthMatch);
|
|
||||||
|
|
||||||
if (GetLocalIpAddresses()
|
|
||||||
.Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private address space:
|
|
||||||
// http://en.wikipedia.org/wiki/Private_network
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
// If url was requested with computer name, we may see this
|
|
||||||
endpoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 ||
|
|
||||||
|
|
||||||
endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
endpoint.StartsWith("192.", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
endpoint.StartsWith("172.", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To the type of the network share.
|
/// To the type of the network share.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in a new issue