From e0a93ba608781d19fbd52766915e141aa17ffdb6 Mon Sep 17 00:00:00 2001 From: Ske Date: Tue, 16 Jul 2019 14:20:25 +0200 Subject: [PATCH] Enable CORS for the API --- PluralKit.API/PluralKit.API.csproj | 1 + PluralKit.API/Startup.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/PluralKit.API/PluralKit.API.csproj b/PluralKit.API/PluralKit.API.csproj index 8e030c48..14117b0e 100644 --- a/PluralKit.API/PluralKit.API.csproj +++ b/PluralKit.API/PluralKit.API.csproj @@ -6,6 +6,7 @@ + diff --git a/PluralKit.API/Startup.cs b/PluralKit.API/Startup.cs index fbe5075c..3d34dd77 100644 --- a/PluralKit.API/Startup.cs +++ b/PluralKit.API/Startup.cs @@ -30,6 +30,7 @@ namespace PluralKit.API // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + services.AddCors(); services.AddMvc(opts => { }) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(opts => { opts.SerializerSettings.BuildSerializerSettings(); }); @@ -60,6 +61,7 @@ namespace PluralKit.API } //app.UseHttpsRedirection(); + app.UseCors(opts => opts.AllowAnyMethod().AllowAnyOrigin()); app.UseMiddleware(); app.UseMvc(); }