Skip to content

Commit

Permalink
Fix trakt & token persistence..
Browse files Browse the repository at this point in the history
Old typo from the .net core refactor.
  • Loading branch information
Cazzar committed Sep 5, 2019
1 parent 443992d commit 895c9bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -910,11 +910,11 @@ public int TraktScrobble(int animeId, int type, int progress, int status)
} }


[HttpPost("Trakt/Refresh/{traktID}")] [HttpPost("Trakt/Refresh/{traktID}")]
public string UpdateTraktData(string traktD) public string UpdateTraktData(string traktID)
{ {
try try
{ {
TraktTVHelper.UpdateAllInfo(traktD); TraktTVHelper.UpdateAllInfo(traktID);
} }
catch (Exception ex) catch (Exception ex)
{ {
Expand Down
6 changes: 6 additions & 0 deletions Shoko.Server/Providers/TraktTV/TraktTVHelper.cs
Expand Up @@ -258,6 +258,7 @@ public static void RefreshAuthToken()


return; return;
} }

ServerSettings.Instance.TraktTv.AuthToken = string.Empty; ServerSettings.Instance.TraktTv.AuthToken = string.Empty;
ServerSettings.Instance.TraktTv.RefreshToken = string.Empty; ServerSettings.Instance.TraktTv.RefreshToken = string.Empty;
ServerSettings.Instance.TraktTv.TokenExpirationDate = string.Empty; ServerSettings.Instance.TraktTv.TokenExpirationDate = string.Empty;
Expand All @@ -270,6 +271,10 @@ public static void RefreshAuthToken()


logger.Error(ex, "Error in TraktTVHelper.RefreshAuthToken: " + ex); logger.Error(ex, "Error in TraktTVHelper.RefreshAuthToken: " + ex);
} }
finally
{
ServerSettings.Instance.SaveSettings();
}
} }


#endregion #endregion
Expand Down Expand Up @@ -371,6 +376,7 @@ private static void TraktAutoDeviceTokenWorker(TraktAuthDeviceCodeToken deviceCo
long expireDate = createdAt + validity; long expireDate = createdAt + validity;


ServerSettings.Instance.TraktTv.TokenExpirationDate = expireDate.ToString(); ServerSettings.Instance.TraktTv.TokenExpirationDate = expireDate.ToString();
ServerSettings.Instance.SaveSettings();
break; break;
} }
if (response == TraktStatusCodes.Rate_Limit_Exceeded) if (response == TraktStatusCodes.Rate_Limit_Exceeded)
Expand Down

0 comments on commit 895c9bd

Please sign in to comment.