From 95e343a858e7c44d720c3414ccb73d89444db35d Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Thu, 11 Jan 2024 17:08:38 -0500 Subject: [PATCH] Cleanup GetPlexKey --- Shoko.Server/Plex/PlexHelper.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Shoko.Server/Plex/PlexHelper.cs b/Shoko.Server/Plex/PlexHelper.cs index 29201ef30..6e4f7fbac 100644 --- a/Shoko.Server/Plex/PlexHelper.cs +++ b/Shoko.Server/Plex/PlexHelper.cs @@ -205,22 +205,10 @@ private static void SetupHttpClient(HttpClient client, TimeSpan timeout) private PlexKey GetPlexKey() { - if (_key != null) - { - if (_key.ExpiresAt > DateTime.Now) - { - return _key; - } - - if (_key.ExpiresAt <= DateTime.Now) - { - _key = null; - } - } + if (_key != null && _key.ExpiresAt > DateTime.Now) return _key; var (_, content) = RequestAsync("https://plex.tv/api/v2/pins?strong=true", HttpMethod.Post).Result; - _key = JsonConvert.DeserializeObject(content); - return _key; + return _key = JsonConvert.DeserializeObject(content); } private string GetPlexToken()