mirror of https://github.com/jellyfin/jellyfin.git
Prevent system plugins from being uninstalled
This commit is contained in:
parent
c3349038c4
commit
c20400fa40
|
@ -402,6 +402,12 @@ namespace Emby.Server.Implementations.Updates
|
||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
public void UninstallPlugin(IPlugin plugin)
|
public void UninstallPlugin(IPlugin plugin)
|
||||||
{
|
{
|
||||||
|
if (!plugin.CanUninstall)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Attempt to delete non removable plugin {0}", plugin.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plugin.OnUninstalling();
|
plugin.OnUninstalling();
|
||||||
|
|
||||||
// Remove it the quick way for now
|
// Remove it the quick way for now
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Model.Plugins;
|
using MediaBrowser.Model.Plugins;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
|
@ -49,6 +50,11 @@ namespace MediaBrowser.Common.Plugins
|
||||||
/// <value>The data folder path.</value>
|
/// <value>The data folder path.</value>
|
||||||
public string DataFolderPath { get; private set; }
|
public string DataFolderPath { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the plugin can be uninstalled.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanUninstall => !Path.GetDirectoryName(AssemblyFilePath).Equals(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), StringComparison.InvariantCulture);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin info.
|
/// Gets the plugin info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,7 +66,8 @@ namespace MediaBrowser.Common.Plugins
|
||||||
Name = Name,
|
Name = Name,
|
||||||
Version = Version.ToString(),
|
Version = Version.ToString(),
|
||||||
Description = Description,
|
Description = Description,
|
||||||
Id = Id.ToString()
|
Id = Id.ToString(),
|
||||||
|
CanUninstall = CanUninstall
|
||||||
};
|
};
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -40,6 +40,11 @@ namespace MediaBrowser.Common.Plugins
|
||||||
/// <value>The assembly file path.</value>
|
/// <value>The assembly file path.</value>
|
||||||
string AssemblyFilePath { get; }
|
string AssemblyFilePath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the plugin can be uninstalled.
|
||||||
|
/// </summary>
|
||||||
|
bool CanUninstall { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed.
|
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -35,6 +35,12 @@ namespace MediaBrowser.Model.Plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The unique id.</value>
|
/// <value>The unique id.</value>
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the plugin can be uninstalled.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanUninstall { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the image URL.
|
/// Gets or sets the image URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue