diff --git a/Minecraft-Realms-Emulator/Program.cs b/Minecraft-Realms-Emulator/Program.cs index 97e0eb7..c315717 100644 --- a/Minecraft-Realms-Emulator/Program.cs +++ b/Minecraft-Realms-Emulator/Program.cs @@ -33,6 +33,14 @@ builder.Services.AddDbContext(options => options.UseNpgsql(dataSource); }); +builder.Services.AddCors(options => +{ + options.AddDefaultPolicy(policy => + { + policy.WithOrigins("http://localhost:5192"); + }); +}); + var app = builder.Build(); // Initialize database @@ -48,6 +56,7 @@ if (app.Environment.IsDevelopment()) var scope = app.Services.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); +app.UseCors(); app.MapControllers(); var mode = Environment.GetEnvironmentVariable("WORKMODE"); diff --git a/Panel/wwwroot/js/serverLogsStream.js b/Panel/wwwroot/js/serverLogsStream.js index 54e6c37..86a7b92 100644 --- a/Panel/wwwroot/js/serverLogsStream.js +++ b/Panel/wwwroot/js/serverLogsStream.js @@ -2,7 +2,7 @@ logs: "x", start: (dotNetObject, serverId) => { - logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`, { withCredentials: true }); + logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`); logs.onmessage = event => { dotNetObject.invokeMethodAsync("ReceiveLog", event.data);