diff --git a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
index e7e696358..0cd12dcd0 100644
--- a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
+++ b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
@@ -15,12 +15,20 @@
@@ -62,6 +70,7 @@
private string _version = string.Empty;
private string _runtime = string.Empty;
+ private string _rendermode = string.Empty;
private string _clrversion = string.Empty;
private string _osversion = string.Empty;
private string _serverpath = string.Empty;
@@ -75,6 +84,7 @@
Dictionary systeminfo = await SystemService.GetSystemInfoAsync();
if (systeminfo != null)
{
+ _rendermode = systeminfo["rendermode"];
_clrversion = systeminfo["clrversion"];
_osversion = systeminfo["osversion"];
_serverpath = systeminfo["serverpath"];
diff --git a/Oqtane.Server/Controllers/SystemController.cs b/Oqtane.Server/Controllers/SystemController.cs
index 23658faa6..0adeaacde 100644
--- a/Oqtane.Server/Controllers/SystemController.cs
+++ b/Oqtane.Server/Controllers/SystemController.cs
@@ -4,6 +4,7 @@
using Oqtane.Shared;
using System;
using Microsoft.AspNetCore.Hosting;
+using Oqtane.Infrastructure;
namespace Oqtane.Controllers
{
@@ -11,10 +12,12 @@ namespace Oqtane.Controllers
public class SystemController : Controller
{
private readonly IWebHostEnvironment _environment;
+ private readonly IConfigManager _configManager;
- public SystemController(IWebHostEnvironment environment)
+ public SystemController(IWebHostEnvironment environment, IConfigManager configManager)
{
_environment = environment;
+ _configManager = configManager;
}
// GET: api/
@@ -23,11 +26,14 @@ public SystemController(IWebHostEnvironment environment)
public Dictionary Get()
{
Dictionary systeminfo = new Dictionary();
+
+ systeminfo.Add("rendermode", _configManager.GetSetting("RenderMode", "Server"));
systeminfo.Add("clrversion", Environment.Version.ToString());
systeminfo.Add("osversion", Environment.OSVersion.ToString());
systeminfo.Add("machinename", Environment.MachineName);
systeminfo.Add("serverpath", _environment.ContentRootPath);
systeminfo.Add("servertime", DateTime.Now.ToString());
+
return systeminfo;
}
diff --git a/Oqtane.Server/Infrastructure/ConfigManager.cs b/Oqtane.Server/Infrastructure/ConfigManager.cs
index 196b20875..3b35b0278 100644
--- a/Oqtane.Server/Infrastructure/ConfigManager.cs
+++ b/Oqtane.Server/Infrastructure/ConfigManager.cs
@@ -20,10 +20,23 @@ public IConfigurationSection GetSection(string key)
return _config.GetSection(key);
}
- public string GetSetting(string sectionKey, string settingKey, string defaultValue)
+ public T GetSetting(string sectionKey, T defaultValue)
{
- var value = _config.GetSection(sectionKey).GetValue(settingKey, defaultValue);
- if (string.IsNullOrEmpty(value)) value = defaultValue;
+ return GetSetting(sectionKey, "", defaultValue);
+ }
+
+ public T GetSetting(string sectionKey, string settingKey, T defaultValue)
+ {
+ T value;
+ if (!string.IsNullOrEmpty(settingKey))
+ {
+ value = _config.GetSection(sectionKey).GetValue(settingKey, defaultValue);
+ }
+ else
+ {
+ value = _config.GetValue(sectionKey, defaultValue);
+ }
+ if (value == null) value = defaultValue;
return value;
}
diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs
index c36749687..1a59f39ab 100644
--- a/Oqtane.Server/Infrastructure/InstallationManager.cs
+++ b/Oqtane.Server/Infrastructure/InstallationManager.cs
@@ -55,7 +55,7 @@ public static bool InstallPackages(string webRootPath, string contentRootPath)
{
File.Delete(destinationFile);
}
- if (Path.GetExtension(destinationFile) == ".nupkg.bak")
+ if (destinationFile.ToLower().EndsWith(".nupkg.bak"))
{
// leave a copy in the current folder as it is distributed with the core framework
File.Copy(file, destinationFile);
diff --git a/Oqtane.Server/Infrastructure/Interfaces/IConfigManager.cs b/Oqtane.Server/Infrastructure/Interfaces/IConfigManager.cs
index cfc454b20..400c5e6a9 100644
--- a/Oqtane.Server/Infrastructure/Interfaces/IConfigManager.cs
+++ b/Oqtane.Server/Infrastructure/Interfaces/IConfigManager.cs
@@ -5,7 +5,8 @@ namespace Oqtane.Infrastructure
public interface IConfigManager
{
public IConfigurationSection GetSection(string sectionKey);
- public string GetSetting(string sectionKey, string settingKey, string defaultValue);
+ public T GetSetting(string settingKey, T defaultValue);
+ public T GetSetting(string sectionKey, string settingKey, T defaultValue);
void AddOrUpdateSetting(string key, T value, bool reload);
void AddOrUpdateSetting(string file, string key, T value, bool reload);
void RemoveSetting(string key, bool reload);
diff --git a/Oqtane.Server/Infrastructure/UpgradeManager.cs b/Oqtane.Server/Infrastructure/UpgradeManager.cs
index dd806e3a2..2fec05bb6 100644
--- a/Oqtane.Server/Infrastructure/UpgradeManager.cs
+++ b/Oqtane.Server/Infrastructure/UpgradeManager.cs
@@ -41,6 +41,9 @@ public void Upgrade(Tenant tenant, string version)
case "2.0.2":
Upgrade_2_0_2(tenant, scope);
break;
+ case "2.1.0":
+ Upgrade_2_1_0(tenant, scope);
+ break;
}
}
}
@@ -113,6 +116,18 @@ private void Upgrade_2_0_2(Tenant tenant, IServiceScope scope)
}
}
+ private void Upgrade_2_1_0(Tenant tenant, IServiceScope scope)
+ {
+ if (tenant.Name == TenantNames.Master)
+ {
+ _configManager.RemoveSetting("Localization:SupportedCultures", true);
+ if (_configManager.GetSetting("RenderMode", "") == "")
+ {
+ _configManager.AddOrUpdateSetting("RenderMode", "ServerPrerendered", true);
+ }
+ }
+ }
+
private void CreateSitePages(IServiceScope scope, List pageTemplates)
{
if (pageTemplates.Count != 0)
diff --git a/Oqtane.Server/Pages/_Host.cshtml b/Oqtane.Server/Pages/_Host.cshtml
index 4a7a4b07e..ccb246795 100644
--- a/Oqtane.Server/Pages/_Host.cshtml
+++ b/Oqtane.Server/Pages/_Host.cshtml
@@ -1,8 +1,6 @@
@page "/"
@namespace Oqtane.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
-@using Microsoft.Extensions.Configuration
-@inject IConfiguration Configuration
@model Oqtane.Pages.HostModel
@@ -22,14 +20,7 @@
@(Html.AntiForgeryToken())
- @if (Configuration.GetSection("Runtime").Value == "WebAssembly")
- {
-
- }
- else
- {
-
- }
+
@@ -52,7 +43,7 @@
- @if (Configuration.GetSection("Runtime").Value == "WebAssembly")
+ @if (Model.Runtime == "WebAssembly")
{
}
diff --git a/Oqtane.Server/Pages/_Host.cshtml.cs b/Oqtane.Server/Pages/_Host.cshtml.cs
index 533cda83e..235d70cc0 100644
--- a/Oqtane.Server/Pages/_Host.cshtml.cs
+++ b/Oqtane.Server/Pages/_Host.cshtml.cs
@@ -11,6 +11,7 @@
using Oqtane.Repository;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Configuration;
+using Microsoft.AspNetCore.Mvc.Rendering;
namespace Oqtane.Pages
{
@@ -33,12 +34,24 @@ public HostModel(
_languages = languages;
}
+ public string Runtime = "Server";
+ public RenderMode RenderMode = RenderMode.Server;
public string HeadResources = "";
public string BodyResources = "";
public string Message = "";
public void OnGet()
{
+ if (_configuration.GetSection("Runtime").Exists())
+ {
+ Runtime = _configuration.GetSection("Runtime").Value;
+ }
+
+ if (Runtime != "WebAssembly" && _configuration.GetSection("RenderMode").Exists())
+ {
+ RenderMode = (RenderMode)Enum.Parse(typeof(RenderMode), _configuration.GetSection("RenderMode").Value, true);
+ }
+
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
foreach (Assembly assembly in assemblies)
{
|