From 21369241611031308f504916c51c95731a6d6b6a Mon Sep 17 00:00:00 2001 From: halgari Date: Sat, 22 Aug 2020 15:14:38 -0600 Subject: [PATCH] Fixes for broken RGE install --- Wabbajack.CLI/Wabbajack.CLI.csproj | 4 ++-- Wabbajack.Launcher/Wabbajack.Launcher.csproj | 4 ++-- Wabbajack.Lib/AInstaller.cs | 12 +----------- Wabbajack.Lib/NexusApi/HtmlInterface.cs | 7 +++++++ Wabbajack.Server/DataLayer/Nexus.cs | 4 +++- Wabbajack.Server/Wabbajack.Server.csproj | 4 ++-- Wabbajack.Test/ContentRightsManagementTests.cs | 2 ++ Wabbajack/Wabbajack.csproj | 4 ++-- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Wabbajack.CLI/Wabbajack.CLI.csproj b/Wabbajack.CLI/Wabbajack.CLI.csproj index 1021a0e5..02f0c748 100644 --- a/Wabbajack.CLI/Wabbajack.CLI.csproj +++ b/Wabbajack.CLI/Wabbajack.CLI.csproj @@ -6,8 +6,8 @@ wabbajack-cli Wabbajack x64 - 2.2.1.4 - 2.2.1.4 + 2.2.1.5 + 2.2.1.5 Copyright © 2019-2020 An automated ModList installer true diff --git a/Wabbajack.Launcher/Wabbajack.Launcher.csproj b/Wabbajack.Launcher/Wabbajack.Launcher.csproj index 86437b71..7b4562f6 100644 --- a/Wabbajack.Launcher/Wabbajack.Launcher.csproj +++ b/Wabbajack.Launcher/Wabbajack.Launcher.csproj @@ -4,8 +4,8 @@ WinExe netcoreapp3.1 true - 2.2.1.4 - 2.2.1.4 + 2.2.1.5 + 2.2.1.5 Copyright © 2019-2020 Wabbajack Application Launcher true diff --git a/Wabbajack.Lib/AInstaller.cs b/Wabbajack.Lib/AInstaller.cs index 1dd34fa2..88589be4 100644 --- a/Wabbajack.Lib/AInstaller.cs +++ b/Wabbajack.Lib/AInstaller.cs @@ -196,9 +196,6 @@ namespace Wabbajack.Lib Status($"Verifying unpatched file {toPatch.To.FileName}"); var toFile = OutputFolder.Combine(toPatch.To); - var hash = await toFile.FileHashAsync(); - if (hash != toPatch.FromHash) - throw new InvalidDataException($"Invalid Hash for {toPatch.To} before patching"); byte[] patchData = await LoadBytesFromPath(toPatch.PatchID); @@ -213,18 +210,11 @@ namespace Wabbajack.Lib Utils.ApplyPatch(oldData, () => new MemoryStream(patchData), outStream); } - Status($"Verifying Patch {toPatch.To.FileName}"); - hash = await toFile.FileHashAsync(); - if (hash != toPatch.Hash) - { - Utils.Log($"NOTE: Invalid Hash for {toPatch.To} after patching {hash} vs {toPatch.Hash}"); - } - if (await VirusScanner.ShouldScan(toFile) && await ClientAPI.GetVirusScanResult(toFile) == VirusScanner.Result.Malware) { await toFile.DeleteAsync(); - Utils.ErrorThrow(new Exception($"Virus scan of patched executable reported possible malware: {toFile.ToString()} ({(long)hash})")); + Utils.ErrorThrow(new Exception($"Virus scan of patched executable reported possible malware: {toFile.ToString()} ({(long)await toFile.FileHashCachedAsync()})")); } } diff --git a/Wabbajack.Lib/NexusApi/HtmlInterface.cs b/Wabbajack.Lib/NexusApi/HtmlInterface.cs index 9cb14a65..0cbdcd69 100644 --- a/Wabbajack.Lib/NexusApi/HtmlInterface.cs +++ b/Wabbajack.Lib/NexusApi/HtmlInterface.cs @@ -31,6 +31,12 @@ namespace Wabbajack.Lib.NexusApi .SelectMany(d => d.ParentNode.ParentNode.GetClasses()) .FirstOrDefault(perm => perm.StartsWith("permission-")); + var not_found = response.DocumentNode.Descendants() + .Where(d => d.Id == $"{modId}-title") + .Select(d => d.InnerText) + .FirstOrDefault() == "Not found"; + if (not_found) return PermissionValue.NotFound; + return perm switch { "permission-no" => PermissionValue.No, @@ -46,6 +52,7 @@ namespace Wabbajack.Lib.NexusApi Yes = 1, Maybe = 2, Hidden = 3, + NotFound = 4 } } } diff --git a/Wabbajack.Server/DataLayer/Nexus.cs b/Wabbajack.Server/DataLayer/Nexus.cs index d4b526f1..498f70a3 100644 --- a/Wabbajack.Server/DataLayer/Nexus.cs +++ b/Wabbajack.Server/DataLayer/Nexus.cs @@ -137,7 +137,9 @@ namespace Wabbajack.Server.DataLayer var results = await conn.QueryAsync<(int, long, int)>(@"SELECT NexusGameID, ModID, Permissions FROM NexusModPermissions WHERE Permissions = @Permissions UNION - SELECT Game, ModID, @Permissions from dbo.NexusModFiles where JSON_QUERY(Data, '$.files') = '[]'", + SELECT Game, mf.ModID, 3 from dbo.NexusModFiles mf + LEFT JOIN NexusModPermissions mp on mf.Game = mp.NexusGameID AND mf.ModId = mp.ModID + WHERE JSON_QUERY(Data, '$.files') = '[]' AND mp.Permissions != 4", new {Permissions = (int)HTMLInterface.PermissionValue.Hidden}); return results.ToDictionary(f => (GameRegistry.ByNexusID[f.Item1], f.Item2), f => (HTMLInterface.PermissionValue)f.Item3); diff --git a/Wabbajack.Server/Wabbajack.Server.csproj b/Wabbajack.Server/Wabbajack.Server.csproj index fefcc2e5..ce991011 100644 --- a/Wabbajack.Server/Wabbajack.Server.csproj +++ b/Wabbajack.Server/Wabbajack.Server.csproj @@ -3,8 +3,8 @@ Exe netcoreapp3.1 - 2.2.1.4 - 2.2.1.4 + 2.2.1.5 + 2.2.1.5 Copyright © 2019-2020 Wabbajack Server win-x64 diff --git a/Wabbajack.Test/ContentRightsManagementTests.cs b/Wabbajack.Test/ContentRightsManagementTests.cs index 3eebcabb..7526097a 100644 --- a/Wabbajack.Test/ContentRightsManagementTests.cs +++ b/Wabbajack.Test/ContentRightsManagementTests.cs @@ -124,6 +124,8 @@ namespace Wabbajack.Test Assert.Equal(HTMLInterface.PermissionValue.No, await HTMLInterface.GetUploadPermissions(Game.SkyrimSpecialEdition, 266)); Assert.Equal(HTMLInterface.PermissionValue.Yes, await HTMLInterface.GetUploadPermissions(Game.SkyrimSpecialEdition, 1137)); Assert.Equal(HTMLInterface.PermissionValue.Hidden, await HTMLInterface.GetUploadPermissions(Game.SkyrimSpecialEdition, 34604)); + Assert.Equal(HTMLInterface.PermissionValue.NotFound, await HTMLInterface.GetUploadPermissions(Game.SkyrimSpecialEdition, 24287)); + } } } diff --git a/Wabbajack/Wabbajack.csproj b/Wabbajack/Wabbajack.csproj index e5524364..e9593240 100644 --- a/Wabbajack/Wabbajack.csproj +++ b/Wabbajack/Wabbajack.csproj @@ -6,8 +6,8 @@ true x64 win10-x64 - 2.2.1.4 - 2.2.1.4 + 2.2.1.5 + 2.2.1.5 Copyright © 2019-2020 An automated ModList installer true