retarget dashboard project
This commit is contained in:
parent
675b643115
commit
b30c58f825
|
@ -49,6 +49,19 @@ namespace MediaBrowser.Common.Implementations.IO
|
|||
}
|
||||
}
|
||||
|
||||
public char DirectorySeparatorChar
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFullPath(string path)
|
||||
{
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified filename is shortcut.
|
||||
/// </summary>
|
||||
|
|
|
@ -297,6 +297,10 @@ namespace MediaBrowser.Model.IO
|
|||
IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false);
|
||||
|
||||
void SetHidden(string path, bool isHidden);
|
||||
|
||||
char DirectorySeparatorChar { get; }
|
||||
|
||||
string GetFullPath(string path);
|
||||
}
|
||||
|
||||
public enum FileOpenMode
|
||||
|
|
|
@ -334,11 +334,17 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
// Try to trim the output size a bit
|
||||
var bowerPath = Path.Combine(path, "bower_components");
|
||||
|
||||
GetDeployIgnoreExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));
|
||||
foreach (var ext in GetDeployIgnoreExtensions())
|
||||
{
|
||||
DeleteFilesByExtension(bowerPath, ext);
|
||||
}
|
||||
|
||||
DeleteFilesByExtension(bowerPath, ".json", "strings\\");
|
||||
|
||||
GetDeployIgnoreFilenames().ForEach(i => DeleteFilesByName(bowerPath, i.Item1, i.Item2));
|
||||
foreach (var ignore in GetDeployIgnoreFilenames())
|
||||
{
|
||||
DeleteFilesByName(bowerPath, ignore.Item1, ignore.Item2);
|
||||
}
|
||||
|
||||
DeleteFoldersByName(bowerPath, "demo");
|
||||
DeleteFoldersByName(bowerPath, "test");
|
||||
|
|
|
@ -59,20 +59,6 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
resourceStream = await ModifyHtml(path, resourceStream, mode, appVersion, localizationCulture, enableMinification).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else if (IsFormat(path, "js"))
|
||||
{
|
||||
if (path.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
resourceStream = await ModifyJs(resourceStream, enableMinification).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else if (IsFormat(path, "css"))
|
||||
{
|
||||
if (path.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
resourceStream = await ModifyCss(resourceStream, enableMinification).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resourceStream;
|
||||
|
@ -115,11 +101,11 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
{
|
||||
var rootPath = DashboardUIPath;
|
||||
|
||||
var fullPath = Path.Combine(rootPath, virtualPath.Replace('/', Path.DirectorySeparatorChar));
|
||||
var fullPath = Path.Combine(rootPath, virtualPath.Replace('/', _fileSystem.DirectorySeparatorChar));
|
||||
|
||||
try
|
||||
{
|
||||
fullPath = Path.GetFullPath(fullPath);
|
||||
fullPath = _fileSystem.GetFullPath(fullPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -135,44 +121,6 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
return fullPath;
|
||||
}
|
||||
|
||||
public async Task<Stream> ModifyCss(Stream sourceStream, bool enableMinification)
|
||||
{
|
||||
using (sourceStream)
|
||||
{
|
||||
string content;
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
await sourceStream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||
|
||||
content = Encoding.UTF8.GetString(memoryStream.ToArray());
|
||||
}
|
||||
|
||||
var bytes = Encoding.UTF8.GetBytes(content);
|
||||
|
||||
return new MemoryStream(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Stream> ModifyJs(Stream sourceStream, bool enableMinification)
|
||||
{
|
||||
using (sourceStream)
|
||||
{
|
||||
string content;
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
await sourceStream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||
|
||||
content = Encoding.UTF8.GetString(memoryStream.ToArray());
|
||||
}
|
||||
|
||||
var bytes = Encoding.UTF8.GetBytes(content);
|
||||
|
||||
return new MemoryStream(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCoreHtml(string path)
|
||||
{
|
||||
if (path.IndexOf(".template.html", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
|
@ -209,7 +157,9 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
{
|
||||
await sourceStream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||
|
||||
html = Encoding.UTF8.GetString(memoryStream.ToArray());
|
||||
var originalBytes = memoryStream.ToArray();
|
||||
|
||||
html = Encoding.UTF8.GetString(originalBytes, 0, originalBytes.Length);
|
||||
|
||||
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
{
|
||||
"supports": {
|
||||
"net46.app": {},
|
||||
"uwp.10.0.app": {},
|
||||
"dnxcore50.app": {}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore": "5.0.0",
|
||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.0"
|
||||
},
|
||||
{
|
||||
"supports": {},
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"dotnet": {
|
||||
"imports": "portable-net452+win81"
|
||||
}
|
||||
".NETPortable,Version=v4.5,Profile=Profile7": {}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user