Blazor Hybrid / .NET MAUI support

This commit is contained in:
Shaun Walker
2022-08-11 17:09:32 -04:00
parent cf2adc7f6a
commit f96129fa37
75 changed files with 2244 additions and 41 deletions

View File

@ -3,6 +3,7 @@ namespace Oqtane.Shared
public enum Runtime
{
Server,
WebAssembly
WebAssembly,
Hybrid
}
}

View File

@ -82,9 +82,15 @@ namespace Oqtane.Models
}
/// <summary>
/// Site-specific settings (only available on the server via HttpContext for security reasons)
/// Protocol for the request from which the alias was resolved (ie. http or https )
/// </summary>
//[NotMapped]
//public Dictionary<string, string> SiteSettings { get; set; }
[NotMapped]
public string Protocol { get; set; }
/// <summary>
/// Base Url for static resources (note that this will only be set for remote clients)
/// </summary>
[NotMapped]
public string BaseUrl { get; set; }
}
}

View File

@ -89,5 +89,8 @@ namespace Oqtane.Shared
public static readonly string HttpContextAliasKey = "Alias";
public static readonly string HttpContextSiteSettingsKey = "SiteSettings";
public static readonly string MauiUserAgent = "MAUI";
}
}

View File

@ -108,7 +108,7 @@ namespace Oqtane.Shared
var aliasUrl = (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path : "";
var method = asAttachment ? "/attach" : "";
return $"{aliasUrl}{Constants.ContentUrl}{fileId}{method}";
return $"{alias.BaseUrl}{aliasUrl}{Constants.ContentUrl}{fileId}{method}";
}
public static string ImageUrl(Alias alias, int fileId, int width, int height, string mode)
@ -118,17 +118,18 @@ namespace Oqtane.Shared
public static string ImageUrl(Alias alias, int fileId, int width, int height, string mode, string position, string background, int rotate, bool recreate)
{
var aliasUrl = (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path : "";
var url = (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path : "";
mode = string.IsNullOrEmpty(mode) ? "crop" : mode;
position = string.IsNullOrEmpty(position) ? "center" : position;
background = string.IsNullOrEmpty(background) ? "000000" : background;
return $"{aliasUrl}{Constants.ImageUrl}{fileId}/{width}/{height}/{mode}/{position}/{background}/{rotate}/{recreate}";
return $"{alias.BaseUrl}{url}{Constants.ImageUrl}{fileId}/{width}/{height}/{mode}/{position}/{background}/{rotate}/{recreate}";
}
public static string TenantUrl(Alias alias, string url)
{
url = (!url.StartsWith("/")) ? "/" + url : url;
return (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path + url : url;
url = (alias != null && !string.IsNullOrEmpty(alias.Path)) ? "/" + alias.Path + url : url;
return $"{alias.BaseUrl}{url}";
}
public static string FormatContent(string content, Alias alias, string operation)