mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 20:08:59 +02:00
Make PackageCreator.ModifyHtml() static and clean up XML documentation
This eliminates the need to create a dummy instance to call this method
This commit is contained in:
parent
6fbdf0d6a2
commit
7e3caec583
2 changed files with 10 additions and 8 deletions
|
@ -203,7 +203,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => Task.FromResult(stream));
|
return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => Task.FromResult(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersionString, null));
|
return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => PackageCreator.ModifyHtml(false, stream, null, _appHost.ApplicationVersionString, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
|
|
|
@ -28,7 +28,8 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
|
|
||||||
if (resourceStream != null && IsCoreHtml(virtualPath))
|
if (resourceStream != null && IsCoreHtml(virtualPath))
|
||||||
{
|
{
|
||||||
resourceStream = await ModifyHtml(virtualPath, resourceStream, mode, appVersion, localizationCulture).ConfigureAwait(false);
|
bool isMainIndexPage = string.Equals(virtualPath, "index.html", StringComparison.OrdinalIgnoreCase);
|
||||||
|
resourceStream = await ModifyHtml(isMainIndexPage, resourceStream, mode, appVersion, localizationCulture).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceStream;
|
return resourceStream;
|
||||||
|
@ -45,18 +46,19 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies the HTML by adding common meta tags, css and js.
|
/// Modifies the source HTML stream by adding common meta tags, css and js.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task{Stream}.</returns>
|
/// <returns>
|
||||||
public async Task<Stream> ModifyHtml(
|
/// A task that represents the async operation to read and modify the input stream.
|
||||||
string path,
|
/// The task result contains a stream containing the modified HTML content.
|
||||||
|
/// </returns>
|
||||||
|
public static async Task<Stream> ModifyHtml(
|
||||||
|
bool isMainIndexPage,
|
||||||
Stream sourceStream,
|
Stream sourceStream,
|
||||||
string mode,
|
string mode,
|
||||||
string appVersion,
|
string appVersion,
|
||||||
string localizationCulture)
|
string localizationCulture)
|
||||||
{
|
{
|
||||||
var isMainIndexPage = string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string html;
|
string html;
|
||||||
using (var reader = new StreamReader(sourceStream, Encoding.UTF8))
|
using (var reader = new StreamReader(sourceStream, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue