|
|
|
@ -197,6 +197,8 @@ namespace MediaBrowser.WebDashboard.Api
|
|
|
|
|
{
|
|
|
|
|
var path = request.ResourceName;
|
|
|
|
|
|
|
|
|
|
path = path.Replace("bower_components" + _appHost.ApplicationVersion, "bower_components", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
var contentType = MimeTypes.GetMimeType(path);
|
|
|
|
|
|
|
|
|
|
// Bounce them to the startup wizard if it hasn't been completed yet
|
|
|
|
@ -263,22 +265,6 @@ namespace MediaBrowser.WebDashboard.Api
|
|
|
|
|
return new PackageCreator(_fileSystem, _localization, Logger, _serverConfigurationManager, _jsonSerializer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Determines whether the specified path is HTML.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path">The path.</param>
|
|
|
|
|
/// <returns><c>true</c> if the specified path is HTML; otherwise, <c>false</c>.</returns>
|
|
|
|
|
private bool IsHtml(string path)
|
|
|
|
|
{
|
|
|
|
|
return Path.GetExtension(path).EndsWith("html", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CopyFile(string src, string dst)
|
|
|
|
|
{
|
|
|
|
|
_fileSystem.CreateDirectory(Path.GetDirectoryName(dst));
|
|
|
|
|
_fileSystem.CopyFile(src, dst, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<object> Get(GetDashboardPackage request)
|
|
|
|
|
{
|
|
|
|
|
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
|
|
|
|
@ -310,6 +296,14 @@ namespace MediaBrowser.WebDashboard.Api
|
|
|
|
|
|
|
|
|
|
// Try to trim the output size a bit
|
|
|
|
|
var bowerPath = Path.Combine(path, "bower_components");
|
|
|
|
|
|
|
|
|
|
if (!string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var versionedBowerPath = Path.Combine(Path.GetDirectoryName(bowerPath), "bower_components" + _appHost.ApplicationVersion);
|
|
|
|
|
Directory.Move(bowerPath, versionedBowerPath);
|
|
|
|
|
bowerPath = versionedBowerPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeleteFilesByExtension(bowerPath, ".log");
|
|
|
|
|
DeleteFilesByExtension(bowerPath, ".txt");
|
|
|
|
|
DeleteFilesByExtension(bowerPath, ".map");
|
|
|
|
|