1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2024-11-25 14:42:44 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
176a81e055 Reformat list of allowed origins in CORS 2022-07-15 01:34:08 +02:00
Matojeje
1cf3e76644 Add CORS for Canary and PTB 2022-07-15 01:34:08 +02:00

View File

@ -9,6 +9,13 @@ using Microsoft.Extensions.Hosting;
namespace DHT.Server.Service {
sealed class Startup {
private static readonly string[] AllowedOrigins = {
"https://discord.com",
"https://ptb.discord.com",
"https://canary.discord.com",
"https://discordapp.com"
};
public void ConfigureServices(IServiceCollection services) {
services.Configure<JsonOptions>(static options => {
options.SerializerOptions.NumberHandling = JsonNumberHandling.Strict;
@ -16,7 +23,7 @@ namespace DHT.Server.Service {
services.AddCors(static cors => {
cors.AddDefaultPolicy(static builder => {
builder.WithOrigins("https://discord.com", "https://discordapp.com").AllowCredentials().AllowAnyMethod().AllowAnyHeader();
builder.WithOrigins(AllowedOrigins).AllowCredentials().AllowAnyMethod().AllowAnyHeader();
});
});
}