mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-24 01:14:20 +01:00
Refactoring
This commit is contained in:
@@ -67,8 +67,13 @@ namespace BTCPayServer.Controllers
|
|||||||
int? pin = null;
|
int? pin = null;
|
||||||
var websocketHelper = new WebSocketHelper(websocket);
|
var websocketHelper = new WebSocketHelper(websocket);
|
||||||
|
|
||||||
async Task<bool> RequireMoreInformation()
|
async Task<bool> RequireDeviceUnlocking()
|
||||||
{
|
{
|
||||||
|
if (deviceEntry == null)
|
||||||
|
{
|
||||||
|
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (deviceEntry.NeedsPinSent is true && pin is null)
|
if (deviceEntry.NeedsPinSent is true && pin is null)
|
||||||
{
|
{
|
||||||
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
|
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
|
||||||
@@ -95,12 +100,7 @@ namespace BTCPayServer.Controllers
|
|||||||
password = device.Password;
|
password = device.Password;
|
||||||
break;
|
break;
|
||||||
case "ask-sign":
|
case "ask-sign":
|
||||||
if (device == null)
|
if (await RequireDeviceUnlocking())
|
||||||
{
|
|
||||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (await RequireMoreInformation())
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -163,12 +163,7 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "ask-xpubs":
|
case "ask-xpubs":
|
||||||
if (device == null)
|
if (await RequireDeviceUnlocking())
|
||||||
{
|
|
||||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (await RequireMoreInformation())
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user