diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 404e28bdcf..17cccdaf92 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -393,8 +393,7 @@ namespace Emby.Server.Implementations if (_creatingInstances.IndexOf(type) != -1) { - Logger.LogError("DI Loop detected."); - Logger.LogError("Attempted creation of {Type}", type.FullName); + Logger.LogError("DI Loop detected in the attempted creation of {Type}", type.FullName); foreach (var entry in _creatingInstances) { Logger.LogError("Called from: {stack}", entry.FullName); diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 7e0be78993..0c94f937ce 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -73,12 +73,5 @@ - - - - - - - diff --git a/Emby.Server.Implementations/Plugins/Active.png b/Emby.Server.Implementations/Plugins/Active.png deleted file mode 100644 index 3722ee5200..0000000000 Binary files a/Emby.Server.Implementations/Plugins/Active.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/Disabled.png b/Emby.Server.Implementations/Plugins/Disabled.png deleted file mode 100644 index eeb8ffefc2..0000000000 Binary files a/Emby.Server.Implementations/Plugins/Disabled.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/Malfunction.png b/Emby.Server.Implementations/Plugins/Malfunction.png deleted file mode 100644 index d4726150eb..0000000000 Binary files a/Emby.Server.Implementations/Plugins/Malfunction.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/NotSupported.png b/Emby.Server.Implementations/Plugins/NotSupported.png deleted file mode 100644 index a13c1f7c1c..0000000000 Binary files a/Emby.Server.Implementations/Plugins/NotSupported.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs index 07b7297482..cf25ccf485 100644 --- a/Emby.Server.Implementations/Plugins/PluginManager.cs +++ b/Emby.Server.Implementations/Plugins/PluginManager.cs @@ -1,7 +1,6 @@ #nullable enable using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -23,8 +22,6 @@ namespace Emby.Server.Implementations /// public class PluginManager : IPluginManager { - private const int OffsetFromTopRightCorner = 38; - private readonly string _pluginsPath; private readonly Version _appVersion; private readonly JsonSerializerOptions _jsonOptions; diff --git a/Emby.Server.Implementations/Plugins/RestartRequired.png b/Emby.Server.Implementations/Plugins/RestartRequired.png deleted file mode 100644 index 65fd102a2c..0000000000 Binary files a/Emby.Server.Implementations/Plugins/RestartRequired.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/Superceded.png b/Emby.Server.Implementations/Plugins/Superceded.png deleted file mode 100644 index 251e70535b..0000000000 Binary files a/Emby.Server.Implementations/Plugins/Superceded.png and /dev/null differ diff --git a/Emby.Server.Implementations/Plugins/blank.png b/Emby.Server.Implementations/Plugins/blank.png deleted file mode 100644 index f81ae32438..0000000000 Binary files a/Emby.Server.Implementations/Plugins/blank.png and /dev/null differ diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.cs index 36e37b7ad0..c84dc6a130 100644 --- a/Jellyfin.Api/Controllers/PluginsController.cs +++ b/Jellyfin.Api/Controllers/PluginsController.cs @@ -167,7 +167,7 @@ namespace Jellyfin.Api.Controllers } /// - /// Uninstalls a plugin. + /// Uninstalls a plugin by version. /// /// Plugin id. /// Plugin version. @@ -178,7 +178,7 @@ namespace Jellyfin.Api.Controllers [Authorize(Policy = Policies.RequiresElevation)] [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public ActionResult UninstallPlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version) + public ActionResult UninstallPluginByVersion([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version) { if (!_pluginManager.TryGetPlugin(pluginId, version, out var plugin)) { @@ -189,6 +189,35 @@ namespace Jellyfin.Api.Controllers return NoContent(); } + /// + /// Uninstalls a plugin. + /// + /// Plugin id. + /// Plugin uninstalled. + /// Plugin not found. + /// An on success, or a if the file could not be found. + [HttpDelete("{pluginId}")] + [Authorize(Policy = Policies.RequiresElevation)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [Obsolete("Please use the UninstallByVersion API.")] + public ActionResult UninstallPlugin([FromRoute, Required] Guid pluginId) + { + // If no version is given, return the current instance. + var plugins = _pluginManager.Plugins.Where(p => p.Id.Equals(pluginId)); + + // Select the un-instanced one first. + var plugin = plugins.FirstOrDefault(p => p.Instance != null); + if (plugin == null) + { + // Then by the status. + plugin = plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault(); + } + + _installationManager.UninstallPlugin(plugin!); + return NoContent(); + } + /// /// Gets plugin configuration. /// @@ -281,33 +310,6 @@ namespace Jellyfin.Api.Controllers return PhysicalFile(imgPath, MimeTypes.GetMimeType(imgPath)); } - /// - /// Gets a plugin's status image. - /// - /// Plugin id. - /// Plugin version. - /// Plugin image returned. - /// Plugin's image. - [HttpGet("{pluginId}/{version}/StatusImage")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - [ProducesImageFile] - [AllowAnonymous] - public ActionResult GetPluginStatusImage([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version) - { - if (!_pluginManager.TryGetPlugin(pluginId, version, out var plugin)) - { - return NotFound(); - } - - // Icons from http://www.fatcow.com/free-icons - var status = plugin!.Manifest.Status; - - var type = _pluginManager.GetType(); - var stream = type.Assembly.GetManifestResourceStream($"{type.Namespace}.Plugins.{status}.png"); - return File(stream, "image/png"); - } - /// /// Gets a plugin's manifest. ///