Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues with installer #3814

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Oqtane.Server/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@inject IVisitorRepository VisitorRepository
@inject IJwtManager JwtManager

@if (_pageState != null)
@if (_initialized)
{
<!DOCTYPE html>
<html lang="@_language">
Expand Down Expand Up @@ -93,6 +93,7 @@
}

@code {
private bool _initialized = false;
private string _renderMode = RenderModes.Interactive;
private string _runtime = Runtimes.Server;
private bool _prerender = true;
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Oqtane.Server/Infrastructure/UpgradeManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Oqtane.Extensions;
using Oqtane.Models;
using Oqtane.Repository;
using Oqtane.Shared;
Expand Down
22 changes: 13 additions & 9 deletions Oqtane.Server/Services/SiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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<List<Site>> GetSitesAsync()
Expand Down Expand Up @@ -80,8 +80,9 @@ public async Task<Site> 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)
Expand Down Expand Up @@ -179,8 +180,9 @@ public async Task<Site> 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
Expand All @@ -194,17 +196,18 @@ public async Task<Site> 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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Shared/Shared/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down