From 329980c727cf03587ff5f4011a3af3ef2fa5e4f1 Mon Sep 17 00:00:00 2001
From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com>
Date: Thu, 18 Jun 2020 01:58:58 -0500
Subject: API cleanup
---
.../QuickConnect/QuickConnectManager.cs | 35 +++++-----------------
1 file changed, 7 insertions(+), 28 deletions(-)
(limited to 'Emby.Server.Implementations')
diff --git a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
index 8d704f32b..263556e9d 100644
--- a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
+++ b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
@@ -75,18 +75,15 @@ namespace Emby.Server.Implementations.QuickConnect
{
if (State != QuickConnectState.Active)
{
- throw new InvalidOperationException("Quick connect is not active on this server");
+ throw new ArgumentException("Quick connect is not active on this server");
}
}
///
- public QuickConnectResult Activate()
+ public void Activate()
{
- SetEnabled(QuickConnectState.Active);
-
DateActivated = DateTime.Now;
-
- return new QuickConnectResult();
+ SetEnabled(QuickConnectState.Active);
}
///
@@ -149,19 +146,6 @@ namespace Emby.Server.Implementations.QuickConnect
return result;
}
- public List GetCurrentRequests()
- {
- return GetCurrentRequestsInternal().Select(x => (QuickConnectResultDto)x).ToList();
- }
-
- ///
- public List GetCurrentRequestsInternal()
- {
- ExpireRequests();
- AssertActive();
- return _currentRequests.Values.ToList();
- }
-
///
public string GenerateCode()
{
@@ -215,7 +199,7 @@ namespace Emby.Server.Implementations.QuickConnect
UserId = auth.UserId
});
- _logger.LogInformation("Allowing device {0} to login as user {1} with quick connect code {2}", result.FriendlyName, auth.User.Name, result.Code);
+ _logger.LogInformation("Allowing device {0} to login as user {1} with quick connect code {2}", result.FriendlyName, auth.User.Username, result.Code);
return true;
}
@@ -269,11 +253,8 @@ namespace Emby.Server.Implementations.QuickConnect
return Hex.Encode(bytes);
}
- ///
- /// Expire quick connect requests that are over the time limit. If is true, all requests are unconditionally expired.
- ///
- /// If true, all requests will be expired.
- private void ExpireRequests(bool expireAll = false)
+ ///
+ public void ExpireRequests(bool expireAll = false)
{
// Check if quick connect should be deactivated
if (State == QuickConnectState.Active && DateTime.Now > DateActivated.AddMinutes(Timeout) && !expireAll)
@@ -309,9 +290,7 @@ namespace Emby.Server.Implementations.QuickConnect
private void ReloadConfiguration()
{
- var available = _config.Configuration.QuickConnectAvailable;
-
- State = available ? QuickConnectState.Available : QuickConnectState.Unavailable;
+ State = _config.Configuration.QuickConnectAvailable ? QuickConnectState.Available : QuickConnectState.Unavailable;
}
}
}
--
cgit v1.2.3