Convert to file-scoped namespace

This commit is contained in:
Dennis Reimann
2024-04-04 11:00:18 +02:00
parent c7a8523b77
commit 620ebc751c
11 changed files with 2590 additions and 2601 deletions

View File

@@ -16,10 +16,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NBitcoin; using NBitcoin;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}")] [HttpGet("{storeId}")]
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public async Task<IActionResult> Dashboard() public async Task<IActionResult> Dashboard()
@@ -167,5 +167,4 @@ namespace BTCPayServer.Controllers
} }
} }
}
} }

View File

@@ -15,10 +15,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using MimeKit; using MimeKit;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/emails")] [HttpGet("{storeId}/emails")]
public async Task<IActionResult> StoreEmails(string storeId) public async Task<IActionResult> StoreEmails(string storeId)
{ {
@@ -265,5 +265,4 @@ namespace BTCPayServer.Controllers
{ {
return emailSender is not null && (await emailSender.GetEmailSettings())?.IsComplete() == true; return emailSender is not null && (await emailSender.GetEmailSettings())?.IsComplete() == true;
} }
}
} }

View File

@@ -13,10 +13,10 @@ using Microsoft.AspNetCore.Mvc;
using NBitcoin; using NBitcoin;
using NBitcoin.DataEncoders; using NBitcoin.DataEncoders;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
private async Task<Data.WebhookDeliveryData?> LastDeliveryForWebhook(string webhookId) private async Task<Data.WebhookDeliveryData?> LastDeliveryForWebhook(string webhookId)
{ {
return (await _storeRepo.GetWebhookDeliveries(CurrentStore.Id, webhookId, 1)).ToList().FirstOrDefault(); return (await _storeRepo.GetWebhookDeliveries(CurrentStore.Id, webhookId, 1)).ToList().FirstOrDefault();
@@ -187,5 +187,4 @@ namespace BTCPayServer.Controllers
return File(delivery.GetBlob().Request, "application/json"); return File(delivery.GetBlob().Request, "application/json");
} }
}
} }

View File

@@ -16,10 +16,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/lightning/{cryptoCode}")] [HttpGet("{storeId}/lightning/{cryptoCode}")]
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public IActionResult Lightning(string storeId, string cryptoCode) public IActionResult Lightning(string storeId, string cryptoCode)
@@ -339,5 +339,4 @@ namespace BTCPayServer.Controllers
{ {
return store.GetPaymentMethodConfig<T>(paymentMethodId, _handlers); return store.GetPaymentMethodConfig<T>(paymentMethodId, _handlers);
} }
}
} }

View File

@@ -24,10 +24,10 @@ using NBXplorer.DerivationStrategy;
using NBXplorer.Models; using NBXplorer.Models;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/onchain/{cryptoCode}")] [HttpGet("{storeId}/onchain/{cryptoCode}")]
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] [Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public ActionResult SetupWallet(WalletSetupViewModel vm) public ActionResult SetupWallet(WalletSetupViewModel vm)
@@ -861,5 +861,4 @@ namespace BTCPayServer.Controllers
var strategy = parser.Parse(derivationScheme); var strategy = parser.Parse(derivationScheme);
return new DerivationSchemeSettings(strategy, network); return new DerivationSchemeSettings(strategy, network);
} }
}
} }

View File

@@ -14,10 +14,10 @@ using BTCPayServer.Rating;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/rates")] [HttpGet("{storeId}/rates")]
public IActionResult Rates() public IActionResult Rates()
{ {
@@ -186,5 +186,4 @@ namespace BTCPayServer.Controllers
return _rateFactory.RateProviderFactory.AvailableRateProviders return _rateFactory.RateProviderFactory.AvailableRateProviders
.OrderBy(s => s.DisplayName, StringComparer.OrdinalIgnoreCase); .OrderBy(s => s.DisplayName, StringComparer.OrdinalIgnoreCase);
} }
}
} }

View File

@@ -9,10 +9,10 @@ using BTCPayServer.Services.Stores;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/roles")] [HttpGet("{storeId}/roles")]
public async Task<IActionResult> ListRoles( public async Task<IActionResult> ListRoles(
string storeId, string storeId,
@@ -155,5 +155,4 @@ namespace BTCPayServer.Controllers
TempData[WellKnownTempData.SuccessMessage] = "Role deleted"; TempData[WellKnownTempData.SuccessMessage] = "Role deleted";
return RedirectToAction(nameof(ListRoles), new { storeId }); return RedirectToAction(nameof(ListRoles), new { storeId });
} }
}
} }

View File

@@ -14,10 +14,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/settings")] [HttpGet("{storeId}/settings")]
public IActionResult GeneralSettings() public IActionResult GeneralSettings()
{ {
@@ -443,5 +443,4 @@ namespace BTCPayServer.Controllers
return defaultChoice is null ? null : choices.FirstOrDefault(c => defaultChoice.ToString().Equals(c.Value, StringComparison.OrdinalIgnoreCase)); return defaultChoice is null ? null : choices.FirstOrDefault(c => defaultChoice.ToString().Equals(c.Value, StringComparison.OrdinalIgnoreCase));
} }
}
} }

View File

@@ -14,10 +14,10 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using NBitcoin; using NBitcoin;
using NBitcoin.DataEncoders; using NBitcoin.DataEncoders;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/tokens")] [HttpGet("{storeId}/tokens")]
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)] [Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public async Task<IActionResult> ListTokens() public async Task<IActionResult> ListTokens()
@@ -258,5 +258,4 @@ namespace BTCPayServer.Controllers
storeId = store.Id storeId = store.Id
}); });
} }
}
} }

View File

@@ -14,10 +14,10 @@ using BTCPayServer.Services.Stores;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
public partial class UIStoresController
{ {
public partial class UIStoresController
{
[HttpGet("{storeId}/users")] [HttpGet("{storeId}/users")]
public async Task<IActionResult> StoreUsers() public async Task<IActionResult> StoreUsers()
{ {
@@ -144,5 +144,4 @@ namespace BTCPayServer.Controllers
Role = u.StoreRole.Role Role = u.StoreRole.Role
}).ToList(); }).ToList();
} }
}
} }

View File

@@ -24,14 +24,14 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using StoreData = BTCPayServer.Data.StoreData; using StoreData = BTCPayServer.Data.StoreData;
namespace BTCPayServer.Controllers namespace BTCPayServer.Controllers;
[Route("stores")]
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[AutoValidateAntiforgeryToken]
public partial class UIStoresController : Controller
{ {
[Route("stores")]
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
[AutoValidateAntiforgeryToken]
public partial class UIStoresController : Controller
{
public UIStoresController( public UIStoresController(
BTCPayServerOptions btcpayServerOptions, BTCPayServerOptions btcpayServerOptions,
BTCPayServerEnvironment btcpayEnv, BTCPayServerEnvironment btcpayEnv,
@@ -160,5 +160,4 @@ namespace BTCPayServer.Controllers
{ {
return User.Identity?.AuthenticationType != AuthenticationSchemes.Cookie ? null : _userManager.GetUserId(User); return User.Identity?.AuthenticationType != AuthenticationSchemes.Cookie ? null : _userManager.GetUserId(User);
} }
}
} }