mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-22 05:30:46 +02:00
update components
This commit is contained in:
parent
67642b6f57
commit
fee7cbdc4a
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Startup.Common.Browser
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public static void OpenDashboard(IServerApplicationHost appHost, ILogger logger)
|
public static void OpenDashboard(IServerApplicationHost appHost, ILogger logger)
|
||||||
{
|
{
|
||||||
OpenDashboardPage("index.html#!/dashboard.html", appHost, logger);
|
OpenDashboardPage("dashboard.html", appHost, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
{
|
{
|
||||||
var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
|
var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false));
|
return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(null, page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
{
|
{
|
||||||
if (IsCoreHtml(path))
|
if (IsCoreHtml(path))
|
||||||
{
|
{
|
||||||
resourceStream = await ModifyHtml(resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false);
|
resourceStream = await ModifyHtml(path, resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsFormat(path, "js"))
|
else if (IsFormat(path, "js"))
|
||||||
|
@ -238,13 +238,14 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies the HTML by adding common meta tags, css and js.
|
/// Modifies the HTML by adding common meta tags, css and js.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="sourceStream">The source stream.</param>
|
/// <param name="sourceStream">The source stream.</param>
|
||||||
/// <param name="mode">The mode.</param>
|
/// <param name="mode">The mode.</param>
|
||||||
/// <param name="appVersion">The application version.</param>
|
/// <param name="appVersion">The application version.</param>
|
||||||
/// <param name="localizationCulture">The localization culture.</param>
|
/// <param name="localizationCulture">The localization culture.</param>
|
||||||
/// <param name="enableMinification">if set to <c>true</c> [enable minification].</param>
|
/// <param name="enableMinification">if set to <c>true</c> [enable minification].</param>
|
||||||
/// <returns>Task{Stream}.</returns>
|
/// <returns>Task{Stream}.</returns>
|
||||||
public async Task<Stream> ModifyHtml(Stream sourceStream, string mode, string appVersion, string localizationCulture, bool enableMinification)
|
public async Task<Stream> ModifyHtml(string path, Stream sourceStream, string mode, string appVersion, string localizationCulture, bool enableMinification)
|
||||||
{
|
{
|
||||||
using (sourceStream)
|
using (sourceStream)
|
||||||
{
|
{
|
||||||
|
@ -260,6 +261,12 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
{
|
{
|
||||||
html = ModifyForCordova(html);
|
html = ModifyForCordova(html);
|
||||||
}
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(path) && !string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase) && html.IndexOf("<html", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
var indexFile = File.ReadAllText(GetDashboardResourcePath("index.html"));
|
||||||
|
|
||||||
|
html = ReplaceFirst(indexFile, "<div class=\"mainAnimatedPage hide\"></div>", "<div class=\"mainAnimatedPage hide\">" + html + "</div>");
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(localizationCulture))
|
if (!string.IsNullOrWhiteSpace(localizationCulture))
|
||||||
{
|
{
|
||||||
|
@ -306,6 +313,16 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ReplaceFirst(string text, string search, string replace)
|
||||||
|
{
|
||||||
|
int pos = text.IndexOf(search, StringComparison.OrdinalIgnoreCase);
|
||||||
|
if (pos < 0)
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
return text.Substring(0, pos) + replace + text.Substring(pos + search.Length);
|
||||||
|
}
|
||||||
|
|
||||||
private string ModifyForCordova(string html)
|
private string ModifyForCordova(string html)
|
||||||
{
|
{
|
||||||
// Replace CORDOVA_REPLACE_SUPPORTER_SUBMIT_START
|
// Replace CORDOVA_REPLACE_SUPPORTER_SUBMIT_START
|
||||||
|
|
Loading…
Reference in a new issue