3.0.4967.25605
This commit is contained in:
parent
a092b77fa4
commit
a3f7ebe702
|
@ -127,11 +127,6 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// <value>The security manager.</value>
|
||||
protected ISecurityManager SecurityManager { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the package manager.
|
||||
/// </summary>
|
||||
/// <value>The package manager.</value>
|
||||
protected IPackageManager PackageManager { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the HTTP client.
|
||||
/// </summary>
|
||||
/// <value>The HTTP client.</value>
|
||||
|
@ -286,10 +281,7 @@ namespace MediaBrowser.Common.Implementations
|
|||
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths);
|
||||
RegisterSingleInstance(SecurityManager);
|
||||
|
||||
PackageManager = new PackageManager(SecurityManager, NetworkManager, HttpClient, ApplicationPaths, JsonSerializer, Logger);
|
||||
RegisterSingleInstance(PackageManager);
|
||||
|
||||
InstallationManager = new InstallationManager(HttpClient, PackageManager, JsonSerializer, Logger, this);
|
||||
InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, NetworkManager);
|
||||
RegisterSingleInstance(InstallationManager);
|
||||
});
|
||||
}
|
||||
|
@ -583,7 +575,7 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// <returns>Task.</returns>
|
||||
public async Task UpdateApplication(PackageVersionInfo package, CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
await PackageManager.InstallPackage(progress, package, cancellationToken).ConfigureAwait(false);
|
||||
await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<Version> { Argument = package.version }, Logger);
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
<Compile Include="Serialization\XmlSerializer.cs" />
|
||||
<Compile Include="Updates\ApplicationUpdater.cs" />
|
||||
<Compile Include="Updates\InstallationManager.cs" />
|
||||
<Compile Include="Updates\PackageManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using MediaBrowser.Common.Events;
|
||||
using System.Security.Cryptography;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Common.Security;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
@ -68,7 +71,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
|
||||
EventHelper.QueueEventIfNotNull(PluginUpdated, this, new GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> { Argument = new Tuple<IPlugin, PackageVersionInfo>(plugin, newVersion) }, _logger);
|
||||
|
||||
ApplicationHost.NotifyPendingRestart();
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -87,7 +90,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
|
||||
EventHelper.QueueEventIfNotNull(PluginInstalled, this, new GenericEventArgs<PackageVersionInfo> { Argument = package }, _logger);
|
||||
|
||||
ApplicationHost.NotifyPendingRestart();
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -96,63 +99,34 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The package manager
|
||||
/// </summary>
|
||||
private readonly IPackageManager _packageManager;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the json serializer.
|
||||
/// </summary>
|
||||
/// <value>The json serializer.</value>
|
||||
protected IJsonSerializer JsonSerializer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTTP client.
|
||||
/// </summary>
|
||||
/// <value>The HTTP client.</value>
|
||||
protected IHttpClient HttpClient { get; private set; }
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly ISecurityManager _securityManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application host.
|
||||
/// </summary>
|
||||
/// <value>The application host.</value>
|
||||
protected IApplicationHost ApplicationHost { get; private set; }
|
||||
private readonly IApplicationHost _applicationHost;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InstallationManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="httpClient">The HTTP client.</param>
|
||||
/// <param name="packageManager">The package manager.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="appHost">The app host.</param>
|
||||
/// <exception cref="System.ArgumentNullException">zipClient</exception>
|
||||
public InstallationManager(IHttpClient httpClient, IPackageManager packageManager, IJsonSerializer jsonSerializer, ILogger logger, IApplicationHost appHost)
|
||||
public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, INetworkManager networkManager)
|
||||
{
|
||||
if (packageManager == null)
|
||||
{
|
||||
throw new ArgumentNullException("packageManager");
|
||||
}
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
if (jsonSerializer == null)
|
||||
{
|
||||
throw new ArgumentNullException("jsonSerializer");
|
||||
}
|
||||
if (httpClient == null)
|
||||
{
|
||||
throw new ArgumentNullException("httpClient");
|
||||
}
|
||||
|
||||
CurrentInstallations = new List<Tuple<InstallationInfo, CancellationTokenSource>>();
|
||||
CompletedInstallations = new ConcurrentBag<InstallationInfo>();
|
||||
JsonSerializer = jsonSerializer;
|
||||
HttpClient = httpClient;
|
||||
ApplicationHost = appHost;
|
||||
_packageManager = packageManager;
|
||||
|
||||
_applicationHost = appHost;
|
||||
_appPaths = appPaths;
|
||||
_httpClient = httpClient;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_securityManager = securityManager;
|
||||
_networkManager = networkManager;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -167,9 +141,16 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
PackageType? packageType = null,
|
||||
Version applicationVersion = null)
|
||||
{
|
||||
var packages = (await _packageManager.GetAvailablePackages(cancellationToken).ConfigureAwait(false)).ToList();
|
||||
var data = new Dictionary<string, string> { { "key", _securityManager.SupporterKey }, { "mac", _networkManager.GetMacAddress() } };
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
using (var json = await _httpClient.Post(Constants.Constants.MbAdminUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -179,16 +160,28 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
/// <param name="packageType">Type of the package.</param>
|
||||
/// <param name="applicationVersion">The application version.</param>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken,
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken,
|
||||
PackageType? packageType = null,
|
||||
Version applicationVersion = null)
|
||||
{
|
||||
var packages = (await _packageManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false)).ToList();
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
using (var json = await _httpClient.Get(Constants.Constants.MbAdminUrl + "service/MB3Packages.json", cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
}
|
||||
}
|
||||
|
||||
protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, PackageType? packageType, Version applicationVersion)
|
||||
{
|
||||
foreach (var package in packages)
|
||||
{
|
||||
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
|
||||
.OrderByDescending(v => v.version).ToList();
|
||||
}
|
||||
|
||||
if (packageType.HasValue)
|
||||
{
|
||||
packages = packages.Where(p => p.type == packageType.Value).ToList();
|
||||
|
@ -279,7 +272,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
|
||||
return package.versions
|
||||
.OrderByDescending(v => v.version)
|
||||
.FirstOrDefault(v => v.classification <= classification && IsPackageVersionUpToDate(v, ApplicationHost.ApplicationVersion));
|
||||
.FirstOrDefault(v => v.classification <= classification && IsPackageVersionUpToDate(v, _applicationHost.ApplicationVersion));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -310,7 +303,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
|
||||
protected IEnumerable<PackageVersionInfo> FilterCatalog(IEnumerable<PackageInfo> catalog, bool withAutoUpdateEnabled)
|
||||
{
|
||||
var plugins = ApplicationHost.Plugins;
|
||||
var plugins = _applicationHost.Plugins;
|
||||
|
||||
if (withAutoUpdateEnabled)
|
||||
{
|
||||
|
@ -454,13 +447,13 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
private async Task InstallPackageInternal(PackageVersionInfo package, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
// Do the install
|
||||
await _packageManager.InstallPackage(progress, package, cancellationToken).ConfigureAwait(false);
|
||||
await PerformPackageInstallation(progress, package, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Do plugin-specific processing
|
||||
if (!(Path.GetExtension(package.targetFilename) ?? "").Equals(".zip", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Set last update time if we were installed before
|
||||
var plugin = ApplicationHost.Plugins.FirstOrDefault(p => p.Name.Equals(package.name, StringComparison.OrdinalIgnoreCase));
|
||||
var plugin = _applicationHost.Plugins.FirstOrDefault(p => p.Name.Equals(package.name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (plugin != null)
|
||||
{
|
||||
|
@ -474,6 +467,68 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
}
|
||||
}
|
||||
|
||||
private async Task PerformPackageInstallation(IProgress<double> progress, PackageVersionInfo package, CancellationToken cancellationToken)
|
||||
{
|
||||
// Target based on if it is an archive or single assembly
|
||||
// zip archives are assumed to contain directory structures relative to our ProgramDataPath
|
||||
var isArchive = string.Equals(Path.GetExtension(package.targetFilename), ".zip", StringComparison.OrdinalIgnoreCase);
|
||||
var target = Path.Combine(isArchive ? _appPaths.TempUpdatePath : _appPaths.PluginsPath, package.targetFilename);
|
||||
|
||||
// Download to temporary file so that, if interrupted, it won't destroy the existing installation
|
||||
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
|
||||
{
|
||||
Url = package.sourceUrl,
|
||||
CancellationToken = cancellationToken,
|
||||
Progress = progress
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// Validate with a checksum
|
||||
if (package.checksum != Guid.Empty) // support for legacy uploads for now
|
||||
{
|
||||
using (var crypto = new MD5CryptoServiceProvider())
|
||||
using (var stream = new BufferedStream(File.OpenRead(tempFile), 100000))
|
||||
{
|
||||
var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty));
|
||||
if (check != package.checksum)
|
||||
{
|
||||
throw new ApplicationException(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// Success - move it to the real target
|
||||
try
|
||||
{
|
||||
File.Copy(tempFile, target, true);
|
||||
//If it is an archive - write out a version file so we know what it is
|
||||
if (isArchive)
|
||||
{
|
||||
File.WriteAllText(target + ".ver", package.versionStr);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target);
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(tempFile);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Don't fail because of this
|
||||
_logger.ErrorException("Error deleting temp file {0]", e, tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Uninstalls a plugin
|
||||
/// </summary>
|
||||
|
@ -484,13 +539,13 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
plugin.OnUninstalling();
|
||||
|
||||
// Remove it the quick way for now
|
||||
ApplicationHost.RemovePlugin(plugin);
|
||||
_applicationHost.RemovePlugin(plugin);
|
||||
|
||||
File.Delete(plugin.AssemblyFilePath);
|
||||
|
||||
OnPluginUninstalled(plugin);
|
||||
|
||||
ApplicationHost.NotifyPendingRestart();
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Security;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Implementations.Updates
|
||||
{
|
||||
public class PackageManager : IPackageManager
|
||||
{
|
||||
private readonly ISecurityManager _securityManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PackageManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="securityManager">The security manager.</param>
|
||||
/// <param name="networkManager">The network manager.</param>
|
||||
/// <param name="httpClient">The HTTP client.</param>
|
||||
/// <param name="applicationPaths">The application paths.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public PackageManager(ISecurityManager securityManager, INetworkManager networkManager, IHttpClient httpClient, IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger)
|
||||
{
|
||||
_securityManager = securityManager;
|
||||
_networkManager = networkManager;
|
||||
_httpClient = httpClient;
|
||||
_appPaths = applicationPaths;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all available packages including registration information.
|
||||
/// Use this for the plug-in catalog to provide all information for this installation.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken)
|
||||
{
|
||||
var data = new Dictionary<string, string> { { "key", _securityManager.SupporterKey }, { "mac", _networkManager.GetMacAddress() } };
|
||||
|
||||
using (var json = await _httpClient.Post(Constants.Constants.MbAdminUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();
|
||||
|
||||
return FilterVersions(packages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all available packages using the static file resource.
|
||||
/// Use this for update checks as it will be much less taxing on the server and can be cached.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
||||
{
|
||||
using (var json = await _httpClient.Get(Constants.Constants.MbAdminUrl + "service/MB3Packages.json", cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();
|
||||
|
||||
return FilterVersions(packages);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<PackageInfo> FilterVersions(List<PackageInfo> original)
|
||||
{
|
||||
foreach (var package in original)
|
||||
{
|
||||
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
|
||||
.OrderByDescending(v => v.version).ToList();
|
||||
}
|
||||
|
||||
return original;
|
||||
}
|
||||
|
||||
public async Task InstallPackage(IProgress<double> progress, PackageVersionInfo package, CancellationToken cancellationToken)
|
||||
{
|
||||
// Target based on if it is an archive or single assembly
|
||||
// zip archives are assumed to contain directory structures relative to our ProgramDataPath
|
||||
var isArchive = string.Equals(Path.GetExtension(package.targetFilename), ".zip", StringComparison.OrdinalIgnoreCase);
|
||||
var target = Path.Combine(isArchive ? _appPaths.TempUpdatePath : _appPaths.PluginsPath, package.targetFilename);
|
||||
|
||||
// Download to temporary file so that, if interrupted, it won't destroy the existing installation
|
||||
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
|
||||
{
|
||||
Url = package.sourceUrl,
|
||||
CancellationToken = cancellationToken,
|
||||
Progress = progress
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// Validate with a checksum
|
||||
if (package.checksum != Guid.Empty) // support for legacy uploads for now
|
||||
{
|
||||
using (var crypto = new MD5CryptoServiceProvider())
|
||||
using (var stream = new BufferedStream(File.OpenRead(tempFile), 100000))
|
||||
{
|
||||
var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty));
|
||||
if (check != package.checksum)
|
||||
{
|
||||
throw new ApplicationException(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// Success - move it to the real target
|
||||
try
|
||||
{
|
||||
File.Copy(tempFile, target, true);
|
||||
//If it is an archive - write out a version file so we know what it is
|
||||
if (isArchive)
|
||||
{
|
||||
File.WriteAllText(target+".ver", package.versionStr);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target);
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(tempFile);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Don't fail because of this
|
||||
_logger.ErrorException("Error deleting temp file {0]", e, tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -108,7 +108,6 @@
|
|||
<Compile Include="Security\ISecurityManager.cs" />
|
||||
<Compile Include="Updates\IInstallationManager.cs" />
|
||||
<Compile Include="Updates\InstallationEventArgs.cs" />
|
||||
<Compile Include="Updates\IPackageManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
|
|
|
@ -52,6 +52,17 @@ namespace MediaBrowser.Common.Updates
|
|||
PackageType? packageType = null,
|
||||
Version applicationVersion = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all available packages from a static resource.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="packageType">Type of the package.</param>
|
||||
/// <param name="applicationVersion">The application version.</param>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken,
|
||||
PackageType? packageType = null,
|
||||
Version applicationVersion = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the package.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
using MediaBrowser.Model.Updates;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Updates
|
||||
{
|
||||
public interface IPackageManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all available packages dynamically.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all available packages from a static resource.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Installs a package.
|
||||
/// </summary>
|
||||
/// <param name="progress"></param>
|
||||
/// <param name="package">The package.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task InstallPackage(IProgress<double> progress, PackageVersionInfo package, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public virtual string Name
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using MediaBrowser.Model.Globalization;
|
|||
using MediaBrowser.Model.Notifications;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Search;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.System;
|
||||
|
@ -42,6 +43,17 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <returns>Task{ThemeMediaResult}.</returns>
|
||||
Task<ThemeMediaResult> GetThemeSongsAsync(string userId, string itemId, bool inheritFromParents);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the search hints async.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="searchTerm">The search term.</param>
|
||||
/// <param name="startIndex">The start index.</param>
|
||||
/// <param name="limit">The limit.</param>
|
||||
/// <returns>Task{SearchHintResult}.</returns>
|
||||
Task<SearchHintResult> GetSearchHintsAsync(string userId, string searchTerm, int? startIndex = null,
|
||||
int? limit = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the theme videos async.
|
||||
/// </summary>
|
||||
|
|
|
@ -235,9 +235,7 @@
|
|||
<EmbeddedResource Include="MediaEncoder\ffmpeg20130801.zip" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Updates\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="swagger-ui\css\hightlight.default.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
@ -626,7 +626,8 @@ namespace MediaBrowser.ServerApplication
|
|||
|
||||
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
var availablePackages = await PackageManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);
|
||||
var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
|
||||
|
||||
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.171</version>
|
||||
<version>3.0.173</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.171" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.173" />
|
||||
<dependency id="NLog" version="2.0.1.2" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.45" />
|
||||
<dependency id="SimpleInjector" version="2.2.3" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.171</version>
|
||||
<version>3.0.173</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.171</version>
|
||||
<version>3.0.173</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.171" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.173" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user