mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Add Cors
This commit is contained in:
@@ -3,6 +3,7 @@ using BTCPayServer.Filters;
|
|||||||
using BTCPayServer.Models.InvoicingModels;
|
using BTCPayServer.Models.InvoicingModels;
|
||||||
using BTCPayServer.Servcices.Invoices;
|
using BTCPayServer.Servcices.Invoices;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
@@ -149,6 +150,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("i/{invoiceId}/status")]
|
[Route("i/{invoiceId}/status")]
|
||||||
|
[DisableCors]
|
||||||
public async Task<IActionResult> GetStatus(string invoiceId)
|
public async Task<IActionResult> GetStatus(string invoiceId)
|
||||||
{
|
{
|
||||||
var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId);
|
var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId);
|
||||||
@@ -159,6 +161,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("i/{invoiceId}/UpdateCustomer")]
|
[Route("i/{invoiceId}/UpdateCustomer")]
|
||||||
|
[DisableCors]
|
||||||
public async Task<IActionResult> UpdateCustomer(string invoiceId, [FromBody]UpdateCustomerModel data)
|
public async Task<IActionResult> UpdateCustomer(string invoiceId, [FromBody]UpdateCustomerModel data)
|
||||||
{
|
{
|
||||||
if(!ModelState.IsValid)
|
if(!ModelState.IsValid)
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ namespace BTCPayServer.Hosting
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
services.AddHangfire(configuration);
|
services.AddHangfire(configuration);
|
||||||
|
services.AddCors();
|
||||||
|
|
||||||
services.Configure<IOptions<ApplicationInsightsServiceOptions>>(o =>
|
services.Configure<IOptions<ApplicationInsightsServiceOptions>>(o =>
|
||||||
{
|
{
|
||||||
@@ -134,7 +135,10 @@ namespace BTCPayServer.Hosting
|
|||||||
app.UsePayServer();
|
app.UsePayServer();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
app.UseCors(b =>
|
||||||
|
{
|
||||||
|
b.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
|
||||||
|
});
|
||||||
app.UseHangfireServer();
|
app.UseHangfireServer();
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions() { Authorization = new[] { new NeedRole(Roles.ServerAdmin) } });
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions() { Authorization = new[] { new NeedRole(Roles.ServerAdmin) } });
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
|
|||||||
Reference in New Issue
Block a user