aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/Api/PackageCreator.cs
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-05-17 13:50:44 -0400
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-05-17 13:50:44 -0400
commit96acd6481efb25c6f23bc9dd92adaa8da637ab0b (patch)
tree6c72c60a99e0376fd17980651b1f0f888270f028 /MediaBrowser.WebDashboard/Api/PackageCreator.cs
parent0fb78cf54b51843c54e7ff59d191c490a5b196cd (diff)
parent4b4b50f3eedc5be92786cc9d4e0d244999107426 (diff)
Merge branch 'master' into externalid-type
Diffstat (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs')
-rw-r--r--MediaBrowser.WebDashboard/Api/PackageCreator.cs22
1 files changed, 16 insertions, 6 deletions
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index ad996c5a9..b7c15a840 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -31,7 +31,8 @@ namespace MediaBrowser.WebDashboard.Api
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;
@@ -47,16 +48,25 @@ namespace MediaBrowser.WebDashboard.Api
return string.Equals(Path.GetExtension(path), ".html", StringComparison.OrdinalIgnoreCase);
}
- // Modifies the HTML by adding common meta tags, css and js.
- public async Task<Stream> ModifyHtml(
- string path,
+ /// <summary>
+ /// Modifies the source HTML stream by adding common meta tags, css and js.
+ /// </summary>
+ /// <param name="isMainIndexPage">True if the stream contains content for the main index page.</param>
+ /// <param name="sourceStream">The stream whose content should be modified.</param>
+ /// <param name="mode">The client mode ('cordova', 'android', etc).</param>
+ /// <param name="appVersion">The application version.</param>
+ /// <param name="localizationCulture">The localization culture.</param>
+ /// <returns>
+ /// A task that represents the async operation to read and modify the input stream.
+ /// The task result contains a stream containing the modified HTML content.
+ /// </returns>
+ public static async Task<Stream> ModifyHtml(
+ bool isMainIndexPage,
Stream sourceStream,
string mode,
string appVersion,
string localizationCulture)
{
- var isMainIndexPage = string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase);
-
string html;
using (var reader = new StreamReader(sourceStream, Encoding.UTF8))
{