diff --git a/PlexRequests.Core/SettingModels/LandingPageSettings.cs b/PlexRequests.Core/SettingModels/LandingPageSettings.cs index 5d57136e8..81a20e9dd 100644 --- a/PlexRequests.Core/SettingModels/LandingPageSettings.cs +++ b/PlexRequests.Core/SettingModels/LandingPageSettings.cs @@ -30,7 +30,7 @@ using Newtonsoft.Json; namespace PlexRequests.Core.SettingModels { - public sealed class LandingPageSettings : Settings + public class LandingPageSettings : Settings { public bool Enabled { get; set; } public bool BeforeLogin { get; set; } diff --git a/PlexRequests.Core/SettingModels/ScheduledJobsSettings.cs b/PlexRequests.Core/SettingModels/ScheduledJobsSettings.cs index 1600a678c..6d895f6ef 100644 --- a/PlexRequests.Core/SettingModels/ScheduledJobsSettings.cs +++ b/PlexRequests.Core/SettingModels/ScheduledJobsSettings.cs @@ -26,7 +26,7 @@ #endregion namespace PlexRequests.Core.SettingModels { - public sealed class ScheduledJobsSettings : Settings + public class ScheduledJobsSettings : Settings { public ScheduledJobsSettings() { diff --git a/PlexRequests.UI/Bootstrapper.cs b/PlexRequests.UI/Bootstrapper.cs index 68d1452b6..6a6813550 100644 --- a/PlexRequests.UI/Bootstrapper.cs +++ b/PlexRequests.UI/Bootstrapper.cs @@ -116,10 +116,12 @@ namespace PlexRequests.UI var settings = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); var assetLocation = settings.GetSettings().BaseUrl; nancyConventions.StaticContentsConventions.Add( - StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content", "Content") + StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content") ); nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui"); + + nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts"); } protected override DiagnosticsConfiguration DiagnosticsConfiguration => new DiagnosticsConfiguration { Password = @"password" }; diff --git a/PlexRequests.UI/Content/font-awesome.css b/PlexRequests.UI/Content/font-awesome.css index 7f747bf2c..b2a5fe2f2 100644 --- a/PlexRequests.UI/Content/font-awesome.css +++ b/PlexRequests.UI/Content/font-awesome.css @@ -6,8 +6,8 @@ * -------------------------- */ @font-face { font-family: 'FontAwesome'; - src: url('../Content/fonts/fontawesome-webfont.eot?v=4.5.0'); - src: url('../Content/fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../Content/fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../Content/fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../Content/fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../Content/fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); + src: url('../fonts/fontawesome-webfont.eot?v=4.5.0'); + src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; } diff --git a/PlexRequests.UI/Content/requests-1.7.js b/PlexRequests.UI/Content/requests.js similarity index 100% rename from PlexRequests.UI/Content/requests-1.7.js rename to PlexRequests.UI/Content/requests.js diff --git a/PlexRequests.UI/Content/search-1.7.js b/PlexRequests.UI/Content/search.js similarity index 100% rename from PlexRequests.UI/Content/search-1.7.js rename to PlexRequests.UI/Content/search.js diff --git a/PlexRequests.UI/Content/site-1.7.js b/PlexRequests.UI/Content/site.js similarity index 100% rename from PlexRequests.UI/Content/site-1.7.js rename to PlexRequests.UI/Content/site.js diff --git a/PlexRequests.UI/Helpers/BaseUrlHelper.cs b/PlexRequests.UI/Helpers/BaseUrlHelper.cs index 12b137079..283956b1b 100644 --- a/PlexRequests.UI/Helpers/BaseUrlHelper.cs +++ b/PlexRequests.UI/Helpers/BaseUrlHelper.cs @@ -24,8 +24,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion - -using System.IO; +using System.Collections.Generic; using System.Text; using Nancy; using Nancy.ViewEngines.Razor; @@ -45,6 +44,20 @@ namespace PlexRequests.UI.Helpers } private static ICacheProvider Cache { get; } private static ServiceLocator Locator { get; } + private static string _Assembly; + + // We don't need to call the AssemblyHelper every time, the value will never change in the application life cycle. + private static string Assembly + { + get + { + if (string.IsNullOrEmpty(_Assembly)) + { + _Assembly = AssemblyHelper.GetProductVersion(); + } + return _Assembly; + } + } public static IHtmlString LoadAssets(this HtmlHelpers helper) { @@ -60,24 +73,44 @@ namespace PlexRequests.UI.Helpers if (settings.ThemeName == "PlexBootstrap.css") settings.ThemeName = Themes.PlexTheme; if (settings.ThemeName == "OriginalBootstrap.css") settings.ThemeName = Themes.OriginalTheme; - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); - sb.AppendLine($""); + var startUrl = $"{content}/Content_{Assembly}"; + + var styleAssets = new List + { + $"", + $"", + $"", + $"", + $"", + $"", + $"" + }; + + + var scriptAssets = new List + { + $"", + $"", + $"", + $"", + $"", + $"", + $"", + $"", + $"", + $"" + }; + + + foreach (var a in styleAssets) + { + sb.AppendLine(a); + } + + foreach (var a in scriptAssets) + { + sb.AppendLine(a); + } return helper.Raw(sb.ToString()); @@ -90,7 +123,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -102,7 +135,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -114,7 +147,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -124,7 +157,7 @@ namespace PlexRequests.UI.Helpers var assetLocation = GetBaseUrl(); var content = GetContentUrl(assetLocation); - var asset = $""; + var asset = $""; return helper.Raw(asset); } @@ -136,8 +169,8 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); - sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -153,68 +186,50 @@ namespace PlexRequests.UI.Helpers var assetLocation = GetBaseUrl(); var content = GetContentUrl(assetLocation); - var asset = $""; + var asset = $""; return helper.Raw(asset); } public static IHtmlString GetSidebarUrl(this HtmlHelpers helper, NancyContext context, string url, string title) { - var returnString = string.Empty; var content = GetLinkUrl(GetBaseUrl()); if (!string.IsNullOrEmpty(content)) { url = $"/{content}{url}"; } - if (context.Request.Path == url) - { - returnString = $"{title}"; - } - else - { - returnString = $"{title}"; - } + var returnString = context.Request.Path == url + ? $"{title}" + : $"{title}"; return helper.Raw(returnString); } public static IHtmlString GetNavbarUrl(this HtmlHelpers helper, NancyContext context, string url, string title, string fontIcon) { - var returnString = string.Empty; var content = GetLinkUrl(GetBaseUrl()); if (!string.IsNullOrEmpty(content)) { url = $"/{content}{url}"; } - if (context.Request.Path == url) - { - returnString = $"
  • {title}
  • "; - } - else - { - returnString = $"
  • {title}
  • "; - } + var returnString = context.Request.Path == url ? + $"
  • {title}
  • " + : $"
  • {title}
  • "; return helper.Raw(returnString); } public static IHtmlString GetNavbarUrl(this HtmlHelpers helper, NancyContext context, string url, string title, string fontIcon, string extraHtml) { - var returnString = string.Empty; var content = GetLinkUrl(GetBaseUrl()); if (!string.IsNullOrEmpty(content)) { url = $"/{content}{url}"; } - if (context.Request.Path == url) - { - returnString = $"
  • {title} {extraHtml}
  • "; - } - else - { - returnString = $"
  • {title} {extraHtml}
  • "; - } + var returnString = context.Request.Path == url + ? $"
  • {title} {extraHtml}
  • " + : $"
  • {title} {extraHtml}
  • "; return helper.Raw(returnString); } diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj index c4c92b4b1..401b0c3e1 100644 --- a/PlexRequests.UI/PlexRequests.UI.csproj +++ b/PlexRequests.UI/PlexRequests.UI.csproj @@ -452,10 +452,10 @@ pace.css Always - + PreserveNewest - + PreserveNewest @@ -675,7 +675,7 @@ - + PreserveNewest