Prepare beta release

This commit is contained in:
Myx
2024-10-16 02:12:47 +02:00
parent e7866fbee0
commit 9b0f494bcb
8 changed files with 61 additions and 9 deletions

View File

@@ -0,0 +1,6 @@
namespace bytefy.image;
public class CorsSettings
{
public string[] AllowedOrigins { get; set; }
}

View File

@@ -3,13 +3,17 @@ using ImageMagick;
using Microsoft.AspNetCore.Antiforgery;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAntiforgery(options => options.HeaderName = "2311d8d8-607d-4747-8939-1bde65643254");
builder.Services.AddSingleton<ConversionQueueService>();
builder.Services.AddHostedService(provider => provider.GetRequiredService<ConversionQueueService>());
var corsSettings = builder.Configuration.GetSection("Cors").Get<CorsSettings>();
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowSpecificOrigin",
builder => builder.WithOrigins("http://localhost:4200")
builder => builder.WithOrigins(corsSettings.AllowedOrigins)
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());

View File

@@ -2,8 +2,14 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"Cors": {
"AllowedOrigins": [
"http://localhost:4200",
"https://localhost:4200"
]
}
}

View File

@@ -5,5 +5,10 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"Cors": {
"AllowedOrigins": [
"http://bytefy.net",
"https://bytefy.net"
]
}
}