diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index d7bc83f3a..b91ba6b6c 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -286,7 +286,6 @@ namespace Emby.Server.Implementations
this,
ServerConfigurationManager.Configuration,
ApplicationPaths.PluginsPath,
- ApplicationPaths.CachePath,
ApplicationVersion);
}
diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs
index 151e2c203..4c508279c 100644
--- a/Emby.Server.Implementations/Plugins/PluginManager.cs
+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs
@@ -39,17 +39,15 @@ namespace Emby.Server.Implementations.Plugins
/// The .
/// The .
/// The plugin path.
- /// The image cache path.
/// The application version.
public PluginManager(
ILogger logger,
IApplicationHost appHost,
ServerConfiguration config,
string pluginsPath,
- string imagesPath,
Version appVersion)
{
- _logger = _logger ?? throw new ArgumentNullException(nameof(logger));
+ _logger = logger ?? throw new ArgumentNullException(nameof(logger));
_pluginsPath = pluginsPath;
_appVersion = appVersion ?? throw new ArgumentNullException(nameof(appVersion));
_jsonOptions = JsonDefaults.GetOptions();
@@ -509,17 +507,12 @@ namespace Emby.Server.Implementations.Plugins
targetAbi = _minimumVersion;
}
- if (!Version.TryParse(manifest.MaxAbi, out var maxAbi))
- {
- maxAbi = _appVersion;
- }
-
if (!Version.TryParse(manifest.Version, out version))
{
manifest.Version = _minimumVersion.ToString();
}
- return new LocalPlugin(dir, _appVersion >= targetAbi && _appVersion <= maxAbi, manifest);
+ return new LocalPlugin(dir, _appVersion >= targetAbi, manifest);
}
// No metafile, so lets see if the folder is versioned.
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 70424369b..cf059fb97 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -132,13 +132,8 @@ namespace Emby.Server.Implementations.Updates
targetAbi = minimumVersion;
}
- if (!Version.TryParse(ver.MaxAbi, out var maxAbi))
- {
- maxAbi = _applicationHost.ApplicationVersion;
- }
-
// Only show plugins that fall between targetAbi and maxAbi
- if (_applicationHost.ApplicationVersion >= targetAbi && _applicationHost.ApplicationVersion <= maxAbi)
+ if (_applicationHost.ApplicationVersion >= targetAbi)
{
continue;
}
@@ -200,19 +195,15 @@ namespace Emby.Server.Implementations.Updates
// Update the manifests, if anything changes.
if (plugin != null)
{
- bool noChange = string.Equals(plugin.Manifest.MaxAbi, version.MaxAbi, StringComparison.Ordinal)
- || string.Equals(plugin.Manifest.TargetAbi, version.TargetAbi, StringComparison.Ordinal);
- if (!noChange)
+ if (!string.Equals(plugin.Manifest.TargetAbi, version.TargetAbi, StringComparison.Ordinal))
{
- plugin.Manifest.MaxAbi = version.MaxAbi ?? string.Empty;
plugin.Manifest.TargetAbi = version.TargetAbi ?? string.Empty;
_pluginManager.SaveManifest(plugin.Manifest, plugin.Path);
}
}
// Remove versions with a target abi that is greater then the current application version.
- if ((Version.TryParse(version.TargetAbi, out var targetAbi) && _applicationHost.ApplicationVersion < targetAbi)
- || (Version.TryParse(version.MaxAbi, out var maxAbi) && _applicationHost.ApplicationVersion > maxAbi))
+ if (Version.TryParse(version.TargetAbi, out var targetAbi) && _applicationHost.ApplicationVersion < targetAbi)
{
package.Versions.RemoveAt(i);
}
@@ -283,8 +274,7 @@ namespace Emby.Server.Implementations.Updates
var appVer = _applicationHost.ApplicationVersion;
var availableVersions = package.Versions
- .Where(x => (string.IsNullOrEmpty(x.TargetAbi) || Version.Parse(x.TargetAbi) <= appVer)
- && (string.IsNullOrEmpty(x.MaxAbi) || Version.Parse(x.MaxAbi) >= appVer));
+ .Where(x => string.IsNullOrEmpty(x.TargetAbi) || Version.Parse(x.TargetAbi) <= appVer);
if (specificVersion != null)
{
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index 5750c59c4..e228ae7ec 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -1,5 +1,3 @@
-#pragma warning disable SA1402
-
using System;
using System.IO;
using System.Reflection;
@@ -94,212 +92,4 @@ namespace MediaBrowser.Common.Plugins
Id = assemblyId;
}
}
-
- ///
- /// Provides a common base class for all plugins.
- ///
- /// The type of the T configuration type.
- public abstract class BasePlugin : BasePlugin, IHasPluginConfiguration
- where TConfigurationType : BasePluginConfiguration
- {
- ///
- /// The configuration sync lock.
- ///
- private readonly object _configurationSyncLock = new object();
-
- ///
- /// The configuration save lock.
- ///
- private readonly object _configurationSaveLock = new object();
-
- private Action _directoryCreateFn;
-
- ///
- /// The configuration.
- ///
- private TConfigurationType _configuration;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The application paths.
- /// The XML serializer.
- protected BasePlugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
- {
- ApplicationPaths = applicationPaths;
- XmlSerializer = xmlSerializer;
- if (this is IPluginAssembly assemblyPlugin)
- {
- var assembly = GetType().Assembly;
- var assemblyName = assembly.GetName();
- var assemblyFilePath = assembly.Location;
-
- var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
- if (!Directory.Exists(dataFolderPath))
- {
- // Try again with the version number appended to the folder name.
- dataFolderPath = dataFolderPath + "_" + Version.ToString();
- }
-
- assemblyPlugin.SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
-
- var idAttributes = assembly.GetCustomAttributes(typeof(GuidAttribute), true);
- if (idAttributes.Length > 0)
- {
- var attribute = (GuidAttribute)idAttributes[0];
- var assemblyId = new Guid(attribute.Value);
-
- assemblyPlugin.SetId(assemblyId);
- }
- }
-
- if (this is IHasPluginConfiguration hasPluginConfiguration)
- {
- hasPluginConfiguration.SetStartupInfo(s => Directory.CreateDirectory(s));
- }
- }
-
- ///
- /// Gets the application paths.
- ///
- /// The application paths.
- protected IApplicationPaths ApplicationPaths { get; private set; }
-
- ///
- /// Gets the XML serializer.
- ///
- /// The XML serializer.
- protected IXmlSerializer XmlSerializer { get; private set; }
-
- ///
- /// Gets the type of configuration this plugin uses.
- ///
- /// The type of the configuration.
- public Type ConfigurationType => typeof(TConfigurationType);
-
- ///
- /// Gets or sets the event handler that is triggered when this configuration changes.
- ///
- public EventHandler ConfigurationChanged { get; set; }
-
- ///
- /// Gets the name the assembly file.
- ///
- /// The name of the assembly file.
- protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath);
-
- ///
- /// Gets or sets the plugin configuration.
- ///
- /// The configuration.
- public TConfigurationType Configuration
- {
- get
- {
- // Lazy load
- if (_configuration == null)
- {
- lock (_configurationSyncLock)
- {
- if (_configuration == null)
- {
- _configuration = LoadConfiguration();
- }
- }
- }
-
- return _configuration;
- }
-
- protected set => _configuration = value;
- }
-
- ///
- /// Gets the name of the configuration file. Subclasses should override.
- ///
- /// The name of the configuration file.
- public virtual string ConfigurationFileName => Path.ChangeExtension(AssemblyFileName, ".xml");
-
- ///
- /// Gets the full path to the configuration file.
- ///
- /// The configuration file path.
- public string ConfigurationFilePath { get; }
-
- ///
- /// Gets the plugin configuration.
- ///
- /// The configuration.
- BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration;
-
- ///
- public void SetStartupInfo(Action directoryCreateFn)
- {
- // hack alert, until the .net core transition is complete
- _directoryCreateFn = directoryCreateFn;
- }
-
- private TConfigurationType LoadConfiguration()
- {
- var path = ConfigurationFilePath;
-
- try
- {
- return (TConfigurationType)XmlSerializer.DeserializeFromFile(typeof(TConfigurationType), path);
- }
- catch
- {
- var config = (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
- SaveConfiguration(config);
- return config;
- }
- }
-
- ///
- /// Saves the current configuration to the file system.
- ///
- /// Configuration to save.
- public virtual void SaveConfiguration(TConfigurationType config)
- {
- lock (_configurationSaveLock)
- {
- _directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
-
- XmlSerializer.SerializeToFile(config, ConfigurationFilePath);
- }
- }
-
- ///
- /// Saves the current configuration to the file system.
- ///
- public virtual void SaveConfiguration()
- {
- SaveConfiguration(Configuration);
- }
-
- ///
- public virtual void UpdateConfiguration(BasePluginConfiguration configuration)
- {
- if (configuration == null)
- {
- throw new ArgumentNullException(nameof(configuration));
- }
-
- Configuration = (TConfigurationType)configuration;
-
- SaveConfiguration(Configuration);
-
- ConfigurationChanged?.Invoke(this, configuration);
- }
-
- ///
- public override PluginInfo GetPluginInfo()
- {
- var info = base.GetPluginInfo();
-
- info.ConfigurationFileName = ConfigurationFileName;
-
- return info;
- }
- }
}
diff --git a/MediaBrowser.Common/Plugins/BasePluginOfT.cs b/MediaBrowser.Common/Plugins/BasePluginOfT.cs
new file mode 100644
index 000000000..66aec92ab
--- /dev/null
+++ b/MediaBrowser.Common/Plugins/BasePluginOfT.cs
@@ -0,0 +1,218 @@
+#pragma warning disable SA1649 // File name should match first type name
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Model.Plugins;
+using MediaBrowser.Model.Serialization;
+
+namespace MediaBrowser.Common.Plugins
+{
+ ///
+ /// Provides a common base class for all plugins.
+ ///
+ /// The type of the T configuration type.
+ public abstract class BasePlugin : BasePlugin, IHasPluginConfiguration
+ where TConfigurationType : BasePluginConfiguration
+ {
+ ///
+ /// The configuration sync lock.
+ ///
+ private readonly object _configurationSyncLock = new object();
+
+ ///
+ /// The configuration save lock.
+ ///
+ private readonly object _configurationSaveLock = new object();
+
+ private Action _directoryCreateFn;
+
+ ///
+ /// The configuration.
+ ///
+ private TConfigurationType _configuration;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The application paths.
+ /// The XML serializer.
+ protected BasePlugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
+ {
+ ApplicationPaths = applicationPaths;
+ XmlSerializer = xmlSerializer;
+ if (this is IPluginAssembly assemblyPlugin)
+ {
+ var assembly = GetType().Assembly;
+ var assemblyName = assembly.GetName();
+ var assemblyFilePath = assembly.Location;
+
+ var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
+ if (!Directory.Exists(dataFolderPath))
+ {
+ // Try again with the version number appended to the folder name.
+ dataFolderPath = dataFolderPath + "_" + Version.ToString();
+ }
+
+ assemblyPlugin.SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
+
+ var idAttributes = assembly.GetCustomAttributes(typeof(GuidAttribute), true);
+ if (idAttributes.Length > 0)
+ {
+ var attribute = (GuidAttribute)idAttributes[0];
+ var assemblyId = new Guid(attribute.Value);
+
+ assemblyPlugin.SetId(assemblyId);
+ }
+ }
+
+ if (this is IHasPluginConfiguration hasPluginConfiguration)
+ {
+ hasPluginConfiguration.SetStartupInfo(s => Directory.CreateDirectory(s));
+ }
+ }
+
+ ///
+ /// Gets the application paths.
+ ///
+ /// The application paths.
+ protected IApplicationPaths ApplicationPaths { get; private set; }
+
+ ///
+ /// Gets the XML serializer.
+ ///
+ /// The XML serializer.
+ protected IXmlSerializer XmlSerializer { get; private set; }
+
+ ///
+ /// Gets the type of configuration this plugin uses.
+ ///
+ /// The type of the configuration.
+ public Type ConfigurationType => typeof(TConfigurationType);
+
+ ///
+ /// Gets or sets the event handler that is triggered when this configuration changes.
+ ///
+ public EventHandler ConfigurationChanged { get; set; }
+
+ ///
+ /// Gets the name the assembly file.
+ ///
+ /// The name of the assembly file.
+ protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath);
+
+ ///
+ /// Gets or sets the plugin configuration.
+ ///
+ /// The configuration.
+ public TConfigurationType Configuration
+ {
+ get
+ {
+ // Lazy load
+ if (_configuration == null)
+ {
+ lock (_configurationSyncLock)
+ {
+ if (_configuration == null)
+ {
+ _configuration = LoadConfiguration();
+ }
+ }
+ }
+
+ return _configuration;
+ }
+
+ protected set => _configuration = value;
+ }
+
+ ///
+ /// Gets the name of the configuration file. Subclasses should override.
+ ///
+ /// The name of the configuration file.
+ public virtual string ConfigurationFileName => Path.ChangeExtension(AssemblyFileName, ".xml");
+
+ ///
+ /// Gets the full path to the configuration file.
+ ///
+ /// The configuration file path.
+ public string ConfigurationFilePath { get; }
+
+ ///
+ /// Gets the plugin configuration.
+ ///
+ /// The configuration.
+ BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration;
+
+ ///
+ public void SetStartupInfo(Action directoryCreateFn)
+ {
+ // hack alert, until the .net core transition is complete
+ _directoryCreateFn = directoryCreateFn;
+ }
+
+ ///
+ /// Saves the current configuration to the file system.
+ ///
+ /// Configuration to save.
+ public virtual void SaveConfiguration(TConfigurationType config)
+ {
+ lock (_configurationSaveLock)
+ {
+ _directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
+
+ XmlSerializer.SerializeToFile(config, ConfigurationFilePath);
+ }
+ }
+
+ ///
+ /// Saves the current configuration to the file system.
+ ///
+ public virtual void SaveConfiguration()
+ {
+ SaveConfiguration(Configuration);
+ }
+
+ ///
+ public virtual void UpdateConfiguration(BasePluginConfiguration configuration)
+ {
+ if (configuration == null)
+ {
+ throw new ArgumentNullException(nameof(configuration));
+ }
+
+ Configuration = (TConfigurationType)configuration;
+
+ SaveConfiguration(Configuration);
+
+ ConfigurationChanged?.Invoke(this, configuration);
+ }
+
+ ///
+ public override PluginInfo GetPluginInfo()
+ {
+ var info = base.GetPluginInfo();
+
+ info.ConfigurationFileName = ConfigurationFileName;
+
+ return info;
+ }
+
+ private TConfigurationType LoadConfiguration()
+ {
+ var path = ConfigurationFilePath;
+
+ try
+ {
+ return (TConfigurationType)XmlSerializer.DeserializeFromFile(typeof(TConfigurationType), path);
+ }
+ catch
+ {
+ var config = (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
+ SaveConfiguration(config);
+ return config;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Updates/VersionInfo.cs b/MediaBrowser.Model/Updates/VersionInfo.cs
index 503dba0a1..209092265 100644
--- a/MediaBrowser.Model/Updates/VersionInfo.cs
+++ b/MediaBrowser.Model/Updates/VersionInfo.cs
@@ -43,13 +43,6 @@ namespace MediaBrowser.Model.Updates
[JsonPropertyName("targetAbi")]
public string? TargetAbi { get; set; }
- ///
- /// Gets or sets the maximum ABI that this version will work with.
- ///
- /// The target ABI version.
- [JsonPropertyName("maxAbi")]
- public string? MaxAbi { get; set; }
-
///
/// Gets or sets the source URL.
///