Increased kestrel default limits and added option to change the moonlight defaults

This commit is contained in:
Marcel Baumgartner 2024-05-01 20:17:41 +02:00
parent efacaa9b86
commit 0234a8e179
2 changed files with 21 additions and 1 deletions

View file

@ -39,6 +39,15 @@ public class CoreConfiguration
[Description("Specifies the location of the key .pem file to load")] [Description("Specifies the location of the key .pem file to load")]
[JsonProperty("KeyPath")] [JsonProperty("KeyPath")]
public string KeyPath { get; set; } = ""; public string KeyPath { get; set; } = "";
[Description("Specifies the file upload limit per http request in megabytes")]
[JsonProperty("UploadLimit")]
public int UploadLimit { get; set; } = 100;
[Description(
"Specifies the maximum message size moonlight can receive via the websocket connection in kilobytes")]
[JsonProperty("MessageSizeLimit")]
public int MessageSizeLimit { get; set; } = 1024;
} }
public class DatabaseData public class DatabaseData

View file

@ -64,15 +64,26 @@ public class CoreFeature : MoonlightFeature
// Add external services and blazor/asp.net stuff // Add external services and blazor/asp.net stuff
builder.Services.AddRazorPages(); builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddHttpContextAccessor(); builder.Services.AddHttpContextAccessor();
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddBlazorTable(); builder.Services.AddBlazorTable();
// Configure blazor pipeline in detail
builder.Services.AddServerSideBlazor().AddHubOptions(options =>
{
options.MaximumReceiveMessageSize = ByteSizeValue.FromKiloBytes(config.Http.MessageSizeLimit).Bytes;
});
// Setup authentication if required // Setup authentication if required
if (config.Authentication.UseDefaultAuthentication) if (config.Authentication.UseDefaultAuthentication)
builder.Services.AddScoped<IAuthenticationProvider, DefaultAuthenticationProvider>(); builder.Services.AddScoped<IAuthenticationProvider, DefaultAuthenticationProvider>();
// Setup http upload limit
context.Builder.WebHost.ConfigureKestrel(options =>
{
options.Limits.MaxRequestBodySize = ByteSizeValue.FromMegaBytes(config.Http.UploadLimit).Bytes;
});
// Assets // Assets
// - Javascript // - Javascript