diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-03-18 12:30:50 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-03-18 12:30:50 -0400 |
| commit | 5a750be1e3ee83cd46b7ca17742a844b03e55bf6 (patch) | |
| tree | d291ce62ed5f40608e293c336fd06ace6accc497 /MediaBrowser.WebDashboard/Api/PackageCreator.cs | |
| parent | 4863fc5b31462f0c582e5db23125112a4361bd4f (diff) | |
| parent | 641b85ad7b69d9dc5e853b99da51d1a10aefc095 (diff) | |
Merge pull request #1558 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.WebDashboard/Api/PackageCreator.cs')
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/PackageCreator.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 55f6ca7a4..726205671 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -261,11 +261,21 @@ namespace MediaBrowser.WebDashboard.Api { html = ModifyForCordova(html); } - else if (!string.IsNullOrWhiteSpace(path) && !string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase) && html.IndexOf("<html", StringComparison.OrdinalIgnoreCase) == -1) + else if (!string.IsNullOrWhiteSpace(path) && !string.Equals(path, "index.html", StringComparison.OrdinalIgnoreCase)) { - var indexFile = File.ReadAllText(GetDashboardResourcePath("index.html")); + var index = html.IndexOf("<body", StringComparison.OrdinalIgnoreCase); + if (index != -1) + { + html = html.Substring(index); + index = html.IndexOf("</body>", StringComparison.OrdinalIgnoreCase); + if (index != -1) + { + html = html.Substring(0, index+7); + } + } + var mainFile = File.ReadAllText(GetDashboardResourcePath("index.html")); - html = ReplaceFirst(indexFile, "<div class=\"mainAnimatedPage hide\"></div>", "<div class=\"mainAnimatedPage hide\">" + html + "</div>"); + html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPage hide\"></div>", "<div class=\"mainAnimatedPage hide\">" + html + "</div>"); } if (!string.IsNullOrWhiteSpace(localizationCulture)) @@ -305,6 +315,13 @@ namespace MediaBrowser.WebDashboard.Api html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, appVersion)); + // Disable embedded scripts from plugins. We'll run them later once resources have loaded + if (html.IndexOf("<script", StringComparison.OrdinalIgnoreCase) != -1) + { + html = html.Replace("<script", "<!--<script"); + html = html.Replace("</script>", "</script>-->"); + } + html = html.Replace("</body>", GetCommonJavascript(mode, appVersion) + "</body>"); var bytes = Encoding.UTF8.GetBytes(html); |
