diff options
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/DashboardService.cs | 9 | ||||
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/PackageCreator.cs | 49 | ||||
| -rw-r--r-- | MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 4 | ||||
| -rw-r--r-- | SharedVersion.cs | 2 |
4 files changed, 49 insertions, 15 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index ce8ad58dd..6eed91b6c 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -200,9 +200,11 @@ namespace MediaBrowser.WebDashboard.Api var isHtml = IsHtml(path); - if (isHtml && !_serverConfigurationManager.Configuration.IsStartupWizardCompleted) + // Bounce them to the startup wizard if it hasn't been completed yet + if (isHtml && !_serverConfigurationManager.Configuration.IsStartupWizardCompleted && path.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1) { - if (path.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1) + // But don't redirect if an html import is being requested. + if (path.IndexOf("vulcanize", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1) { Request.Response.Redirect("wizardstart.html"); return null; @@ -317,8 +319,9 @@ namespace MediaBrowser.WebDashboard.Api Directory.Delete(Path.Combine(path, "bower_components"), true); Directory.Delete(Path.Combine(path, "thirdparty", "viblast"), true); - + // But we do need this + CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.js")); CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js")); CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "velocity", "velocity.min.js"), Path.Combine(path, "bower_components", "velocity", "velocity.min.js")); CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "css"), Path.Combine(path, "bower_components", "swipebox", "src", "css")); diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index c50f98c33..6cc838ac4 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -68,14 +68,14 @@ namespace MediaBrowser.WebDashboard.Api } else if (IsFormat(path, "js")) { - if (path.IndexOf("thirdparty", StringComparison.OrdinalIgnoreCase) == -1) + if (path.IndexOf("thirdparty", 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("thirdparty", StringComparison.OrdinalIgnoreCase) == -1) + if (path.IndexOf("thirdparty", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1) { resourceStream = await ModifyCss(resourceStream, enableMinification).ConfigureAwait(false); } @@ -269,11 +269,12 @@ namespace MediaBrowser.WebDashboard.Api html = _localization.LocalizeDocument(html, localizationCulture, GetLocalizationToken); - html = html.Replace("<html>", "<html lang=\"" + lang + "\">") - .Replace("<body>", "<body><paper-drawer-panel class=\"mainDrawerPanel mainDrawerPanelPreInit\" forceNarrow><div class=\"mainDrawer\" drawer></div><div main><div class=\"pageContainer\">") - .Replace("</body>", "</div></div></paper-drawer-panel></body>"); + html = html.Replace("<html>", "<html lang=\"" + lang + "\">"); } + html = html.Replace("<body>", "<body><paper-drawer-panel class=\"mainDrawerPanel mainDrawerPanelPreInit\" forceNarrow><div class=\"mainDrawer\" drawer></div><div main><div class=\"pageContainer\">") + .Replace("</body>", "</div></div></paper-drawer-panel></body>"); + if (enableMinification) { try @@ -314,7 +315,7 @@ namespace MediaBrowser.WebDashboard.Api // In chrome it is causing the body to be hidden while loading, which leads to width-check methods to return 0 for everything //imports = ""; - html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, version) + GetCommonJavascript(mode, version) + importsHtml); + html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, version) + GetInitialJavascript(mode, version) + importsHtml + GetCommonJavascript(mode, version)); var bytes = Encoding.UTF8.GetBytes(html); @@ -431,6 +432,35 @@ namespace MediaBrowser.WebDashboard.Api /// <param name="mode">The mode.</param> /// <param name="version">The version.</param> /// <returns>System.String.</returns> + private string GetInitialJavascript(string mode, Version version) + { + var builder = new StringBuilder(); + + var versionString = !string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ? "?v=" + version : string.Empty; + + var files = new List<string> + { + "bower_components/webcomponentsjs/webcomponents-lite.js" + versionString + }; + + if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) + { + files.Insert(0, "cordova.js"); + } + + var tags = files.Select(s => string.Format("<script src=\"{0}\"></script>", s)).ToArray(); + + builder.Append(string.Join(string.Empty, tags)); + + return builder.ToString(); + } + + /// <summary> + /// Gets the common javascript. + /// </summary> + /// <param name="mode">The mode.</param> + /// <param name="version">The version.</param> + /// <returns>System.String.</returns> private string GetCommonJavascript(string mode, Version version) { var builder = new StringBuilder(); @@ -463,15 +493,14 @@ 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); - await AppendResource(memoryStream, "thirdparty/jquery-2.1.1.min.js", newLineBytes).ConfigureAwait(false); + + await AppendResource(memoryStream, "thirdparty/require.js", newLineBytes).ConfigureAwait(false); + await AppendResource(memoryStream, "thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.min.js", newLineBytes).ConfigureAwait(false); await AppendResource(memoryStream, "thirdparty/browser.js", newLineBytes).ConfigureAwait(false); - await AppendResource(memoryStream, "thirdparty/require.js", newLineBytes).ConfigureAwait(false); - await AppendResource(memoryStream, "thirdparty/jquery.unveil-custom.js", newLineBytes).ConfigureAwait(false); var excludePhrases = new List<string>(); diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index c8c9c4d3c..09d4766e9 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -116,7 +116,9 @@ <Content Include="dashboard-ui\bower_components\webcomponentsjs\ShadowDOM.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\bower_components\webcomponentsjs\webcomponents-lite.js" />
+ <Content Include="dashboard-ui\bower_components\webcomponentsjs\webcomponents-lite.js">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="dashboard-ui\bower_components\webcomponentsjs\webcomponents-lite.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
diff --git a/SharedVersion.cs b/SharedVersion.cs index 7e3f785fe..06da826aa 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5666.9")] +[assembly: AssemblyVersion("3.0.5667.5")] |
