support dynamic bower path

pull/702/head
Luke Pulverenti 9 years ago
parent 9c31e7a933
commit 33dffd2943

@ -637,7 +637,11 @@ namespace MediaBrowser.Api.Images
ResponseHeaders = headers,
ContentType = imageResult.Item2,
IsHeadRequest = isHeadRequest,
Path = imageResult.Item1
Path = imageResult.Item1,
// Sometimes imagemagick keeps a hold on the file briefly even after it's done writing to it.
// I'd rather do this than add a delay after saving the file
FileShare = FileShare.ReadWrite
});
}

@ -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");

@ -368,7 +368,7 @@
<Content Include="dashboard-ui\apiclient\wakeonlan.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\emby-icons.html">
<Content Include="dashboard-ui\bower_components\emby-icons\emby-icons.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\hls.min.js">

Loading…
Cancel
Save