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.cs138
1 files changed, 16 insertions, 122 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 7fcfbfb131..91c23f871a 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -76,6 +76,11 @@ namespace MediaBrowser.WebDashboard.Api
public string V { get; set; }
}
+ [Route("/favicon.ico", "GET")]
+ public class GetFavIcon
+ {
+ }
+
/// <summary>
/// Class DashboardService
/// </summary>
@@ -134,6 +139,14 @@ namespace MediaBrowser.WebDashboard.Api
_memoryStreamFactory = memoryStreamFactory;
}
+ public object Get(GetFavIcon request)
+ {
+ return Get(new GetDashboardResource
+ {
+ ResourceName = "favicon.ico"
+ });
+ }
+
/// <summary>
/// Gets the specified request.
/// </summary>
@@ -323,48 +336,11 @@ namespace MediaBrowser.WebDashboard.Api
return new PackageCreator(_fileSystem, _logger, _serverConfigurationManager, _memoryStreamFactory);
}
- private List<string> GetDeployIgnoreExtensions()
- {
- var list = new List<string>();
-
- list.Add(".log");
- list.Add(".txt");
- list.Add(".map");
- list.Add(".md");
- list.Add(".gz");
- list.Add(".bat");
- list.Add(".sh");
-
- return list;
- }
-
- private List<Tuple<string, bool>> GetDeployIgnoreFilenames()
- {
- var list = new List<Tuple<string, bool>>();
-
- list.Add(new Tuple<string, bool>("copying", true));
- list.Add(new Tuple<string, bool>("license", true));
- list.Add(new Tuple<string, bool>("license-mit", true));
- list.Add(new Tuple<string, bool>("gitignore", false));
- list.Add(new Tuple<string, bool>("npmignore", false));
- list.Add(new Tuple<string, bool>("jshintrc", false));
- list.Add(new Tuple<string, bool>("gruntfile", false));
- list.Add(new Tuple<string, bool>("bowerrc", false));
- list.Add(new Tuple<string, bool>("jscsrc", false));
- list.Add(new Tuple<string, bool>("hero.svg", false));
- list.Add(new Tuple<string, bool>("travis.yml", false));
- list.Add(new Tuple<string, bool>("build.js", false));
- list.Add(new Tuple<string, bool>("editorconfig", false));
- list.Add(new Tuple<string, bool>("gitattributes", false));
-
- return list;
- }
-
public async Task<object> Get(GetDashboardPackage request)
{
var mode = request.Mode;
- var path = string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ?
+ var path = !string.IsNullOrWhiteSpace(mode) ?
Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, "webclient-dump")
: "C:\\dev\\emby-web-mobile\\src";
@@ -388,101 +364,19 @@ namespace MediaBrowser.WebDashboard.Api
// Try to trim the output size a bit
var bowerPath = Path.Combine(path, "bower_components");
- foreach (var ext in GetDeployIgnoreExtensions())
- {
- DeleteFilesByExtension(bowerPath, ext);
- }
-
- DeleteFilesByExtension(bowerPath, ".json", "strings\\");
-
- foreach (var ignore in GetDeployIgnoreFilenames())
+ if (!string.IsNullOrWhiteSpace(mode))
{
- DeleteFilesByName(bowerPath, ignore.Item1, ignore.Item2);
- }
-
- DeleteFoldersByName(bowerPath, "demo");
- DeleteFoldersByName(bowerPath, "test");
- DeleteFoldersByName(bowerPath, "guides");
- DeleteFoldersByName(bowerPath, "grunt");
- DeleteFoldersByName(bowerPath, "rollups");
+ // Delete things that are unneeded in an attempt to keep the output as trim as possible
- if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
- {
- 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);
-
- 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");
-
- if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
- {
- // Delete things that are unneeded in an attempt to keep the output as trim as possible
_fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true);
}
await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);
- await DumpFile("css/all.css", Path.Combine(path, "css", "all.css"), mode, culture, appVersion).ConfigureAwait(false);
-
return "";
}
- private void DeleteCryptoFiles(string path)
- {
- var files = _fileSystem.GetFiles(path)
- .ToList();
-
- var keepFiles = new[] { "core-min.js", "md5-min.js", "sha1-min.js" };
-
- foreach (var file in files)
- {
- if (!keepFiles.Contains(file.Name, StringComparer.OrdinalIgnoreCase))
- {
- _fileSystem.DeleteFile(file.FullName);
- }
- }
- }
-
- 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))
- .ToList();
-
- foreach (var file in files)
- {
- if (!string.IsNullOrWhiteSpace(exclude))
- {
- if (file.FullName.IndexOf(exclude, StringComparison.OrdinalIgnoreCase) != -1)
- {
- continue;
- }
- }
- _fileSystem.DeleteFile(file.FullName);
- }
- }
-
- private void DeleteFilesByName(string path, string name, bool exact = false)
- {
- var files = _fileSystem.GetFiles(path, true)
- .Where(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase) || (!exact && i.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1))
- .ToList();
-
- foreach (var file in files)
- {
- _fileSystem.DeleteFile(file.FullName);
- }
- }
-
private void DeleteFoldersByName(string path, string name)
{
var directories = _fileSystem.GetDirectories(path, true)