diff --git a/BBDown/BBDownApiServer.cs b/BBDown/BBDownApiServer.cs index 80cfeb7f1..b5e786048 100644 --- a/BBDown/BBDownApiServer.cs +++ b/BBDown/BBDownApiServer.cs @@ -30,7 +30,18 @@ public void SetUpServer() { options.SerializerOptions.TypeInfoResolver = JsonTypeInfoResolver.Combine(options.SerializerOptions.TypeInfoResolver, AppJsonSerializerContext.Default); }); + builder.Services.AddCors((options) => + { + options.AddPolicy("AllowAnyOrigin", + policy => + { + policy.AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader(); + }); + }); app = builder.Build(); + app.UseCors("AllowAnyOrigin"); var taskStatusApi = app.MapGroup("/get-tasks"); taskStatusApi.MapGet("/", handler: () => Results.Json(new DownloadTaskCollection(runningTasks, finishedTasks), AppJsonSerializerContext.Default.DownloadTaskCollection)); taskStatusApi.MapGet("/running", handler: () => Results.Json(runningTasks, AppJsonSerializerContext.Default.ListDownloadTask));