diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f72ca7b..b777d46d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
### Changelog
+#### Version - 3.6.1.1 - TBD
+* Fixed `set-nexus-api-key` CLI command
+
#### 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
diff --git a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj
index 26708691..5ea1888d 100644
--- a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj
+++ b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj
@@ -94,7 +94,7 @@
-
+
diff --git a/Wabbajack.CLI/Verbs/SetNexusApiKey.cs b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs
index a442c4d1..a6657644 100644
--- a/Wabbajack.CLI/Verbs/SetNexusApiKey.cs
+++ b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs
@@ -1,13 +1,7 @@
-
-using System.CommandLine;
-using System.CommandLine.Invocation;
-using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.DTOs.Logins;
-using Wabbajack.Paths;
-using Wabbajack.Paths.IO;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack.CLI.Verbs;
@@ -23,7 +17,7 @@ public class SetNexusApiKey
_logger = logger;
}
- public static VerbDefinition Definition = new VerbDefinition("set-nexus-api-key",
+ public static VerbDefinition Definition = new("set-nexus-api-key",
"Sets the Nexus API key to the specified value",
[
new OptionDefinition(typeof(string), "k", "key", "The Nexus API key")
@@ -38,7 +32,7 @@ public class SetNexusApiKey
}
else
{
- await _tokenProvider.SetToken(new NexusOAuthState { ApiKey = key });
+ await _tokenProvider.SetToken(new() { ApiKey = key });
_logger.LogInformation("Set Nexus API Key to {key}", key);
return 0;
}
diff --git a/Wabbajack.CLI/Wabbajack.CLI.csproj b/Wabbajack.CLI/Wabbajack.CLI.csproj
index 7fc4af60..b8995293 100644
--- a/Wabbajack.CLI/Wabbajack.CLI.csproj
+++ b/Wabbajack.CLI/Wabbajack.CLI.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs
index c01eb31e..5511a58b 100644
--- a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs
+++ b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs
@@ -148,8 +148,9 @@ public class DownloadDispatcher
return result;
}
- catch (HttpException)
+ catch (HttpException ex)
{
+ _logger.LogError($"Failed verifying {a.State.PrimaryKeyString}: {ex}");
await _verificationCache.Put(a.State, false);
return false;
}
diff --git a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs
index 74a86805..1168cb5c 100644
--- a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs
+++ b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs
@@ -217,8 +217,9 @@ public class NexusDownloader : ADownloader, IUrlDownloader
return fileInfo.info.FileId == state.FileID;
}
- catch (HttpException)
+ catch (HttpException ex)
{
+ _logger.LogError($"HttpException: {ex} on {archive.Name}");
return false;
}
}
diff --git a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj
index da6b6c5c..34fd44db 100644
--- a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj
+++ b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj
@@ -14,7 +14,7 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Wabbajack.Networking.NexusApi/AuthInfo.cs b/Wabbajack.Networking.NexusApi/AuthInfo.cs
index fa25d3f8..7699e1b4 100644
--- a/Wabbajack.Networking.NexusApi/AuthInfo.cs
+++ b/Wabbajack.Networking.NexusApi/AuthInfo.cs
@@ -3,6 +3,6 @@ using Wabbajack.Networking.Http.Interfaces;
namespace Wabbajack.Networking.NexusApi;
-public interface AuthInfo : ITokenProvider
+public interface IAuthInfo : ITokenProvider
{
}
\ No newline at end of file
diff --git a/Wabbajack.Networking.NexusApi/NexusApi.cs b/Wabbajack.Networking.NexusApi/NexusApi.cs
index b512d265..77d56277 100644
--- a/Wabbajack.Networking.NexusApi/NexusApi.cs
+++ b/Wabbajack.Networking.NexusApi/NexusApi.cs
@@ -188,7 +188,6 @@ public class NexusApi
protected virtual async ValueTask GenerateMessage(HttpMethod method, string uri,
params object?[] parameters)
{
- using var _ = await _authLock.WaitAsync();
var msg = new HttpRequestMessage();
msg.Method = method;
@@ -232,6 +231,7 @@ public class NexusApi
private async ValueTask<(bool IsApiKey, string code)> GetAuthInfo()
{
+ using var _ = await _authLock.WaitAsync();
if (AuthInfo.HaveToken())
{
var info = await AuthInfo.Get();
@@ -272,6 +272,8 @@ public class NexusApi
var response = await _client.PostAsync($"https://users.nexusmods.com/oauth/token", content, cancel);
var responseString = await response.Content.ReadAsStringAsync(cancel);
var newJwt = JsonSerializer.Deserialize(responseString);
+ if (newJwt != null)
+ newJwt.ReceivedAt = DateTime.UtcNow.ToFileTimeUtc();
state.OAuth = newJwt;
await AuthInfo.SetToken(state);
diff --git a/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs b/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs
index 03302585..0556a4fa 100644
--- a/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs
+++ b/Wabbajack.Services.OSIntegrated/TokenProviders/NexusApiTokenProvider.cs
@@ -5,7 +5,7 @@ using Wabbajack.Networking.NexusApi;
namespace Wabbajack.Services.OSIntegrated.TokenProviders;
-public class NexusApiTokenProvider : EncryptedJsonTokenProvider, AuthInfo
+public class NexusApiTokenProvider : EncryptedJsonTokenProvider, IAuthInfo
{
public NexusApiTokenProvider(ILogger logger, DTOSerializer dtos) : base(logger, dtos,
"nexus-oauth-info")