Skip to content

Commit

Permalink
Merge pull request #22 from Digitalroot-Valheim/18-bug-sid_develop-co…
Browse files Browse the repository at this point in the history
…okie-is-gone-from-redesigned-nexus-page

renamed COOKIE_NEXUSMOD_SESSION to NEXUSMOD_SESSION_COOKIE
  • Loading branch information
Digitalroot authored May 22, 2024
2 parents 096d8ce + 4dc4420 commit 36efdc1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
12 changes: 6 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Please use environment variables for the sensitive information.
### Environment Variables
- __NEXUSMOD_API_KEY__
- __COOKIE_NEXUSMOD_SESSION__
- __NEXUSMOD_SESSION_COOKIE__

All Commands support the `-?, -h, --help` options to show help and usage information

Expand Down Expand Up @@ -72,9 +72,9 @@ Usage:
Digitalroot.ModUploader.exe nexusmods check [options]
Options:
-k, --key <key> Api Key, ENV: NEXUSMOD_API_KEY
-cnms, --cookie_nexusmods_session Session Cookie, ENV: COOKIE_NEXUSMOD_SESSION <cookie_nexusmods_session>
-?, -h, --help Show help and usage information
-k, --key <key> Api Key, ENV: NEXUSMOD_API_KEY
-nmsc, --nexusmods_session_cookie <nexusmods_session_cookie_> Session Cookie, ENV: NEXUSMOD_SESSION_COOKIE
-?, -h, --help Show help and usage information
```
---

Expand Down Expand Up @@ -103,13 +103,13 @@ Options:
-dmv, --disable-main-vortex Skips setting file as the main Vortex file. [default: False]
-drpu, --disable-requirements-pop-up Skips informing downloaders of this mod's requirements before they attempt to download this file [default: False]
-k, --key <key> Api Key, ENV: NEXUSMOD_API_KEY
-cnms, --cookie_nexusmods_session <cookie_nexusmods_session> Session Cookie, ENV: COOKIE_NEXUSMOD_SESSION
-nmsc, --nexusmods_session_cookie <nexusmods_session_cookie> Session Cookie, ENV: NEXUSMOD_SESSION_COOKIE
-?, -h, --help Show help and usage information
```

#### Examples
```bash
nexusmods check -k "MyVeryLongNexusApiKey" -cnms "6c1ae4818867700000XX804f1f55ae72"
nexusmods check -k "MyVeryLongNexusApiKey" -nmsc "6c1ae4818867700000XX804f1f55ae72"
```
---
```bash
Expand Down
2 changes: 1 addition & 1 deletion src/Digitalroot.ModUploader/Digitalroot.ModUploader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<VersionPrefix>1.4.0</VersionPrefix>
<VersionPrefix>1.4.1</VersionPrefix>
<RestoreAdditionalProjectSources>
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json;
https://digitalroot-valheim-nuget.s3.us-west-2.amazonaws.com/index.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal static ICommand GetCheckCommand()
var command = new Command("check", "Check that an API Key and Cookie are valid.")
{
CommandHelper.GetOption(new[] { "--key", "-k" }, "Api Key, ENV: " + "NEXUSMOD_API_KEY".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("NEXUSMOD_API_KEY"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--cookie_nexusmods_session", "-cnms" }, "Session Cookie, ENV: " + "COOKIE_NEXUSMOD_SESSION".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("COOKIE_NEXUSMOD_SESSION"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--nexusmods_session_cookie", "-nmsc" }, "Session Cookie, ENV: " + "NEXUSMOD_SESSION_COOKIE".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("NEXUSMOD_SESSION_COOKIE"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
};

command.Handler = GetCommandHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal static ICommand GetUploadCommand()
, CommandHelper.GetOption(new[] { "--disable-main-vortex", "-dmv" }, "Skips setting file as the main Vortex file.", false, optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--disable-requirements-pop-up", "-drpu" }, "Skips informing downloaders of this mod's requirements before they attempt to download this file", false, optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--key", "-k" }, "Api Key, ENV: " + "NEXUSMOD_API_KEY".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("NEXUSMOD_API_KEY"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--cookie_nexusmods_session", "-cnms" }, "Session Cookie, ENV: " + "COOKIE_NEXUSMOD_SESSION".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("COOKIE_NEXUSMOD_SESSION"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
, CommandHelper.GetOption(new[] { "--nexusmods_session_cookie", "-nmsc" }, "Session Cookie, ENV: " + "NEXUSMOD_SESSION_COOKIE".Pastel(ColorOptions.EmColor), CommandUtils.RestClient.GetDefaultConfigValue("NEXUSMOD_SESSION_COOKIE"), optionValidatorsFactory: ValidatorsFactory.Instance) as Option ?? throw new InvalidOperationException()
};

command.Handler = GetCommandHandler();
Expand Down Expand Up @@ -94,7 +94,7 @@ private static ICommandHandler GetCommandHandler()
, disableMainVortex // bool
, disableRequirementsPopUp // bool
, key // string
, nexusmodsSession // string
, nexusmodsSessionCookie // string
) =>
{
// Get Game Info
Expand Down Expand Up @@ -149,7 +149,7 @@ async void RunUploadWorkFlowAsync(int i)
var uploadFileChunk = await GetUploadWorkflowAsync(i
, totalChunks
, archiveFile
, nexusmodsSession
, nexusmodsSessionCookie
, modId
, fileName
, version
Expand Down Expand Up @@ -183,7 +183,7 @@ async void RunUploadWorkFlowAsync(int i)
CheckFileStatusRequestModel,
CheckFileStatusResponse,
CheckFileStatusResponseModel
> checkFileStatus = await CheckFileStatusAsync(nexusmodsSession
> checkFileStatus = await CheckFileStatusAsync(nexusmodsSessionCookie
, uploadFileChunk.ResponseModel);
// Attach file to Mod.
Expand All @@ -197,7 +197,7 @@ async void RunUploadWorkFlowAsync(int i)
AddFileToModRequestModel,
AddFileToModResponse,
AddFileToModResponseModel
> addFileToMod = await AddFileToModAsync(nexusmodsSession
> addFileToMod = await AddFileToModAsync(nexusmodsSessionCookie
, modId
, version
, disableVersionUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,11 @@ protected override void OnStringValidation(OptionResult optionResult)

break;

case "cookie_nexusmods_session":
case "cnms":
case "nexusmods_session_cookie":
case "nmsc":
if ((optionResult.Tokens.Count != 1
|| string.IsNullOrEmpty(optionResult.Tokens[0].Value))
&& string.IsNullOrEmpty(CommandUtils.RestClient.GetDefaultConfigValue("COOKIE_NEXUSMOD_SESSION")))
{
AddErrorMessage(optionResult, $"Error: --{optionResult.Symbol.Name} value is missing.");
}

break;

case "cookie_nexusmods_session_refresh":
case "cnmsr":
if ((optionResult.Tokens.Count != 1
|| string.IsNullOrEmpty(optionResult.Tokens[0].Value))
&& string.IsNullOrEmpty(CommandUtils.RestClient.GetDefaultConfigValue("COOKIE_NEXUSMOD_SESSION_REFRESH")))
&& string.IsNullOrEmpty(CommandUtils.RestClient.GetDefaultConfigValue("NEXUSMOD_SESSION_COOKIE")))
{
AddErrorMessage(optionResult, $"Error: --{optionResult.Symbol.Name} value is missing.");
}
Expand Down

0 comments on commit 36efdc1

Please sign in to comment.