Skip to content

The Free Software Media System - Server Backend & API

Merge branch 'master' into installationmanager

Bond-009983d38a43bd6
diff --cc Emby.Server.Implementations/Updates/InstallationManager.cs
index 2ac754eb6d,2de20829ca..8dcfb0996d
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@@ -24,7 -22,7 +23,7 @@@ using Microsoft.Extensions.Logging
namespace Emby.Server.Implementations.Updates
{
/// <summary>
-- /// Manages all install, uninstall and update operations (both plugins and system)
++ /// Manages all install, uninstall and update operations (both plugins and system).
/// </summary>
public class InstallationManager : IInstallationManager
{
@@@ -107,8 -84,51 +85,33 @@@
_zipClient = zipClient;
}
+ public event EventHandler<InstallationEventArgs> PackageInstalling;
+
+ public event EventHandler<InstallationEventArgs> PackageInstallationCompleted;
+
+ public event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
+
+ public event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
+
+ /// <summary>
+ /// Occurs when a plugin is uninstalled.
+ /// </summary>
+ public event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
+
+ /// <summary>
+ /// Occurs when a plugin plugin is updated.
+ /// </summary>
+ public event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated;
+
+ /// <summary>
+ /// Occurs when a plugin plugin is installed.
+ /// </summary>
+ public event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
+
+ public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal;
+
- /// <summary>
- /// Gets all available packages.
- /// </summary>
- /// <returns>Task{List{PackageInfo}}.</returns>
- public async Task<List<PackageInfo>> GetAvailablePackages(
- CancellationToken cancellationToken,
- bool withRegistration = true,
- string packageType = null,
- Version applicationVersion = null)
- {
- var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
- return FilterPackages(packages, packageType, applicationVersion);
- }
-
- /// <summary>
- /// Gets all available packages.
- /// </summary>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task{List{PackageInfo}}.</returns>
- public async Task<List<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
+ /// <inheritdoc />
+ public async Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default)
{
using (var response = await _httpClient.SendAsync(
new HttpRequestOptions
@@@ -334,7 -441,7 +337,7 @@@
// Always override the passed-in target (which is a file) and figure it out again
string targetDir = Path.Combine(_appPaths.PluginsPath, package.name);
--// CA5351: Do Not Use Broken Cryptographic Algorithms
++ // CA5351: Do Not Use Broken Cryptographic Algorithms
#pragma warning disable CA5351
using (var res = await _httpClient.SendAsync(
new HttpRequestOptions
@@@ -430,9 -537,9 +433,9 @@@
/// <inheritdoc/>
public bool CancelInstallation(Guid id)
{
- lock (_currentInstallations)
+ lock (_currentInstallationsLock)
{
- var install = _currentInstallations.Find(x => x.Item1.Id == id);
+ var install = _currentInstallations.Find(x => x.info.Id == id);
if (install == default((InstallationInfo, CancellationTokenSource)))
{
return false;