diff --git a/LICENSE b/LICENSE
index 9a5062f7..6b68cd26 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2018-2020 .NET Foundation
+Copyright (c) 2018-2021 .NET Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Oqtane.Client/App.razor b/Oqtane.Client/App.razor
index 01022680..82a0b24a 100644
--- a/Oqtane.Client/App.razor
+++ b/Oqtane.Client/App.razor
@@ -12,11 +12,13 @@
{
@if (string.IsNullOrEmpty(_installation.Message))
{
-
-
-
-
-
+
+
+
+
+
+
+
}
else
{
@@ -28,27 +30,50 @@
}
@code {
+ [Parameter]
+ public string AntiForgeryToken { get; set; }
+
+ [Parameter]
+ public string Runtime { get; set; }
+
+ [Parameter]
+ public string RenderMode { get; set; }
+
private bool _initialized = false;
+ private string _display = "display: none;";
private Installation _installation = new Installation { Success = false, Message = "" };
private PageState PageState { get; set; }
+ protected override async Task OnParametersSetAsync()
+ {
+ _installation = await InstallationService.IsInstalled();
+ if (_installation.Alias != null)
+ {
+ SiteState.Alias = _installation.Alias;
+ SiteState.AntiForgeryToken = AntiForgeryToken;
+ }
+ else
+ {
+ _installation.Message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name";
+ }
+ _initialized = true;
+ }
+
protected override async Task OnAfterRenderAsync(bool firstRender)
{
- if (firstRender && !_initialized)
+ if (firstRender)
{
- var interop = new Interop(JSRuntime);
- SiteState.AntiForgeryToken = await interop.GetElementByName(Constants.RequestVerificationToken);
- _installation = await InstallationService.IsInstalled();
- if (_installation.Alias != null)
+ if (string.IsNullOrEmpty(AntiForgeryToken))
{
- SiteState.Alias = _installation.Alias;
+ // parameter values are not set when running on WebAssembly (seems to be a .NET 5 bug) - need to retrieve using JSInterop
+ var interop = new Interop(JSRuntime);
+ AntiForgeryToken = await interop.GetElementByName(Constants.RequestVerificationToken);
+ SiteState.AntiForgeryToken = AntiForgeryToken;
+ Runtime = await interop.GetElementByName("app_runtime");
+ RenderMode = await interop.GetElementByName("app_rendermode");
}
- else
- {
- _installation.Message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name";
- }
- _initialized = true;
+ _display = "";
StateHasChanged();
}
}
diff --git a/Oqtane.Client/Installer/Controls/LocalDBConfig.razor b/Oqtane.Client/Installer/Controls/LocalDBConfig.razor
index 0785fe04..5d27d986 100644
--- a/Oqtane.Client/Installer/Controls/LocalDBConfig.razor
+++ b/Oqtane.Client/Installer/Controls/LocalDBConfig.razor
@@ -1,41 +1,30 @@
@namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl
-@inject IStringLocalizer Localizer
-@{
- foreach (var field in _connectionStringFields)
- {
- var fieldId = field.Name.ToLowerInvariant();
- field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
-
-
-
-
-
-
-
-
-
- }
-}
+
+
+
+
+
+
+
+
+
+
+
+
@code {
- private readonly List _connectionStringFields = new()
- {
- new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB", HelpText="Enter the database server"},
- new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}
- };
+ private string _server = "(LocalDb)\\MSSQLLocalDB";
+ private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
public string GetConnectionString()
{
var connectionString = String.Empty;
- var server = _connectionStringFields[0].Value;
- var database = _connectionStringFields[1].Value;
-
- if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
+ if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database))
{
- connectionString = $"Data Source={server};AttachDbFilename=|DataDirectory|\\{database}.mdf;Initial Catalog={database};Integrated Security=SSPI;";
+ connectionString = $"Data Source={_server};AttachDbFilename=|DataDirectory|\\{_database}.mdf;Initial Catalog={_database};Integrated Security=SSPI;";
}
return connectionString;
diff --git a/Oqtane.Client/Installer/Controls/MySQLConfig.razor b/Oqtane.Client/Installer/Controls/MySQLConfig.razor
index 7bd1f512..7de576b0 100644
--- a/Oqtane.Client/Installer/Controls/MySQLConfig.razor
+++ b/Oqtane.Client/Installer/Controls/MySQLConfig.razor
@@ -1,54 +1,58 @@
@namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl
-@inject IStringLocalizer Localizer
-@{
- foreach (var field in _connectionStringFields)
- {
- var fieldId = field.Name.ToLowerInvariant();
- var fieldType = (field.Name == "Pwd") ? "password" : "text";
- field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
-
-
-
-
-
-
-
-
-
- }
-}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@code {
- private readonly List _connectionStringFields = new()
- {
- new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
- new() {Name = "Port", FriendlyName = "Port", Value = "3306", HelpText="Enter the port used to connect to the server"},
- new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
- new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
- new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
- };
+ private string _server = "127.0.0.1";
+ private string _port = "3306";
+ private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
+ private string _uid = String.Empty;
+ private string _pwd = String.Empty;
public string GetConnectionString()
{
var connectionString = String.Empty;
- var server = _connectionStringFields[0].Value;
- var port = _connectionStringFields[1].Value;
- var database = _connectionStringFields[2].Value;
- var userId = _connectionStringFields[3].Value;
- var password = _connectionStringFields[4].Value;
-
- if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
+ if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database) && !String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd))
{
- connectionString = $"Server={server};Database={database};Uid={userId};Pwd={password};";
+ connectionString = $"Server={_server};Database={_database};Uid={_uid};Pwd={_pwd};";
}
- if (!String.IsNullOrEmpty(port))
+ if (!String.IsNullOrEmpty(_port))
{
- connectionString += $"Port={port};";
+ connectionString += $"Port={_port};";
}
+
return connectionString;
}
}
\ No newline at end of file
diff --git a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor
index 012d6fdb..d3ff4eca 100644
--- a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor
+++ b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor
@@ -1,89 +1,76 @@
@namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl
-@inject IStringLocalizer Localizer
-@inject IStringLocalizer SharedLocalizer
+@inject IStringLocalizer Localizer
-@{
- foreach (var field in _connectionStringFields)
- {
- var fieldId = field.Name.ToLowerInvariant();
- if (field.Name != "IntegratedSecurity")
- {
- var isVisible = "";
- var fieldType = (field.Name == "Pwd") ? "password" : "text";
- if ((field.Name == "Uid" || field.Name == "Pwd"))
- {
- var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity");
- if (intSecurityField != null)
- {
- isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
- }
- }
-
- field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
-
-
-
-
-
-
-
-
-
- }
- else
- {
-
-
-
-
-
-
-
-
- }
- }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@if (_security == "custom")
+{
+
+
+
+
+
+
+
+
+
+
+
+
}
@code {
- private readonly List _connectionStringFields = new()
- {
- new() { Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText = "Enter the database server" },
- new() { Name = "Port", FriendlyName = "Port", Value = "5432", HelpText = "Enter the port used to connect to the server" },
- new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" },
- new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" },
- new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" },
- new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" }
- };
+ private string _server = "127.0.0.1";
+ private string _port = "5432";
+ private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
+ private string _security = "integrated";
+ private string _uid = String.Empty;
+ private string _pwd = String.Empty;
public string GetConnectionString()
{
var connectionString = String.Empty;
- var server = _connectionStringFields[0].Value;
- var port = _connectionStringFields[1].Value;
- var database = _connectionStringFields[2].Value;
- var integratedSecurity = Boolean.Parse(_connectionStringFields[3].Value);
- var userId = _connectionStringFields[4].Value;
- var password = _connectionStringFields[5].Value;
-
- if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port))
+ if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database) && !String.IsNullOrEmpty(_port))
{
- connectionString = $"Server={server};Port={port};Database={database};";
+ connectionString = $"Server={_server};Port={_port};Database={_database};";
}
- if (integratedSecurity)
+ if (_security == "integrated")
{
connectionString += "Integrated Security=true;";
}
else
{
- if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
+ if (!String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd))
{
- connectionString += $"User ID={userId};Password={password};";
+ connectionString += $"User ID={_uid};Password={_pwd};";
}
else
{
diff --git a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor
index 25ddd0ab..905f8006 100644
--- a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor
+++ b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor
@@ -1,87 +1,69 @@
@namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl
-@inject IStringLocalizer Localizer
-@inject IStringLocalizer SharedLocalizer
+@inject IStringLocalizer Localizer
-@{
- foreach (var field in _connectionStringFields)
- {
- var fieldId = field.Name.ToLowerInvariant();
- if (field.Name != "IntegratedSecurity")
- {
- var isVisible = "";
- var fieldType = (field.Name == "Pwd") ? "password" : "text";
- if ((field.Name == "Uid" || field.Name == "Pwd"))
- {
- var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity");
- if (intSecurityField != null)
- {
- isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
- }
- }
-
- field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
-
-
-
-
-
-
-
-
-
- }
- else
- {
-
-
-
-
-
-
-
-
- }
- }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@if (_security == "custom")
+{
+
+
+
+
+
+
+
+
+
+
+
+
}
@code {
- private readonly List _connectionStringFields = new()
- {
- new() { Name = "Server", FriendlyName = "Server", Value = ".", HelpText = "Enter the database server" },
- new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" },
- new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" },
- new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" },
- new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" }
- };
+ private string _server = String.Empty;
+ private string _database = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm");
+ private string _security = "integrated";
+ private string _uid = String.Empty;
+ private string _pwd = String.Empty;
public string GetConnectionString()
{
var connectionString = String.Empty;
- var server = _connectionStringFields[0].Value;
- var database = _connectionStringFields[1].Value;
- var integratedSecurity = Boolean.Parse(_connectionStringFields[2].Value);
- var userId = _connectionStringFields[3].Value;
- var password = _connectionStringFields[4].Value;
-
- if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
+ if (!String.IsNullOrEmpty(_server) && !String.IsNullOrEmpty(_database))
{
- connectionString = $"Data Source={server};Initial Catalog={database};";
+ connectionString = $"Data Source={_server};Initial Catalog={_database};";
}
- if (integratedSecurity)
+ if (_security == "integrated")
{
connectionString += "Integrated Security=SSPI;";
}
else
{
- if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
+ if (!String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd))
{
- connectionString += $"User ID={userId};Password={password};";
+ connectionString += $"User ID={_uid};Password={_pwd};";
}
else
{
@@ -91,5 +73,4 @@
return connectionString;
}
-
}
\ No newline at end of file
diff --git a/Oqtane.Client/Installer/Controls/SqliteConfig.razor b/Oqtane.Client/Installer/Controls/SqliteConfig.razor
index e0445c7c..f35e5d6d 100644
--- a/Oqtane.Client/Installer/Controls/SqliteConfig.razor
+++ b/Oqtane.Client/Installer/Controls/SqliteConfig.razor
@@ -1,39 +1,23 @@
@namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl
-@inject IStringLocalizer Localizer
-@{
- foreach (var field in _connectionStringFields)
- {
- var fieldId = field.Name.ToLowerInvariant();
- field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
-
-
-
-
-
-
-
-
-
- }
-}
+
+
+
+
+
+
@code {
- private readonly List _connectionStringFields = new()
- {
- new() {Name = "Server", FriendlyName = "File Name", Value = "Oqtane-{{Date}}.db", HelpText="Enter the file name to use for the database"}
- };
+ private string _server = "Oqtane-" + DateTime.UtcNow.ToString("yyyyMMddHHmm") + ".db";
public string GetConnectionString()
{
var connectionstring = String.Empty;
- var server = _connectionStringFields[0].Value;
-
- if (!String.IsNullOrEmpty(server))
+ if (!String.IsNullOrEmpty(_server))
{
- connectionstring = $"Data Source={server};";
+ connectionstring = $"Data Source={_server};";
}
return connectionstring;
diff --git a/Oqtane.Client/Installer/Installer.razor b/Oqtane.Client/Installer/Installer.razor
index e0a1ac71..7c656e13 100644
--- a/Oqtane.Client/Installer/Installer.razor
+++ b/Oqtane.Client/Installer/Installer.razor
@@ -20,78 +20,64 @@
- @foreach (Profile profile in profiles)
- {
- var p = profile;
- if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
+
+
+ @foreach (Profile profile in profiles)
{
- if (p.Category != category)
+ var p = profile;
+ if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
-