diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor index db2cf232..bb5809da 100644 --- a/Oqtane.Client/Modules/Admin/Site/Index.razor +++ b/Oqtane.Client/Modules/Admin/Site/Index.razor @@ -311,7 +311,7 @@
- +
+
+ +
+ +
+
@@ -407,6 +416,7 @@ private string _defaultalias; private string _runtime = ""; private string _prerender = ""; + private string _hybridenabled = ""; private string _tenant = string.Empty; private string _database = string.Empty; private string _connectionstring = string.Empty; @@ -490,6 +500,7 @@ // hosting model _runtime = site.Runtime; _prerender = site.RenderMode.Replace(_runtime, ""); + _hybridenabled = site.HybridEnabled.ToString(); // database if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)) @@ -599,34 +610,35 @@ } // PWA - if (site.PwaIsEnabled.ToString() != _pwaisenabled) - { - site.PwaIsEnabled = Boolean.Parse(_pwaisenabled); - reload = true; // needs to be reloaded on server - } - int? pwaappiconfileid = _pwaappiconfilemanager.GetFileId(); - if (pwaappiconfileid == -1) pwaappiconfileid = null; - if (site.PwaAppIconFileId != pwaappiconfileid) - { - site.PwaAppIconFileId = pwaappiconfileid; - reload = true; // needs to be reloaded on server - } - int? pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId(); - if (pwasplashiconfileid == -1) pwasplashiconfileid = null; - if (site.PwaSplashIconFileId != pwasplashiconfileid) - { - site.PwaSplashIconFileId = pwasplashiconfileid; - reload = true; // needs to be reloaded on server - } + if (site.PwaIsEnabled.ToString() != _pwaisenabled) + { + site.PwaIsEnabled = Boolean.Parse(_pwaisenabled); + reload = true; // needs to be reloaded on server + } + int? pwaappiconfileid = _pwaappiconfilemanager.GetFileId(); + if (pwaappiconfileid == -1) pwaappiconfileid = null; + if (site.PwaAppIconFileId != pwaappiconfileid) + { + site.PwaAppIconFileId = pwaappiconfileid; + reload = true; // needs to be reloaded on server + } + int? pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId(); + if (pwasplashiconfileid == -1) pwasplashiconfileid = null; + if (site.PwaSplashIconFileId != pwasplashiconfileid) + { + site.PwaSplashIconFileId = pwasplashiconfileid; + reload = true; // needs to be reloaded on server + } // hosting model if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)) { - if (site.Runtime != _runtime || site.RenderMode != _runtime + _prerender) + if (site.Runtime != _runtime || site.RenderMode != _runtime + _prerender || site.HybridEnabled != bool.Parse(_hybridenabled)) { site.Runtime = _runtime; site.RenderMode = _runtime + _prerender; - reload = true; // needs to be reloaded on server + site.HybridEnabled = bool.Parse(_hybridenabled); + reload = true; // needs to be reloaded on serve } } diff --git a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx index 3234f943..8d8efaf8 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx @@ -283,7 +283,7 @@ Prerender? - The Blazor runtime hosting model + The Blazor runtime hosting model for the site Runtime: @@ -417,4 +417,10 @@ Uploadable File Extensions: + + Specifies if the site can be integrated with an external .NET MAUI hybrid application + + + Hybrid Enabled? + \ No newline at end of file diff --git a/Oqtane.Server/Controllers/InstallationController.cs b/Oqtane.Server/Controllers/InstallationController.cs index 40474361..b070fce6 100644 --- a/Oqtane.Server/Controllers/InstallationController.cs +++ b/Oqtane.Server/Controllers/InstallationController.cs @@ -119,7 +119,7 @@ namespace Oqtane.Controllers var assemblyList = new List(); var site = _sites.GetSite(alias.SiteId); - if (site != null && site.Runtime == "WebAssembly") + if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled)) { var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); @@ -201,7 +201,7 @@ namespace Oqtane.Controllers private byte[] GetZIP(string list, Alias alias) { var site = _sites.GetSite(alias.SiteId); - if (site != null && site.Runtime == "WebAssembly") + if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled)) { var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); diff --git a/Oqtane.Server/Infrastructure/DatabaseManager.cs b/Oqtane.Server/Infrastructure/DatabaseManager.cs index 0c66a7e1..01138129 100644 --- a/Oqtane.Server/Infrastructure/DatabaseManager.cs +++ b/Oqtane.Server/Infrastructure/DatabaseManager.cs @@ -555,6 +555,7 @@ namespace Oqtane.Infrastructure SiteTemplateType = install.SiteTemplate, Runtime = (!string.IsNullOrEmpty(install.Runtime)) ? install.Runtime : _configManager.GetSection("Runtime").Value, RenderMode = (!string.IsNullOrEmpty(install.RenderMode)) ? install.RenderMode : _configManager.GetSection("RenderMode").Value, + HybridEnabled = false }; site = sites.AddSite(site); diff --git a/Oqtane.Server/Migrations/Tenant/05000100_AddSiteHybridEnabled.cs b/Oqtane.Server/Migrations/Tenant/05000100_AddSiteHybridEnabled.cs new file mode 100644 index 00000000..9f39a4d7 --- /dev/null +++ b/Oqtane.Server/Migrations/Tenant/05000100_AddSiteHybridEnabled.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Oqtane.Databases.Interfaces; +using Oqtane.Migrations.EntityBuilders; +using Oqtane.Repository; + +namespace Oqtane.Migrations.Tenant +{ + [DbContext(typeof(TenantDBContext))] + [Migration("Tenant.05.00.01.00")] + public class AddSiteHybridEnabled : MultiDatabaseMigration + { + public AddSiteHybridEnabled(IDatabase database) : base(database) + { + } + + protected override void Up(MigrationBuilder migrationBuilder) + { + var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase); + siteEntityBuilder.AddBooleanColumn("HybridEnabled", true); + siteEntityBuilder.UpdateColumn("HybridEnabled", "0", "bool", ""); // default to false + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase); + siteEntityBuilder.DropColumn("HybridEnabled"); + } + } +} diff --git a/Oqtane.Shared/Models/Site.cs b/Oqtane.Shared/Models/Site.cs index 373215d1..30c5c02f 100644 --- a/Oqtane.Shared/Models/Site.cs +++ b/Oqtane.Shared/Models/Site.cs @@ -78,6 +78,11 @@ namespace Oqtane.Models /// public string RenderMode { get; set; } + /// + /// Indicates if a site can be integrated with an external .NET MAUI hybrid application + /// + public bool HybridEnabled { get; set; } + /// /// Keeps track of site configuration changes and is used by the ISiteMigration interface ///