This commit is contained in:
halgari 2024-05-26 18:46:54 -06:00
parent a5d9bea0ab
commit b84bfe2364
2 changed files with 5 additions and 2 deletions

View File

@ -1,9 +1,10 @@
### Changelog ### Changelog
#### Version - 3.6.1.0 - TBD #### Version - 3.6.1.0 - 5/26/2024
* Fixed a race condition on renewing Nexus Mods OAuth2 tokens
* Added `set-nexus-api-key` CLI command * Added `set-nexus-api-key` CLI command
* Added Starfield meta data * Added Starfield meta data
* Added Fallout New Vegas Epic Games meta data * Added Fallout New Vegas Epic Games metadata
#### Version - 3.6.0.0 - 5/25/2024 #### Version - 3.6.0.0 - 5/25/2024
* Wabbajack now uses OAuth2 for Nexus Mods logins * Wabbajack now uses OAuth2 for Nexus Mods logins

View File

@ -33,6 +33,7 @@ public class NexusApi
public readonly ITokenProvider<NexusOAuthState> AuthInfo; public readonly ITokenProvider<NexusOAuthState> AuthInfo;
private DateTime _lastValidated; private DateTime _lastValidated;
private (ValidateInfo info, ResponseMetadata header) _lastValidatedInfo; private (ValidateInfo info, ResponseMetadata header) _lastValidatedInfo;
private AsyncLock _authLock = new();
public NexusApi(ITokenProvider<NexusOAuthState> authInfo, ILogger<NexusApi> logger, HttpClient client, public NexusApi(ITokenProvider<NexusOAuthState> authInfo, ILogger<NexusApi> logger, HttpClient client,
IResource<HttpClient> limiter, ApplicationInfo appInfo, JsonSerializerOptions jsonOptions) IResource<HttpClient> limiter, ApplicationInfo appInfo, JsonSerializerOptions jsonOptions)
@ -187,6 +188,7 @@ public class NexusApi
protected virtual async ValueTask<HttpRequestMessage> GenerateMessage(HttpMethod method, string uri, protected virtual async ValueTask<HttpRequestMessage> GenerateMessage(HttpMethod method, string uri,
params object?[] parameters) params object?[] parameters)
{ {
using var _ = await _authLock.WaitAsync();
var msg = new HttpRequestMessage(); var msg = new HttpRequestMessage();
msg.Method = method; msg.Method = method;