|
@@ -323,43 +323,6 @@ 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;
|
|
@@ -388,39 +351,11 @@ 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())
|
|
|
- {
|
|
|
- DeleteFilesByName(bowerPath, ignore.Item1, ignore.Item2);
|
|
|
- }
|
|
|
-
|
|
|
- DeleteFoldersByName(bowerPath, "demo");
|
|
|
- DeleteFoldersByName(bowerPath, "test");
|
|
|
- DeleteFoldersByName(bowerPath, "guides");
|
|
|
- DeleteFoldersByName(bowerPath, "grunt");
|
|
|
- DeleteFoldersByName(bowerPath, "rollups");
|
|
|
-
|
|
|
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
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
|
|
@@ -429,58 +364,9 @@ namespace MediaBrowser.WebDashboard.Api
|
|
|
|
|
|
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)
|