diff --git a/Server/API/RemoteControlController.cs b/Server/API/RemoteControlController.cs index 5f2aa6edd..4c84cfba9 100644 --- a/Server/API/RemoteControlController.cs +++ b/Server/API/RemoteControlController.cs @@ -13,6 +13,7 @@ using Remotely.Server.Models; using Remotely.Server.Services; using Remotely.Server.Auth; +using Remotely.Shared.Helpers; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 @@ -100,12 +101,9 @@ private async Task InitiateRemoteControl(string deviceID, string var stopWatch = Stopwatch.StartNew(); - while (!RCDeviceSocketHub.SessionInfoList.Values.Any(x => x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y => y.Key != x.RCDeviceSocketID)) && stopWatch.Elapsed.TotalSeconds < 5) - { - await Task.Delay(10); - } + Func remoteControlStarted = () => RCDeviceSocketHub.SessionInfoList.Values.Any(x => x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y => y.Key != x.RCDeviceSocketID)); - if (!RCDeviceSocketHub.SessionInfoList.Values.Any(x => x.DeviceID == targetDevice.Value.ID && !existingSessions.Any(y => y.Key != x.RCDeviceSocketID))) + if (!await TaskHelper.DelayUntil(remoteControlStarted, TimeSpan.FromSeconds(15))) { return StatusCode(408, "The remote control process failed to start in time on the remote device."); } diff --git a/Server/Areas/Identity/Pages/Account/Manage/ApiTokens.cshtml b/Server/Areas/Identity/Pages/Account/Manage/ApiTokens.cshtml index 151b4f0c8..bc572f925 100644 --- a/Server/Areas/Identity/Pages/Account/Manage/ApiTokens.cshtml +++ b/Server/Areas/Identity/Pages/Account/Manage/ApiTokens.cshtml @@ -4,6 +4,7 @@ @{ ViewData["Title"] = "API Access Tokens"; } +

@ViewData["Title"]

@if (!string.IsNullOrWhiteSpace(Model.Message)) @@ -27,11 +28,12 @@ @if (Model.IsAdmin) { -
- - - -
+
+ + + + +
@@ -68,6 +70,28 @@
+ +