From b0487798c2ecc9b87cfb7d089f4827fb31f2a8ca Mon Sep 17 00:00:00 2001 From: sbwalker Date: Fri, 16 Feb 2024 11:13:31 -0500 Subject: [PATCH] fix issues with installer --- Oqtane.Server/Components/App.razor | 4 +++- .../Infrastructure/UpgradeManager.cs | 1 - Oqtane.Server/Services/SiteService.cs | 22 +++++++++++-------- Oqtane.Shared/Shared/Constants.cs | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Oqtane.Server/Components/App.razor b/Oqtane.Server/Components/App.razor index e8103ca2e..0e3d5ac3f 100644 --- a/Oqtane.Server/Components/App.razor +++ b/Oqtane.Server/Components/App.razor @@ -31,7 +31,7 @@ @inject IVisitorRepository VisitorRepository @inject IJwtManager JwtManager -@if (_pageState != null) +@if (_initialized) { @@ -93,6 +93,7 @@ } @code { + private bool _initialized = false; private string _renderMode = RenderModes.Interactive; private string _runtime = Runtimes.Server; private bool _prerender = true; @@ -266,6 +267,7 @@ _message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name"; } } + _initialized = true; } private void HandleDefaultAliasRedirect(Alias alias, string url) diff --git a/Oqtane.Server/Infrastructure/UpgradeManager.cs b/Oqtane.Server/Infrastructure/UpgradeManager.cs index a81b5ca0e..d23103a45 100644 --- a/Oqtane.Server/Infrastructure/UpgradeManager.cs +++ b/Oqtane.Server/Infrastructure/UpgradeManager.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using Oqtane.Extensions; using Oqtane.Models; using Oqtane.Repository; using Oqtane.Shared; diff --git a/Oqtane.Server/Services/SiteService.cs b/Oqtane.Server/Services/SiteService.cs index 8f7c659a6..c1b1a1abe 100644 --- a/Oqtane.Server/Services/SiteService.cs +++ b/Oqtane.Server/Services/SiteService.cs @@ -27,11 +27,11 @@ public class ServerSiteService : ISiteService private readonly ILanguageRepository _languages; private readonly IUserPermissions _userPermissions; private readonly ISettingRepository _settings; + private readonly ITenantManager _tenantManager; private readonly ISyncManager _syncManager; private readonly ILogManager _logger; private readonly IMemoryCache _cache; private readonly IHttpContextAccessor _accessor; - private readonly Alias _alias; public ServerSiteService(ISiteRepository sites, IPageRepository pages, IThemeRepository themes, IPageModuleRepository pageModules, IModuleDefinitionRepository moduleDefinitions, ILanguageRepository languages, IUserPermissions userPermissions, ISettingRepository settings, ITenantManager tenantManager, ISyncManager syncManager, ILogManager logger, IMemoryCache cache, IHttpContextAccessor accessor) { @@ -43,11 +43,11 @@ public ServerSiteService(ISiteRepository sites, IPageRepository pages, IThemeRep _languages = languages; _userPermissions = userPermissions; _settings = settings; + _tenantManager = tenantManager; _syncManager = syncManager; _logger = logger; _cache = cache; _accessor = accessor; - _alias = tenantManager.GetAlias(); } public async Task> GetSitesAsync() @@ -80,8 +80,9 @@ public async Task GetSiteAsync(int siteId) private Site GetSite(int siteid) { + var alias = _tenantManager.GetAlias(); var site = _sites.GetSite(siteid); - if (site != null && site.SiteId == _alias.SiteId) + if (site != null && site.SiteId == alias.SiteId) { // site settings site.Settings = _settings.GetSettings(EntityNames.Site, site.SiteId) @@ -179,8 +180,9 @@ public async Task AddSiteAsync(Site site) { if (_accessor.HttpContext.User.IsInRole(RoleNames.Host)) { + var alias = _tenantManager.GetAlias(); site = _sites.AddSite(site); - _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Create); + _syncManager.AddSyncEvent(alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Create); _logger.Log(site.SiteId, LogLevel.Information, this, LogFunction.Create, "Site Added {Site}", site); } else @@ -194,17 +196,18 @@ public async Task UpdateSiteAsync(Site site) { if (_accessor.HttpContext.User.IsInRole(RoleNames.Admin)) { + var alias = _tenantManager.GetAlias(); var current = _sites.GetSite(site.SiteId, false); - if (site.SiteId == _alias.SiteId && site.TenantId == _alias.TenantId && current != null) + if (site.SiteId == alias.SiteId && site.TenantId == alias.TenantId && current != null) { site = _sites.UpdateSite(site); - _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Update); + _syncManager.AddSyncEvent(alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Update); string action = SyncEventActions.Refresh; if (current.RenderMode != site.RenderMode || current.Runtime != site.Runtime) { action = SyncEventActions.Reload; } - _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, site.SiteId, action); + _syncManager.AddSyncEvent(alias.TenantId, EntityNames.Site, site.SiteId, action); _logger.Log(site.SiteId, LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", site); } else @@ -224,11 +227,12 @@ public async Task DeleteSiteAsync(int siteId) { if (_accessor.HttpContext.User.IsInRole(RoleNames.Host)) { + var alias = _tenantManager.GetAlias(); var site = _sites.GetSite(siteId); - if (site != null && site.SiteId == _alias.SiteId) + if (site != null && site.SiteId == alias.SiteId) { _sites.DeleteSite(siteId); - _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Delete); + _syncManager.AddSyncEvent(alias.TenantId, EntityNames.Site, site.SiteId, SyncEventActions.Delete); _logger.Log(siteId, LogLevel.Information, this, LogFunction.Delete, "Site Deleted {SiteId}", siteId); } else diff --git a/Oqtane.Shared/Shared/Constants.cs b/Oqtane.Shared/Shared/Constants.cs index f8db5bf9f..e538ef9d1 100644 --- a/Oqtane.Shared/Shared/Constants.cs +++ b/Oqtane.Shared/Shared/Constants.cs @@ -5,7 +5,7 @@ namespace Oqtane.Shared public class Constants { public static readonly string Version = "5.1.0"; - public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.1.0"; + public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.1.1,3.1.2,3.1.3,3.1.4,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.4.2,3.4.3,4.0.0,4.0.1,4.0.2,4.0.3,4.0.4,4.0.5,4.0.6,5.0.0,5.0.1,5.0.2,5.0.3,5.1.0"; public const string PackageId = "Oqtane.Framework"; public const string ClientId = "Oqtane.Client"; public const string UpdaterPackageId = "Oqtane.Updater";