vulcanize
This commit is contained in:
parent
2341ce0983
commit
248cb80084
|
@ -272,6 +272,12 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
return Path.GetExtension(path).EndsWith("html", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private void CopyFile(string src, string dst)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(dst));
|
||||
File.Copy(src, dst, true);
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetDashboardPackage request)
|
||||
{
|
||||
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
|
||||
|
@ -299,20 +305,24 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Overwrite certain files with cordova specific versions
|
||||
var cordovaVersion = Path.Combine(path, "thirdparty", "cordova", "registrationservices.js");
|
||||
var cordovaVersion = Path.Combine(path, "cordova", "registrationservices.js");
|
||||
File.Copy(cordovaVersion, Path.Combine(path, "scripts", "registrationservices.js"), true);
|
||||
File.Delete(cordovaVersion);
|
||||
|
||||
// Delete things that are unneeded in an attempt to keep the output as trim as possible
|
||||
Directory.Delete(Path.Combine(path, "css", "images", "tour"), true);
|
||||
Directory.Delete(Path.Combine(path, "thirdparty", "apiclient", "alt"), true);
|
||||
Directory.Delete(Path.Combine(path, "apiclient", "alt"), true);
|
||||
|
||||
File.Delete(Path.Combine(path, "thirdparty", "jquerymobile-1.4.5", "jquery.mobile-1.4.5.min.map"));
|
||||
|
||||
Directory.Delete(Path.Combine(path, "bower_components"), true);
|
||||
// But we do need this
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"));
|
||||
}
|
||||
|
||||
MinifyCssDirectory(Path.Combine(path, "css"));
|
||||
MinifyJsDirectory(Path.Combine(path, "scripts"));
|
||||
MinifyJsDirectory(Path.Combine(path, "thirdparty", "apiclient"));
|
||||
MinifyJsDirectory(Path.Combine(path, "apiclient"));
|
||||
MinifyJsDirectory(Path.Combine(path, "voice"));
|
||||
|
||||
await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);
|
||||
|
|
|
@ -61,7 +61,10 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
// jQuery ajax doesn't seem to handle if-modified-since correctly
|
||||
if (IsFormat(path, "html"))
|
||||
{
|
||||
resourceStream = await ModifyHtml(resourceStream, mode, localizationCulture, enableMinification).ConfigureAwait(false);
|
||||
if (IsCoreHtml(path))
|
||||
{
|
||||
resourceStream = await ModifyHtml(resourceStream, mode, localizationCulture, enableMinification).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else if (IsFormat(path, "js"))
|
||||
{
|
||||
|
@ -210,6 +213,22 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsCoreHtml(string path)
|
||||
{
|
||||
if (path.IndexOf("vulcanize", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
path = GetDashboardResourcePath(path);
|
||||
var parent = Path.GetDirectoryName(path);
|
||||
|
||||
var basePath = DashboardUIPath;
|
||||
|
||||
return string.Equals(basePath, parent, StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(Path.Combine(basePath, "voice"), parent, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the HTML by adding common meta tags, css and js.
|
||||
/// </summary>
|
||||
|
@ -276,17 +295,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
|
||||
var imports = new string[]
|
||||
{
|
||||
"bower_components/paper-button/paper-button.html",
|
||||
"bower_components/paper-toast/paper-toast.html",
|
||||
"bower_components/paper-spinner/paper-spinner.html",
|
||||
"bower_components/paper-fab/paper-fab.html",
|
||||
"bower_components/paper-dialog/paper-dialog.html",
|
||||
"bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html",
|
||||
"bower_components/neon-animation/animations/scale-up-animation.html",
|
||||
"bower_components/neon-animation/animations/fade-out-animation.html",
|
||||
"bower_components/neon-animation/animations/fade-in-animation.html",
|
||||
"bower_components/paper-icon-button/paper-icon-button.html",
|
||||
"thirdparty/emby-icons.html"
|
||||
"vulcanize-out.html"
|
||||
};
|
||||
var importsHtml = string.Join("", imports.Select(i => "<link rel=\"import\" href=\"" + i + "\">").ToArray());
|
||||
|
||||
|
@ -412,7 +421,6 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
|
||||
var files = new List<string>
|
||||
{
|
||||
"bower_components/webcomponentsjs/webcomponents-lite.min.js",
|
||||
"scripts/all.js" + versionString
|
||||
};
|
||||
|
||||
|
@ -437,6 +445,8 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
var memoryStream = new MemoryStream();
|
||||
var newLineBytes = Encoding.UTF8.GetBytes(Environment.NewLine);
|
||||
|
||||
await AppendResource(memoryStream, "bower_components/webcomponentsjs/webcomponents-lite.min.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
// jQuery + jQuery mobile
|
||||
await AppendResource(memoryStream, "thirdparty/jquery-2.1.1.min.js", newLineBytes).ConfigureAwait(false);
|
||||
await AppendResource(memoryStream, "thirdparty/jquerymobile-1.4.5/jquery.mobile-1.4.5.min.js", newLineBytes).ConfigureAwait(false);
|
||||
|
@ -474,19 +484,19 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
|
||||
var apiClientFiles = new[]
|
||||
{
|
||||
"thirdparty/apiclient/logger.js",
|
||||
"thirdparty/apiclient/md5.js",
|
||||
"thirdparty/apiclient/sha1.js",
|
||||
"thirdparty/apiclient/store.js",
|
||||
"thirdparty/apiclient/device.js",
|
||||
"thirdparty/apiclient/credentials.js",
|
||||
"thirdparty/apiclient/ajax.js",
|
||||
"thirdparty/apiclient/events.js",
|
||||
"thirdparty/apiclient/deferred.js",
|
||||
"thirdparty/apiclient/apiclient.js"
|
||||
"apiclient/logger.js",
|
||||
"apiclient/md5.js",
|
||||
"apiclient/sha1.js",
|
||||
"apiclient/store.js",
|
||||
"apiclient/device.js",
|
||||
"apiclient/credentials.js",
|
||||
"apiclient/ajax.js",
|
||||
"apiclient/events.js",
|
||||
"apiclient/deferred.js",
|
||||
"apiclient/apiclient.js"
|
||||
}.ToList();
|
||||
|
||||
apiClientFiles.Add("thirdparty/apiclient/connectionmanager.js");
|
||||
apiClientFiles.Add("apiclient/connectionmanager.js");
|
||||
|
||||
foreach (var file in apiClientFiles)
|
||||
{
|
||||
|
|
|
@ -558,40 +558,40 @@
|
|||
<Content Include="dashboard-ui\scripts\sections.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\localassetmanager.js">
|
||||
<Content Include="dashboard-ui\apiclient\localassetmanager.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\wakeonlan.js">
|
||||
<Content Include="dashboard-ui\apiclient\wakeonlan.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\appstorage.js">
|
||||
<Content Include="dashboard-ui\cordova\android\appstorage.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\localassetmanager.js">
|
||||
<Content Include="dashboard-ui\cordova\android\localassetmanager.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\mediasession.js">
|
||||
<Content Include="dashboard-ui\cordova\android\mediasession.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\nativedirectorychooser.js">
|
||||
<Content Include="dashboard-ui\cordova\android\nativedirectorychooser.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\vlcplayer.js">
|
||||
<Content Include="dashboard-ui\cordova\android\vlcplayer.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\back.js">
|
||||
<Content Include="dashboard-ui\cordova\back.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\ios\actionsheet.js">
|
||||
<Content Include="dashboard-ui\cordova\ios\actionsheet.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\ios\orientation.js">
|
||||
<Content Include="dashboard-ui\cordova\ios\orientation.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\volume.js">
|
||||
<Content Include="dashboard-ui\cordova\volume.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\wakeonlan.js">
|
||||
<Content Include="dashboard-ui\cordova\wakeonlan.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\emby-icons.html">
|
||||
|
@ -729,75 +729,75 @@
|
|||
<Content Include="dashboard-ui\syncsettings.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\ajax.js">
|
||||
<Content Include="dashboard-ui\apiclient\ajax.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\alt\ajax.js">
|
||||
<Content Include="dashboard-ui\apiclient\alt\ajax.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\alt\bean.js">
|
||||
<Content Include="dashboard-ui\apiclient\alt\bean.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\alt\events.js">
|
||||
<Content Include="dashboard-ui\apiclient\alt\events.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\connectservice.js">
|
||||
<Content Include="dashboard-ui\apiclient\connectservice.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\androidcredentials.js">
|
||||
<Content Include="dashboard-ui\cordova\android\androidcredentials.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\filesystem.js">
|
||||
<Content Include="dashboard-ui\cordova\android\filesystem.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\iap.js">
|
||||
<Content Include="dashboard-ui\cordova\android\iap.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\android\immersive.js" />
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\chromecast.js">
|
||||
<Content Include="dashboard-ui\cordova\android\immersive.js" />
|
||||
<Content Include="dashboard-ui\cordova\chromecast.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\connectsdk.js">
|
||||
<Content Include="dashboard-ui\cordova\connectsdk.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\externalplayer.js">
|
||||
<Content Include="dashboard-ui\cordova\externalplayer.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\filesystem.js">
|
||||
<Content Include="dashboard-ui\cordova\filesystem.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\generaldevice.js" />
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\iap.js">
|
||||
<Content Include="dashboard-ui\cordova\generaldevice.js" />
|
||||
<Content Include="dashboard-ui\cordova\iap.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\imagestore.js">
|
||||
<Content Include="dashboard-ui\cordova\imagestore.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\registrationservices.js">
|
||||
<Content Include="dashboard-ui\cordova\registrationservices.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\remotecontrols.js">
|
||||
<Content Include="dashboard-ui\cordova\remotecontrols.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cordova\serverdiscovery.js">
|
||||
<Content Include="dashboard-ui\cordova\serverdiscovery.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\deferred.js">
|
||||
<Content Include="dashboard-ui\apiclient\deferred.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\alt\deferred.js">
|
||||
<Content Include="dashboard-ui\apiclient\alt\deferred.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\device.js">
|
||||
<Content Include="dashboard-ui\apiclient\device.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\events.js">
|
||||
<Content Include="dashboard-ui\apiclient\events.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\logger.js">
|
||||
<Content Include="dashboard-ui\apiclient\logger.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\apiclient.js">
|
||||
<Content Include="dashboard-ui\apiclient\apiclient.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\channelitems.html">
|
||||
|
@ -1412,19 +1412,19 @@
|
|||
<Content Include="dashboard-ui\serversecurity.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\connectionmanager.js">
|
||||
<Content Include="dashboard-ui\apiclient\connectionmanager.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\credentials.js">
|
||||
<Content Include="dashboard-ui\apiclient\credentials.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\serverdiscovery.js">
|
||||
<Content Include="dashboard-ui\apiclient\serverdiscovery.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\sha1.js">
|
||||
<Content Include="dashboard-ui\apiclient\sha1.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\store.js">
|
||||
<Content Include="dashboard-ui\apiclient\store.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\browser.js">
|
||||
|
@ -2069,7 +2069,7 @@
|
|||
<Content Include="dashboard-ui\livetvsuggested.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\apiclient\md5.js">
|
||||
<Content Include="dashboard-ui\apiclient\md5.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree3.0.8\jstree.min.js">
|
||||
|
@ -2132,6 +2132,12 @@
|
|||
<Content Include="dashboard-ui\userpassword.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\vulcanize-in.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\vulcanize-out.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\wizardagreement.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Reference in New Issue
Block a user