mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 11:35:51 +01:00
Do not cleanup unreachable stores (#5025)
This commit is contained in:
parent
16b988d097
commit
0a0cf97c55
5 changed files with 16 additions and 21 deletions
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Amazon.S3.Transfer;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Abstractions.Extensions;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
|
@ -167,9 +166,17 @@ namespace BTCPayServer.Controllers
|
|||
[FromServices] StoreRepository storeRepository,
|
||||
string role)
|
||||
{
|
||||
await storeRepository.SetDefaultRole(role);
|
||||
|
||||
TempData[WellKnownTempData.SuccessMessage] = "Role set default";
|
||||
var resolved = await storeRepository.ResolveStoreRoleId(null, role);
|
||||
if (resolved is null)
|
||||
{
|
||||
TempData[WellKnownTempData.ErrorMessage] = "Role could not be set as default";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
await storeRepository.SetDefaultRole(role);
|
||||
TempData[WellKnownTempData.SuccessMessage] = "Role set default";
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(ListRoles));
|
||||
}
|
||||
|
|
|
@ -111,12 +111,6 @@ namespace BTCPayServer.Hosting
|
|||
settings.DeprecatedLightningConnectionStringCheck = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
if (!settings.UnreachableStoreCheck)
|
||||
{
|
||||
await UnreachableStoreCheck();
|
||||
settings.UnreachableStoreCheck = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
if (!settings.ConvertMultiplierToSpread)
|
||||
{
|
||||
await ConvertMultiplierToSpread();
|
||||
|
@ -1068,11 +1062,6 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
private Task UnreachableStoreCheck()
|
||||
{
|
||||
return _StoreRepository.CleanUnreachableStores();
|
||||
}
|
||||
|
||||
private async Task DeprecatedLightningConnectionStringCheck()
|
||||
{
|
||||
using var ctx = _DBContextFactory.CreateContext();
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace BTCPayServer.Services
|
|||
[JsonProperty("MigrateHotwalletProperty2")]
|
||||
public bool MigrateHotwalletProperty { get; set; }
|
||||
public bool MigrateU2FToFIDO2 { get; set; }
|
||||
public bool UnreachableStoreCheck { get; set; }
|
||||
public bool DeprecatedLightningConnectionStringCheck { get; set; }
|
||||
public bool ConvertMultiplierToSpread { get; set; }
|
||||
public bool ConvertNetworkFeeProperty { get; set; }
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Amazon.S3;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Data;
|
||||
|
@ -229,18 +230,19 @@ namespace BTCPayServer.Services.Stores
|
|||
/// <param name="storeId"></param>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<StoreRoleId?> ResolveStoreRoleId(string storeId, string? role)
|
||||
public async Task<StoreRoleId?> ResolveStoreRoleId(string? storeId, string? role)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(role))
|
||||
return null;
|
||||
var isStoreRole = role.Contains("::", StringComparison.OrdinalIgnoreCase);
|
||||
if(isStoreRole && (string.IsNullOrEmpty(storeId) || !role.Contains(storeId, StringComparison.InvariantCultureIgnoreCase)))
|
||||
if (storeId?.Contains("::", StringComparison.OrdinalIgnoreCase) is true)
|
||||
return null;
|
||||
var roleId = StoreRoleId.Parse(role);
|
||||
if (roleId.StoreId != null && roleId.StoreId != storeId)
|
||||
return null;
|
||||
if ((await GetStoreRole(roleId)) != null)
|
||||
return roleId;
|
||||
if (string.IsNullOrEmpty(storeId))
|
||||
return null;
|
||||
if (roleId.IsServerRole)
|
||||
roleId = new StoreRoleId(storeId, role);
|
||||
if ((await GetStoreRole(roleId)) != null)
|
||||
|
|
|
@ -157,8 +157,6 @@ namespace BTCPayServer.Services
|
|||
{
|
||||
_logger.LogError($"Failed to delete user {user.Id}");
|
||||
}
|
||||
|
||||
await _storeRepository.CleanUnreachableStores();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue