diff --git a/Oqtane.Client/UI/ThemeBuilder.razor b/Oqtane.Client/UI/ThemeBuilder.razor index 2bdd8a55..d8a9a9d3 100644 --- a/Oqtane.Client/UI/ThemeBuilder.razor +++ b/Oqtane.Client/UI/ThemeBuilder.razor @@ -53,19 +53,10 @@ var url = (resource.Url.Contains("://")) ? resource.Url : PageState.Alias.BaseUrl + resource.Url; headcontent += CreateLink(url, resource.Integrity, resource.CrossOrigin) + "\n"; } - // PWA manifest - if (PageState.Site.PwaIsEnabled && PageState.Site.PwaAppIconFileId != null && PageState.Site.PwaSplashIconFileId != null) - { - headcontent += "\n"; - } SiteState.Properties.HeadContent = headcontent; // set page body content var bodycontent = ""; - if (PageState.Site.PwaIsEnabled && PageState.Site.PwaAppIconFileId != null && PageState.Site.PwaSplashIconFileId != null) - { - bodycontent += CreatePWAScript(PageState.Alias, PageState.Site, PageState.Route); - } if (bodycontent != "") { SiteState.Properties.BodyContent = bodycontent; @@ -161,45 +152,4 @@ { return ""; } - - private string CreatePWAScript(Alias alias, Site site, Route route) - { - return - "" + Environment.NewLine + - ""; - } } diff --git a/Oqtane.Server/Pages/_Host.cshtml b/Oqtane.Server/Pages/_Host.cshtml index 213f3b57..e2e74874 100644 --- a/Oqtane.Server/Pages/_Host.cshtml +++ b/Oqtane.Server/Pages/_Host.cshtml @@ -11,6 +11,10 @@ + @if (!string.IsNullOrEmpty(Model.PWAScript)) + { + + } @Html.Raw(Model.HeadResources) @@ -46,7 +50,11 @@ { @Html.Raw(Model.ReconnectScript) } - @Html.Raw(Model.BodyResources) + @if (!string.IsNullOrEmpty(Model.PWAScript)) + { + @Html.Raw(Model.PWAScript) + } + @Html.Raw(Model.BodyResources) } else diff --git a/Oqtane.Server/Pages/_Host.cshtml.cs b/Oqtane.Server/Pages/_Host.cshtml.cs index e1bb5d8c..7acc8ca6 100644 --- a/Oqtane.Server/Pages/_Host.cshtml.cs +++ b/Oqtane.Server/Pages/_Host.cshtml.cs @@ -65,6 +65,7 @@ namespace Oqtane.Pages public string RemoteIPAddress = ""; public string HeadResources = ""; public string BodyResources = ""; + public string PWAScript = ""; public string ReconnectScript = ""; public string Message = ""; @@ -125,6 +126,10 @@ namespace Oqtane.Pages { ReconnectScript = CreateReconnectScript(); } + if (site.PwaIsEnabled && site.PwaAppIconFileId != null && site.PwaSplashIconFileId != null) + { + PWAScript = CreatePWAScript(alias, site, route); + } if (!string.IsNullOrEmpty(site.HeadContent)) { ProcessHeadContent(site.HeadContent, "site"); @@ -349,6 +354,47 @@ namespace Oqtane.Pages } } + private string CreatePWAScript(Alias alias, Site site, Route route) + { + return + "" + Environment.NewLine + + ""; + } + private string CreateReconnectScript() { return