Skip to content

Commit 76aa1f2

Browse files
authored
Merge pull request #2836 from wabbajack-tools/4.0.4.0
4.0.4.0
2 parents a79ac87 + 9b17fc3 commit 76aa1f2

File tree

7 files changed

+66
-19
lines changed

7 files changed

+66
-19
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
### Changelog
22

3+
#### Version - 4.0.4.0
4+
* Fixed the Nexus OAuth token never being refreshed upon starting installation or during downloads
5+
* This could lead to issues after having not logged back into Nexus for 6 hours after your initial login
6+
* Fixed an issue with the Google Drive downloader not being able to download files when not prompted with a harmful file warning
7+
* Fixed Wabbajack not properly sourcing files from other installed games (for example when using Skyrim SE DLC on Skyrim VR modlists) ([@JanuarySnow](https://www.github.com/JanuarySnow)])
8+
* Fixed Wabbajack crashing when navigating the 'Has Mod(s)' filter in the gallery with arrow keys
9+
310
#### Version - 4.0.3.0 - 7/18/2025
411
* The link to a missing Nexus file now directly opens to the specific missing archive instead of the general mod page ([@ninjawaffle](https://www.github.com/ninjawaffle))
512
* Fixed version not properly being inlined into the executable ([@EzioTheDeadPoet](https://www.github.com/EzioTheDeadPoet))
613
* This means you won't see a 4.0.0.0 version in the bottom left of Wabbajack when you actually have 4.0.2.0.
714
* Reintroduced hash-game-files function in the CLI to add support for new games ([@JanuarySnow](https://www.github.com/JanuarySnow))
8-
* Added support for extracting InnoSetup executables ([@EzioTheDeadPoet](https://www.github.com/EzioTheDeadPoet)))
15+
* Added support for extracting InnoSetup executables ([@EzioTheDeadPoet](https://www.github.com/EzioTheDeadPoet))
916
* As part of this, temporary files are now extracted to shorter folder names
1017
* Fixed a bug where searching for Nexus archives in the modlist overview would only search on the mod name instead of the archive name
1118
* Fixed the MEGA integration breaking with 402 Payment Required error messages after they implemented hashcashes

Wabbajack.App.Wpf/Themes/Styles.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,6 @@
28672867
<Setter Property="Background" Value="{StaticResource ComplementaryPrimary08Brush}"/>
28682868
<Setter Property="BorderBrush" Value="Transparent"/>
28692869
<Setter Property="BorderThickness" Value="0"/>
2870-
<Setter Property="FocusVisualStyle" Value="{StaticResource MultiSelectComboBox.FocusVisual}"/>
28712870
<Setter Property="Template">
28722871
<Setter.Value>
28732872
<ControlTemplate TargetType="{x:Type controls:ExtendedListBoxItem}">

Wabbajack.App.Wpf/ViewModels/Installers/InstallationVM.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,11 @@ await Task.Run(async () =>
619619

620620
try
621621
{
622+
var canSource = GameRegistry.Games[ModList.GameType].CanSourceFrom ?? Array.Empty<Game>();
622623
var cfg = new InstallerConfiguration
623624
{
624625
Game = ModList.GameType,
626+
OtherGames = canSource,
625627
Downloads = Installer.DownloadLocation.TargetPath,
626628
Install = Installer.Location.TargetPath,
627629
ModList = ModList,

Wabbajack.Downloaders.GoogleDrive/GoogleDriveDownloader.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ public override IEnumerable<string> MetaIni(Archive a, DTOs.DownloadStates.Googl
151151
}
152152
}
153153
}
154+
else if(warning == default && response.Content.Headers.ContentType?.MediaType == "application/octet-stream")
155+
{
156+
qb.Add("id", state.Id);
157+
qb.Add("export", "download");
158+
url = $"https://drive.usercontent.google.com/download";
159+
}
160+
154161
response.Dispose();
155162

156163
var httpState = new HttpRequestMessage(HttpMethod.Get, url + qb.ToString());

Wabbajack.Downloaders.Nexus/NexusDownloader.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ public NexusDownloader(ILogger<NexusDownloader> logger, HttpClient client, IHttp
4646
_interventionLimiter = interventionLimiter;
4747
}
4848

49-
public override Task<bool> Prepare()
49+
public override async Task<bool> Prepare()
5050
{
51-
return Task.FromResult(_api.AuthInfo.HaveToken());
51+
if (!_api.AuthInfo.HaveToken()) return false;
52+
53+
await EnsureLoginStillValid();
54+
return true;
5255
}
5356

5457
public override bool IsAllowed(ServerAllowList allowList, IDownloadState state)
@@ -121,6 +124,8 @@ public Uri UnParse(IDownloadState state)
121124
public override async Task<Hash> Download(Archive archive, Nexus state, AbsolutePath destination,
122125
IJob job, CancellationToken token)
123126
{
127+
await EnsureLoginStillValid();
128+
124129
if (IsManualDebugMode || !(await _api.IsPremium(token)))
125130
{
126131
return await DownloadManually(archive, state, destination, job, token);
@@ -168,6 +173,15 @@ public override async Task<Hash> Download(Archive archive, Nexus state, Absolute
168173
}
169174
}
170175

176+
private async Task EnsureLoginStillValid()
177+
{
178+
var oAuthToken = await _api.AuthInfo.Get();
179+
if (oAuthToken?.OAuth?.IsExpired ?? true)
180+
{
181+
await _api.Validate();
182+
}
183+
}
184+
171185
private async Task<Hash> DownloadManually(Archive archive, Nexus state, AbsolutePath destination, IJob job, CancellationToken token)
172186
{
173187
var md = new ManualDownload(new Archive
@@ -206,6 +220,7 @@ public override async Task<bool> Verify(Archive archive, Nexus state, IJob job,
206220
{
207221
try
208222
{
223+
await EnsureLoginStillValid();
209224
var fileInfo = await _api.FileInfo(state.Game.MetaData().NexusName!, state.ModID, state.FileID, token);
210225
var (modInfo, _) = await _api.ModInfo(state.Game.MetaData().NexusName!, state.ModID, token);
211226

Wabbajack.Installer/AInstaller.cs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
@@ -455,32 +455,45 @@ public async Task HashArchives(CancellationToken token)
455455
NextStep(Consts.StepHashing, "Hashing Archives", 0);
456456
_logger.LogInformation("Looking for files to hash");
457457

458+
// Collect all game folders – primary plus other games
459+
var gameFolders = new HashSet<AbsolutePath>();
460+
461+
void AddIfValid(AbsolutePath p)
462+
{
463+
if (p != default && p != AbsolutePath.Empty)
464+
gameFolders.Add(p);
465+
}
466+
467+
AddIfValid(_gameLocator.GameLocation(_configuration.Game));
468+
469+
foreach (var g in _configuration.OtherGames ?? Array.Empty<Game>())
470+
AddIfValid(_gameLocator.GameLocation(g));
471+
472+
// Enumerate downloads + every game folder
458473
var allFiles = _configuration.Downloads.EnumerateFiles()
459-
.Concat(_gameLocator.GameLocation(_configuration.Game).EnumerateFiles())
474+
.Concat(gameFolders.SelectMany(p => p.EnumerateFiles()))
460475
.ToList();
461476

462477
_logger.LogInformation("Getting archive sizes");
463-
var hashDict = (await allFiles.PMapAllBatched(_limiter, x => (x, x.Size())).ToList())
478+
var hashDict = (await allFiles.PMapAllBatched(_limiter,
479+
x => (x, x.Size())).ToList())
464480
.GroupBy(f => f.Item2)
465481
.ToDictionary(g => g.Key, g => g.Select(v => v.x));
466482

467483
_logger.LogInformation("Linking archives to downloads");
468484
var toHash = ModList.Archives.Where(a => hashDict.ContainsKey(a.Size))
469-
.SelectMany(a => hashDict[a.Size]).ToList();
485+
.SelectMany(a => hashDict[a.Size])
486+
.ToList();
470487

471488
MaxStepProgress = toHash.Count;
489+
_logger.LogInformation("Found {count} total files, {hashedCount} matching filesize",
490+
allFiles.Count, toHash.Count);
472491

473-
_logger.LogInformation("Found {count} total files, {hashedCount} matching filesize", allFiles.Count,
474-
toHash.Count);
475-
476-
var hashResults = await
477-
toHash
478-
.PMapAll(async e =>
479-
{
480-
UpdateProgress(1);
481-
return (await FileHashCache.FileHashCachedAsync(e, token), e);
482-
})
483-
.ToList();
492+
var hashResults = await toHash.PMapAll(async e =>
493+
{
494+
UpdateProgress(1);
495+
return (await FileHashCache.FileHashCachedAsync(e, token), e);
496+
}).ToList();
484497

485498
HashedArchives = hashResults
486499
.OrderByDescending(e => e.Item2.LastModified())
@@ -491,6 +504,8 @@ public async Task HashArchives(CancellationToken token)
491504
}
492505

493506

507+
508+
494509
/// <summary>
495510
/// The user may already have some files in the _configuration.Install. If so we can go through these and
496511
/// figure out which need to be updated, deleted, or left alone

Wabbajack.Installer/InstallerConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Wabbajack.DTOs;
23
using Wabbajack.Paths;
34

@@ -11,6 +12,7 @@ public class InstallerConfiguration
1112
public AbsolutePath Downloads { get; set; }
1213
public SystemParameters? SystemParameters { get; set; }
1314
public Game Game { get; set; }
15+
public Game[]? OtherGames { get; set; } = Array.Empty<Game>();
1416
public AbsolutePath GameFolder { get; set; }
1517

1618
public ModlistMetadata? Metadata { get; set; }

0 commit comments

Comments
 (0)