aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Updates/InstallationManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Updates/InstallationManager.cs41
1 files changed, 40 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
index 9c3b532ec..4dd9c47d1 100644
--- a/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
+++ b/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
@@ -171,6 +171,26 @@ namespace MediaBrowser.Server.Implementations.Updates
{
var packages = (await _packageManager.GetAvailablePackages(cancellationToken).ConfigureAwait(false)).ToList();
+ return FilterPackages(packages, packageType, applicationVersion);
+ }
+
+ /// <summary>
+ /// Gets all available packages.
+ /// </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>
+ protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesStatic(CancellationToken cancellationToken,
+ PackageType? packageType = null,
+ Version applicationVersion = null)
+ {
+ var packages = (await _packageManager.GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false)).ToList();
+ return FilterPackages(packages, packageType, applicationVersion);
+ }
+
+ protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, PackageType? packageType, Version applicationVersion)
+ {
if (packageType.HasValue)
{
packages = packages.Where(p => p.type == packageType.Value).ToList();
@@ -265,7 +285,8 @@ namespace MediaBrowser.Server.Implementations.Updates
}
/// <summary>
- /// Gets the available plugin updates.
+ /// Gets the available plugin updates including registration information for each one.
+ /// Used with API and catalog.
/// </summary>
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -273,7 +294,25 @@ namespace MediaBrowser.Server.Implementations.Updates
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
{
var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false);
+ return FilterCatalog(catalog, withAutoUpdateEnabled);
+ }
+ /// <summary>
+ /// Gets the available plugin updates from a static resource - no registration information.
+ /// Used for update checks.
+ /// </summary>
+ /// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
+ public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesStatic(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
+ {
+ var catalog = await GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false);
+ return FilterCatalog(catalog, withAutoUpdateEnabled);
+ }
+
+ protected IEnumerable<PackageVersionInfo> FilterCatalog(IEnumerable<PackageInfo> catalog, bool withAutoUpdateEnabled)
+ {
+
var plugins = ApplicationHost.Plugins;
if (withAutoUpdateEnabled)