aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common')
-rw-r--r--MediaBrowser.Common/Configuration/IApplicationPaths.cs6
-rw-r--r--MediaBrowser.Common/Extensions/CollectionExtensions.cs14
-rw-r--r--MediaBrowser.Common/IApplicationHost.cs12
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj3
-rw-r--r--MediaBrowser.Common/Net/HttpRequestOptions.cs9
-rw-r--r--MediaBrowser.Common/Net/INetworkManager.cs5
6 files changed, 25 insertions, 24 deletions
diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs
index 27092c0e1..cb4e8bf5f 100644
--- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs
+++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs
@@ -42,12 +42,6 @@ namespace MediaBrowser.Common.Configuration
string PluginConfigurationsPath { get; }
/// <summary>
- /// Gets the path to where temporary update files will be stored
- /// </summary>
- /// <value>The plugin configurations path.</value>
- string TempUpdatePath { get; }
-
- /// <summary>
/// Gets the path to the log directory
/// </summary>
/// <value>The log directory path.</value>
diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
new file mode 100644
index 000000000..f7c0e3cf0
--- /dev/null
+++ b/MediaBrowser.Common/Extensions/CollectionExtensions.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace MediaBrowser.Common.Extensions
+{
+ // The MS CollectionExtensions are only available in netcoreapp
+ public static class CollectionExtensions
+ {
+ public static TValue GetValueOrDefault<TKey, TValue> (this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
+ {
+ dictionary.TryGetValue(key, out var ret);
+ return ret;
+ }
+ }
+}
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index 6891152ee..3a4098612 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -73,12 +73,6 @@ namespace MediaBrowser.Common
string ApplicationUserAgent { get; }
/// <summary>
- /// Gets or sets a value indicating whether this instance can self update.
- /// </summary>
- /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
- bool CanSelfUpdate { get; }
-
- /// <summary>
/// Gets the exports.
/// </summary>
/// <typeparam name="T"></typeparam>
@@ -87,12 +81,6 @@ namespace MediaBrowser.Common
IEnumerable<T> GetExports<T>(bool manageLifetime = true);
/// <summary>
- /// Updates the application.
- /// </summary>
- /// <returns>Task.</returns>
- Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress<double> progress);
-
- /// <summary>
/// Resolves this instance.
/// </summary>
/// <typeparam name="T"></typeparam>
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 715f4fccd..05b48a2a1 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
+ <PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs
index dadac5e03..bea178517 100644
--- a/MediaBrowser.Common/Net/HttpRequestOptions.cs
+++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
+using Microsoft.Net.Http.Headers;
namespace MediaBrowser.Common.Net
{
@@ -24,8 +25,8 @@ namespace MediaBrowser.Common.Net
/// <value>The accept header.</value>
public string AcceptHeader
{
- get => GetHeaderValue("Accept");
- set => RequestHeaders["Accept"] = value;
+ get => GetHeaderValue(HeaderNames.Accept);
+ set => RequestHeaders[HeaderNames.Accept] = value;
}
/// <summary>
/// Gets or sets the cancellation token.
@@ -45,8 +46,8 @@ namespace MediaBrowser.Common.Net
/// <value>The user agent.</value>
public string UserAgent
{
- get => GetHeaderValue("User-Agent");
- set => RequestHeaders["User-Agent"] = value;
+ get => GetHeaderValue(HeaderNames.UserAgent);
+ set => RequestHeaders[HeaderNames.UserAgent] = value;
}
/// <summary>
diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs
index 72fb6e2b8..34c6f5866 100644
--- a/MediaBrowser.Common/Net/INetworkManager.cs
+++ b/MediaBrowser.Common/Net/INetworkManager.cs
@@ -53,7 +53,7 @@ namespace MediaBrowser.Common.Net
/// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
bool IsInLocalNetwork(string endpoint);
- IpAddressInfo[] GetLocalIpAddresses();
+ IpAddressInfo[] GetLocalIpAddresses(bool ignoreVirtualInterface);
IpAddressInfo ParseIpAddress(string ipAddress);
@@ -62,5 +62,8 @@ namespace MediaBrowser.Common.Net
Task<IpAddressInfo[]> GetHostAddressesAsync(string host);
bool IsAddressInSubnets(string addressString, string[] subnets);
+
+ bool IsInSameSubnet(IpAddressInfo address1, IpAddressInfo address2, IpAddressInfo subnetMask);
+ IpAddressInfo GetLocalIpSubnetMask(IpAddressInfo address);
}
}