Skip to content

Commit

Permalink
Cleanup GetPlexKey
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Jan 11, 2024
1 parent 5c7c163 commit 95e343a
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions Shoko.Server/Plex/PlexHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlexKey>(content);
return _key;
return _key = JsonConvert.DeserializeObject<PlexKey>(content);
}

private string GetPlexToken()
Expand Down

0 comments on commit 95e343a

Please sign in to comment.