diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-22 00:54:02 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-22 00:54:02 -0400 |
| commit | 54cf0da75826d641b28a34afece7a4cb0eaaaec2 (patch) | |
| tree | 8d6f313fe9d71a5ecaf7a235eff4c5db6e68990b /MediaBrowser.WebDashboard | |
| parent | 41ea0d99f4ee953d6e955c355cef0e5088f9b9fd (diff) | |
update query fields
Diffstat (limited to 'MediaBrowser.WebDashboard')
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/DashboardService.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/PackageCreator.cs | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index c6cdeb354..cf3e221b3 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -305,8 +305,6 @@ namespace MediaBrowser.WebDashboard.Api } } - path = path.Replace("scripts/jquery.mobile-1.4.5.min.map", "thirdparty/jquerymobile-1.4.5/jquery.mobile-1.4.5.min.map", StringComparison.OrdinalIgnoreCase); - var localizationCulture = GetLocalizationCulture(); // Don't cache if not configured to do so @@ -330,7 +328,13 @@ namespace MediaBrowser.WebDashboard.Api var cacheKey = (_appHost.ApplicationVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); - return await _resultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(basePath, path, localizationCulture)).ConfigureAwait(false); + // html gets modified on the fly + if (contentType.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) + { + return await _resultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(basePath, path, localizationCulture)).ConfigureAwait(false); + } + + return await _resultFactory.GetStaticFileResult(Request, GetPackageCreator(basePath).GetResourcePath(path)); } private string GetLocalizationCulture() diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 72389044b..ee911f0e9 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -68,7 +68,7 @@ namespace MediaBrowser.WebDashboard.Api /// Gets the dashboard resource path. /// </summary> /// <returns>System.String.</returns> - private string GetDashboardResourcePath(string virtualPath) + public string GetResourcePath(string virtualPath) { var fullPath = Path.Combine(_basePath, virtualPath.Replace('/', _fileSystem.DirectorySeparatorChar)); @@ -97,7 +97,7 @@ namespace MediaBrowser.WebDashboard.Api return false; } - path = GetDashboardResourcePath(path); + path = GetResourcePath(path); var parent = _fileSystem.GetDirectoryName(path); return string.Equals(_basePath, parent, StringComparison.OrdinalIgnoreCase) || @@ -140,7 +140,7 @@ namespace MediaBrowser.WebDashboard.Api html = html.Substring(0, index); } } - var mainFile = _fileSystem.ReadAllText(GetDashboardResourcePath("index.html")); + var mainFile = _fileSystem.ReadAllText(GetResourcePath("index.html")); html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPages skinBody\"></div>", "<div class=\"mainAnimatedPages skinBody hide\">" + html + "</div>"); } @@ -299,7 +299,7 @@ namespace MediaBrowser.WebDashboard.Api /// </summary> private Stream GetRawResourceStream(string virtualPath) { - return _fileSystem.GetFileStream(GetDashboardResourcePath(virtualPath), FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); + return _fileSystem.GetFileStream(GetResourcePath(virtualPath), FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); } } |
