aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/Api/DashboardService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.WebDashboard/Api/DashboardService.cs')
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs54
1 files changed, 23 insertions, 31 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 3a69c9666..34ad32111 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -133,7 +133,7 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
- public object Get(GetDashboardConfigurationPage request)
+ public Task<object> Get(GetDashboardConfigurationPage request)
{
var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
@@ -201,7 +201,7 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
- public object Get(GetDashboardResource request)
+ public async Task<object> Get(GetDashboardResource request)
{
var path = request.ResourceName;
@@ -230,7 +230,8 @@ namespace MediaBrowser.WebDashboard.Api
!contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase) &&
!contentType.StartsWith("font/", StringComparison.OrdinalIgnoreCase))
{
- return ResultFactory.GetResult(GetResourceStream(path, localizationCulture).Result, contentType);
+ var stream = await GetResourceStream(path, localizationCulture).ConfigureAwait(false);
+ return ResultFactory.GetResult(stream, contentType);
}
TimeSpan? cacheDuration = null;
@@ -246,7 +247,7 @@ namespace MediaBrowser.WebDashboard.Api
var cacheKey = (assembly.Version + (localizationCulture ?? string.Empty) + path).GetMD5();
- return ResultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(path, localizationCulture));
+ return await ResultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(path, localizationCulture)).ConfigureAwait(false);
}
private string GetLocalizationCulture()
@@ -316,7 +317,7 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFilesByExtension(bowerPath, ".txt");
DeleteFilesByExtension(bowerPath, ".map");
DeleteFilesByExtension(bowerPath, ".md");
- DeleteFilesByExtension(bowerPath, ".json");
+ DeleteFilesByExtension(bowerPath, ".json", "strings\\");
DeleteFilesByExtension(bowerPath, ".gz");
DeleteFilesByExtension(bowerPath, ".bat");
DeleteFilesByExtension(bowerPath, ".sh");
@@ -342,26 +343,22 @@ namespace MediaBrowser.WebDashboard.Api
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
- DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents"), "fonts");
+ DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "montserrat");
+ DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "opensans");
+ DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "roboto");
}
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true);
-
+ //_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "flash"), true);
+ //_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "specs"), true);
+
DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));
DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
- DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
- DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
- DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");
- DeleteFoldersByName(Path.Combine(bowerPath, "material-design-lite"), "src");
- DeleteFoldersByName(Path.Combine(bowerPath, "material-design-lite"), "utils");
- _fileSystem.DeleteFile(Path.Combine(bowerPath, "material-design-lite", "gulpfile.babel.js"));
-
- _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "marked"), true);
- _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "marked-element"), true);
- _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "prism"), true);
- _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "prism-element"), true);
+ //DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
+ //DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
+ //DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
@@ -399,7 +396,7 @@ namespace MediaBrowser.WebDashboard.Api
}
}
- private void DeleteFilesByExtension(string path, string extension)
+ private void DeleteFilesByExtension(string path, string extension, string exclude = null)
{
var files = _fileSystem.GetFiles(path, true)
.Where(i => string.Equals(i.Extension, extension, StringComparison.OrdinalIgnoreCase))
@@ -407,6 +404,13 @@ namespace MediaBrowser.WebDashboard.Api
foreach (var file in files)
{
+ if (!string.IsNullOrWhiteSpace(exclude))
+ {
+ if (file.FullName.IndexOf(exclude, StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ continue;
+ }
+ }
_fileSystem.DeleteFile(file.FullName);
}
}
@@ -515,18 +519,6 @@ namespace MediaBrowser.WebDashboard.Api
await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false);
}
-
- var excludeFiles = new List<string>();
-
- if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
- {
- excludeFiles.Add("supporterkey.html");
- }
-
- foreach (var file in excludeFiles)
- {
- _fileSystem.DeleteFile(Path.Combine(destination, file));
- }
}
private async Task DumpFile(string resourceVirtualPath, string destinationFilePath, string mode, string culture, string appVersion)