Scaffold some AAT stuff

This commit is contained in:
2022-06-19 17:35:33 -05:00
parent 3e938a8576
commit 770344422d
16 changed files with 275 additions and 47 deletions

View File

@@ -60,16 +60,22 @@ namespace Gameboard.ShogiUI.Sockets
{
// TODO: Figure out how to make a middleware for sockets?
var socketService = app.Services.GetRequiredService<ISocketService>();
var origins = new[] {
"http://localhost:3000", "https://localhost:3000",
"http://127.0.0.1:3000", "https://127.0.0.1:3000",
"https://api.lucaserver.space", "https://lucaserver.space"
};
var allowedOrigins = app.Configuration.GetSection("Cors:AllowedOrigins").Get<string[]>();
var socketOptions = new WebSocketOptions();
foreach (var o in origins)
socketOptions.AllowedOrigins.Add(o);
app.UseCors(opt => opt.WithOrigins(origins).AllowAnyMethod().AllowAnyHeader().WithExposedHeaders("Set-Cookie").AllowCredentials());
foreach (var origin in allowedOrigins)
socketOptions.AllowedOrigins.Add(origin);
app.UseCors(options =>
{
options
.WithOrigins(allowedOrigins)
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyMethod()
.AllowAnyHeader()
.WithExposedHeaders("Set-Cookie")
.AllowCredentials();
});
app.UseWebSockets(socketOptions);
app.Use(async (context, next) =>
{