mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	Removal of IPluginConfigurationPage
This commit is contained in:
		
							parent
							
								
									7acee4070e
								
							
						
					
					
						commit
						c6aa6ceed9
					
				| @ -62,32 +62,7 @@ namespace Jellyfin.Api.Controllers | |||||||
|             [FromQuery] bool? enableInMainMenu, |             [FromQuery] bool? enableInMainMenu, | ||||||
|             [FromQuery] ConfigurationPageType? pageType) |             [FromQuery] ConfigurationPageType? pageType) | ||||||
|         { |         { | ||||||
|             const string unavailableMessage = "The server is still loading. Please try again momentarily."; |             var configPages = _pluginManager.Plugins.SelectMany(GetConfigPages).ToList(); | ||||||
| 
 |  | ||||||
|             var pages = _appHost.GetExports<IPluginConfigurationPage>().ToList(); |  | ||||||
| 
 |  | ||||||
|             if (pages == null) |  | ||||||
|             { |  | ||||||
|                 return NotFound(unavailableMessage); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             // Don't allow a failing plugin to fail them all |  | ||||||
|             var configPages = pages.Select(p => |  | ||||||
|                 { |  | ||||||
|                     try |  | ||||||
|                     { |  | ||||||
|                         return new ConfigurationPageInfo(p); |  | ||||||
|                     } |  | ||||||
|                     catch (Exception ex) |  | ||||||
|                     { |  | ||||||
|                         _logger.LogError(ex, "Error getting plugin information from {Plugin}", p.GetType().Name); |  | ||||||
|                         return null; |  | ||||||
|                     } |  | ||||||
|                 }) |  | ||||||
|                 .Where(i => i != null) |  | ||||||
|                 .ToList(); |  | ||||||
| 
 |  | ||||||
|             configPages.AddRange(_pluginManager.Plugins.SelectMany(GetConfigPages)); |  | ||||||
| 
 | 
 | ||||||
|             if (pageType.HasValue) |             if (pageType.HasValue) | ||||||
|             { |             { | ||||||
| @ -121,24 +96,14 @@ namespace Jellyfin.Api.Controllers | |||||||
|             var isJs = false; |             var isJs = false; | ||||||
|             var isTemplate = false; |             var isTemplate = false; | ||||||
| 
 | 
 | ||||||
|             var page = _appHost.GetExports<IPluginConfigurationPage>().FirstOrDefault(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)); |             var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase)); | ||||||
|             if (page != null) |             if (altPage != null) | ||||||
|             { |             { | ||||||
|                 plugin = page.Plugin; |                 plugin = altPage.Item2; | ||||||
|                 stream = page.GetHtmlStream(); |                 stream = plugin.GetType().Assembly.GetManifestResourceStream(altPage.Item1.EmbeddedResourcePath); | ||||||
|             } |  | ||||||
| 
 | 
 | ||||||
|             if (plugin == null) |                 isJs = string.Equals(Path.GetExtension(altPage.Item1.EmbeddedResourcePath), ".js", StringComparison.OrdinalIgnoreCase); | ||||||
|             { |                 isTemplate = altPage.Item1.EmbeddedResourcePath.EndsWith(".template.html", StringComparison.Ordinal); | ||||||
|                 var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase)); |  | ||||||
|                 if (altPage != null) |  | ||||||
|                 { |  | ||||||
|                     plugin = altPage.Item2; |  | ||||||
|                     stream = plugin.GetType().Assembly.GetManifestResourceStream(altPage.Item1.EmbeddedResourcePath); |  | ||||||
| 
 |  | ||||||
|                     isJs = string.Equals(Path.GetExtension(altPage.Item1.EmbeddedResourcePath), ".js", StringComparison.OrdinalIgnoreCase); |  | ||||||
|                     isTemplate = altPage.Item1.EmbeddedResourcePath.EndsWith(".template.html", StringComparison.Ordinal); |  | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (plugin != null && stream != null) |             if (plugin != null && stream != null) | ||||||
|  | |||||||
| @ -10,23 +10,6 @@ namespace Jellyfin.Api.Models | |||||||
|     /// </summary> |     /// </summary> | ||||||
|     public class ConfigurationPageInfo |     public class ConfigurationPageInfo | ||||||
|     { |     { | ||||||
|         /// <summary> |  | ||||||
|         /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <param name="page">Instance of <see cref="IPluginConfigurationPage"/> interface.</param> |  | ||||||
|         public ConfigurationPageInfo(IPluginConfigurationPage page) |  | ||||||
|         { |  | ||||||
|             Name = page.Name; |  | ||||||
| 
 |  | ||||||
|             ConfigurationPageType = page.ConfigurationPageType; |  | ||||||
| 
 |  | ||||||
|             if (page.Plugin != null) |  | ||||||
|             { |  | ||||||
|                 DisplayName = page.Plugin.Name; |  | ||||||
|                 PluginId = page.Plugin.Id; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. |         /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. | ||||||
|         /// </summary> |         /// </summary> | ||||||
|  | |||||||
| @ -3,36 +3,6 @@ using MediaBrowser.Common.Plugins; | |||||||
| 
 | 
 | ||||||
| namespace MediaBrowser.Controller.Plugins | namespace MediaBrowser.Controller.Plugins | ||||||
| { | { | ||||||
|     /// <summary> |  | ||||||
|     /// Interface IConfigurationPage. |  | ||||||
|     /// </summary> |  | ||||||
|     public interface IPluginConfigurationPage |  | ||||||
|     { |  | ||||||
|         /// <summary> |  | ||||||
|         /// Gets the name. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <value>The name.</value> |  | ||||||
|         string Name { get; } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Gets the type of the configuration page. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <value>The type of the configuration page.</value> |  | ||||||
|         ConfigurationPageType ConfigurationPageType { get; } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Gets the plugin. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <value>The plugin.</value> |  | ||||||
|         IPlugin Plugin { get; } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Gets the HTML stream. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <returns>Stream.</returns> |  | ||||||
|         Stream GetHtmlStream(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Enum ConfigurationPageType. |     /// Enum ConfigurationPageType. | ||||||
|     /// </summary> |     /// </summary> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user