jellyfin-plugin-sso/SSO-Auth/SSOPlugin.cs

119 lines
3.8 KiB
C#

using System;
using System.Collections.Generic;
using Jellyfin.Plugin.SSO_Auth.Config;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
namespace Jellyfin.Plugin.SSO_Auth;
/// <summary>
/// The SSO plugin class.
/// </summary>
public class SSOPlugin : BasePlugin<PluginConfiguration>, IPlugin, IHasWebPages
{
/// <summary>
/// Initializes a new instance of the <see cref="SSOPlugin"/> class.
/// </summary>
/// <param name="applicationPaths">Internal Jellyfin interface for the ApplicationPath.</param>
/// <param name="xmlSerializer">Internal Jellyfin interface for the XML information.</param>
public SSOPlugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
: base(applicationPaths, xmlSerializer)
{
Instance = this;
}
/// <summary>
/// Gets the instance of the SSO plugin.
/// </summary>
public static SSOPlugin Instance { get; private set; }
/// <summary>
/// Gets the name of the SSO plugin.
/// </summary>
public override string Name => "SSO-Auth";
/// <summary>
/// Gets the GUID of the SSO plugin.
/// </summary>
public override Guid Id => Guid.Parse("505ce9d1-d916-42fa-86ca-673ef241d7df");
/// <summary>
/// Returns the available internal web pages of this plugin.
/// </summary>
/// <returns>A list of internal webpages in this application.</returns>
public IEnumerable<PluginPageInfo> GetPages()
{
return new[]
{
new PluginPageInfo
{
Name = Name,
EmbeddedResourcePath = $"{GetType().Namespace}.Config.configPage.html"
},
new PluginPageInfo
{
Name = Name + ".js",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.config.js"
},
new PluginPageInfo
{
Name = Name + ".css",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.style.css"
},
new PluginPageInfo
{
Name = Name + "-linking",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.linking.html"
},
new PluginPageInfo
{
Name = Name + "-linking.js",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.linking.js"
},
};
}
/// <summary>
/// Returns the available user views for this plugin.
/// </summary>
/// <returns>A list of user views for this plugin.</returns>
public IEnumerable<PluginPageInfo> GetViews()
{
return new[]
{
new PluginPageInfo
{
Name = "style.css",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.style.css"
},
new PluginPageInfo
{
Name = "linking",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.linking.html"
},
new PluginPageInfo
{
Name = "linking.js",
EmbeddedResourcePath = $"{GetType().Namespace}.Config.linking.js"
},
new PluginPageInfo
{
Name = "ApiClient.js",
EmbeddedResourcePath = $"{GetType().Namespace}.Views.apiClient.js"
},
new PluginPageInfo
{
Name = "emby-restyle.css",
EmbeddedResourcePath = $"{GetType().Namespace}.Views.emby-restyle.css"
},
new PluginPageInfo
{
Name = "jellyfin-apiClient.esm.min.js",
EmbeddedResourcePath = $"{GetType().Namespace}.Views.jellyfin-apiClient.esm.min.js"
},
};
}
}