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.cs90
1 files changed, 7 insertions, 83 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 2f8b34879..4850b6fe0 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -289,7 +289,7 @@ namespace MediaBrowser.WebDashboard.Api
return list;
}
- private List<Tuple<string,bool>> GetDeployIgnoreFilenames()
+ private List<Tuple<string, bool>> GetDeployIgnoreFilenames()
{
var list = new List<Tuple<string, bool>>();
@@ -313,8 +313,11 @@ namespace MediaBrowser.WebDashboard.Api
public async Task<object> Get(GetDashboardPackage request)
{
- var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
- "webclient-dump");
+ var mode = request.Mode;
+
+ var path = string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ?
+ Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, "webclient-dump")
+ : "C:\\dev\\emby-web-mobile\\src";
try
{
@@ -333,8 +336,6 @@ namespace MediaBrowser.WebDashboard.Api
var appVersion = _appHost.ApplicationVersion.ToString();
- var mode = request.Mode;
-
// Try to trim the output size a bit
var bowerPath = Path.Combine(path, "bower_components");
@@ -372,11 +373,6 @@ namespace MediaBrowser.WebDashboard.Api
// 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);
}
- else
- {
- MinifyCssDirectory(path);
- MinifyJsDirectory(path);
- }
await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);
@@ -444,78 +440,6 @@ namespace MediaBrowser.WebDashboard.Api
}
}
- private void MinifyCssDirectory(string path)
- {
- foreach (var file in Directory.GetFiles(path, "*.css", SearchOption.AllDirectories))
- {
- if (file.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) != -1)
- {
- continue;
- }
- if (file.IndexOf("bower_", StringComparison.OrdinalIgnoreCase) != -1)
- {
- continue;
- }
-
- try
- {
- var text = _fileSystem.ReadAllText(file, Encoding.UTF8);
-
- var result = new KristensenCssMinifier().Minify(text, false, Encoding.UTF8);
-
- if (result.Errors.Count > 0)
- {
- Logger.Error("Error minifying css: " + result.Errors[0].Message);
- }
- else
- {
- text = result.MinifiedContent;
- _fileSystem.WriteAllText(file, text, Encoding.UTF8);
- }
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error minifying css", ex);
- }
- }
- }
-
- private void MinifyJsDirectory(string path)
- {
- foreach (var file in Directory.GetFiles(path, "*.js", SearchOption.AllDirectories))
- {
- if (file.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) != -1)
- {
- continue;
- }
- if (file.IndexOf("bower_", StringComparison.OrdinalIgnoreCase) != -1)
- {
- continue;
- }
-
- try
- {
- var text = _fileSystem.ReadAllText(file, Encoding.UTF8);
-
- var result = new CrockfordJsMinifier().Minify(text, false, Encoding.UTF8);
-
- if (result.Errors.Count > 0)
- {
- Logger.Error("Error minifying javascript: " + result.Errors[0].Message);
- }
- else
- {
- text = result.MinifiedContent;
- _fileSystem.WriteAllText(file, text, Encoding.UTF8);
- }
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error minifying css", ex);
- }
- }
- }
-
private async Task DumpHtml(string source, string destination, string mode, string culture, string appVersion)
{
foreach (var file in Directory.GetFiles(source, "*", SearchOption.TopDirectoryOnly))
@@ -528,7 +452,7 @@ namespace MediaBrowser.WebDashboard.Api
private async Task DumpFile(string resourceVirtualPath, string destinationFilePath, string mode, string culture, string appVersion)
{
- using (var stream = await GetPackageCreator().GetResource(resourceVirtualPath, mode, culture, appVersion, true).ConfigureAwait(false))
+ using (var stream = await GetPackageCreator().GetResource(resourceVirtualPath, mode, culture, appVersion, false).ConfigureAwait(false))
{
using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileMode.Create, FileAccess.Write, FileShare.Read))
{