Added ability for Runtime and RenderMode to be set per Site - enabling the framework to support multiple hosting models concurrently in the same installation. Fixed WebAssembly Prerendering issue (this also resolved the issue where the component taghelper was not passing parameters correctly to the app when running on WebAssembly). Fix #1702 - remove web,config from upgrade package.

This commit is contained in:
Shaun Walker
2021-10-05 14:32:05 -04:00
parent ac67d88e74
commit 306b78b526
23 changed files with 190 additions and 90 deletions

View File

@ -23,14 +23,16 @@ namespace Oqtane.Pages
private readonly ILocalizationManager _localizationManager;
private readonly ILanguageRepository _languages;
private readonly IAntiforgery _antiforgery;
private readonly ISiteRepository _sites;
public HostModel(IConfiguration configuration, ITenantManager tenantManager, ILocalizationManager localizationManager, ILanguageRepository languages, IAntiforgery antiforgery)
public HostModel(IConfiguration configuration, ITenantManager tenantManager, ILocalizationManager localizationManager, ILanguageRepository languages, IAntiforgery antiforgery, ISiteRepository sites)
{
_configuration = configuration;
_tenantManager = tenantManager;
_localizationManager = localizationManager;
_languages = languages;
_antiforgery = antiforgery;
_sites = sites;
}
public string AntiForgeryToken = "";
@ -48,7 +50,7 @@ namespace Oqtane.Pages
Runtime = _configuration.GetSection("Runtime").Value;
}
if (Runtime != "WebAssembly" && _configuration.GetSection("RenderMode").Exists())
if (_configuration.GetSection("RenderMode").Exists())
{
RenderMode = (RenderMode)Enum.Parse(typeof(RenderMode), _configuration.GetSection("RenderMode").Value, true);
}
@ -67,6 +69,19 @@ namespace Oqtane.Pages
var alias = _tenantManager.GetAlias();
if (alias != null)
{
var site = _sites.GetSite(alias.SiteId);
if (site != null)
{
if (!string.IsNullOrEmpty(site.Runtime))
{
Runtime = site.Runtime;
}
if (!string.IsNullOrEmpty(site.RenderMode))
{
RenderMode = (RenderMode)Enum.Parse(typeof(RenderMode), site.RenderMode, true);
}
}
// if culture not specified
if (HttpContext.Request.Cookies[CookieRequestCultureProvider.DefaultCookieName] == null)
{
@ -142,7 +157,6 @@ namespace Oqtane.Pages
}
}
}
private void ProcessResource(Resource resource)
{
switch (resource.ResourceType)
@ -171,7 +185,6 @@ namespace Oqtane.Pages
break;
}
}
private string CrossOrigin(string crossorigin)
{
if (!string.IsNullOrEmpty(crossorigin))