Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
Leigh Pointer
2025-10-27 11:24:37 +01:00
7 changed files with 33 additions and 13 deletions

View File

@@ -21,8 +21,8 @@
@if (_style == MessageStyle.Toast)
{
<div class="app-modulemessage-toast bottom-0 end-0">
<div class="@_classname alert-dismissible fade show mb-3" role="alert">
<div class="app-modulemessage-toast bottom-0 end-0" @key="DateTime.UtcNow">
<div class="@_classname alert-dismissible fade show mb-3 rounded-end-0" role="alert">
@((MarkupString)Message)
@if (Type == MessageType.Error && PageState != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{

View File

@@ -118,7 +118,7 @@
public void AddModuleMessage(string message, MessageType type, string position, MessageStyle style)
{
if (message != _messageContent || type != _messageType || position != _messagePosition || style != _messageStyle)
if (message != _messageContent || type != _messageType || position != _messagePosition || style != _messageStyle || style == MessageStyle.Toast)
{
_messageContent = message;
_messageType = type;

View File

@@ -127,7 +127,7 @@ namespace Oqtane.Controllers
}
// DELETE api/<controller>/5?siteid=x
[HttpDelete("{themename}")]
[HttpDelete("{id}")]
[Authorize(Roles = RoleNames.Host)]
public void Delete(int id, int siteid)
{

View File

@@ -7,15 +7,11 @@ using Oqtane.Infrastructure.SiteTemplates;
using Oqtane.Models;
using Oqtane.Repository;
using Oqtane.Shared;
using Oqtane.UI;
using Org.BouncyCastle.Pqc.Crypto.Lms;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Runtime.Serialization;
namespace Oqtane.Infrastructure
{

View File

@@ -13,8 +13,10 @@
<ItemGroup>
<Compile Remove="wwwroot\Modules\Templates\**" />
<Compile Remove="wwwroot\Themes\Templates\**" />
<Compile Remove="wwwroot\_content\*\**" />
<Content Remove="wwwroot\Modules\Templates\**" />
<Content Remove="wwwroot\Themes\Templates\**" />
<Content Remove="wwwroot\_content\*\**" />
<EmbeddedResource Remove="wwwroot\Modules\Templates\**" />
<EmbeddedResource Remove="wwwroot\Themes\Templates\**" />
</ItemGroup>

View File

@@ -168,7 +168,7 @@ namespace Oqtane.Repository
var attribute = (SiteMigrationAttribute)Attribute.GetCustomAttribute(type, typeof(SiteMigrationAttribute));
if (attribute.AliasName == "*" || attribute.AliasName == alias.Name)
{
if (string.IsNullOrEmpty(site.Version) || Version.Parse(attribute.Version) > Version.Parse(site.Version))
if (string.IsNullOrEmpty(site.Version) || attribute.Version == "*" || Version.Parse(attribute.Version) > Version.Parse(site.Version))
{
try
{
@@ -176,14 +176,14 @@ namespace Oqtane.Repository
if (obj != null)
{
obj.Up(site, alias);
_logger.Log(LogLevel.Information, "Site Migration", LogFunction.Other, "Site Migrated Successfully To Version {version} For {Alias}", version, alias.Name);
_logger.Log(LogLevel.Information, "Site Migration", LogFunction.Other, "Site Migrated Successfully For {Alias} And Version {version}", alias.Name, attribute.Version);
}
}
catch (Exception ex)
{
_logger.Log(LogLevel.Error, "Site Migration", LogFunction.Other, ex, "An Error Occurred Executing Site Migration {Type} For {Alias} And Version {Version}", type, alias.Name, version);
_logger.Log(LogLevel.Error, "Site Migration", LogFunction.Other, ex, "An Error Occurred Executing Site Migration {Type} For {Alias} And Version {Version}", type, alias.Name, attribute.Version);
}
if (string.IsNullOrEmpty(version) || Version.Parse(attribute.Version) > Version.Parse(version))
if (attribute.Version != "*" && (string.IsNullOrEmpty(version) || Version.Parse(attribute.Version) > Version.Parse(version)))
{
version = attribute.Version;
}
@@ -490,7 +490,27 @@ namespace Oqtane.Repository
}
else
{
var module = _moduleRepository.AddModule(pageModule.Module);
Module module = null;
if (pageTemplateModule.FromPagePath != "")
{
// used for modules shared across pages
var pagePath = pageTemplateModule.FromPagePath;
pagePath = (pagePath.ToLower() == "home") ? "" : pagePath;
pagePath = (pagePath == "/") ? "" : pagePath;
if (pages.Any(item => item.Path.ToLower() == pagePath.ToLower()))
{
var pageId = pages.First(item => item.Path.ToLower() == pagePath.ToLower()).PageId;
if (pageModules.Any(item => item.PageId == pageId && item.Module.ModuleDefinitionName == pageTemplateModule.ModuleDefinitionName && item.Title.ToLower() == pageTemplateModule.Title.ToLower()))
{
module = pageModules.FirstOrDefault(item => item.PageId == pageId && item.Module.ModuleDefinitionName == pageTemplateModule.ModuleDefinitionName && item.Title.ToLower() == pageTemplateModule.Title.ToLower()).Module;
}
}
}
if (module == null)
{
module = _moduleRepository.AddModule(pageModule.Module);
}
pageModule.ModuleId = module.ModuleId;
pageModule.Module = null; // remove tracking
_pageModuleRepository.AddPageModule(pageModule);

View File

@@ -105,6 +105,7 @@ namespace Oqtane.Models
};
Settings = new List<Setting>();
Content = "";
FromPagePath = "";
}
public string ModuleDefinitionName { get; set; }
@@ -118,6 +119,7 @@ namespace Oqtane.Models
public List<Permission> PermissionList { get; set; }
public List<Setting> Settings { get; set; }
public string Content { get; set; }
public string FromPagePath { get; set; } // for modules shared across pages
[Obsolete("The ModulePermissions property is deprecated. Use PermissionList instead", false)]
public string ModulePermissions