mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
2.5.3.6
This commit is contained in:
parent
a84394ad6b
commit
591673c46b
@ -1,5 +1,9 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 2.5.3.6 - 2/1/2022
|
||||
* Implemented new (more reliable) code for back porting to Skyrim SE
|
||||
* Mega links that use `manualURL=` now work properly with the manual downloader
|
||||
|
||||
#### Version - 2.5.3.5 - 1/19/2022
|
||||
* Fixed support for Cyberpunk 2077 on GoG
|
||||
* Added support for Sims 4
|
||||
|
@ -6,8 +6,8 @@
|
||||
<AssemblyName>wabbajack-cli</AssemblyName>
|
||||
<Company>Wabbajack</Company>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyVersion>2.5.3.5</AssemblyVersion>
|
||||
<FileVersion>2.5.3.5</FileVersion>
|
||||
<AssemblyVersion>2.5.3.6</AssemblyVersion>
|
||||
<FileVersion>2.5.3.6</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -4,8 +4,8 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyVersion>2.5.3.5</AssemblyVersion>
|
||||
<FileVersion>2.5.3.5</FileVersion>
|
||||
<AssemblyVersion>2.5.3.6</AssemblyVersion>
|
||||
<FileVersion>2.5.3.6</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Application Launcher</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -453,6 +453,9 @@ namespace Wabbajack.Lib.Downloaders
|
||||
if (!Downloader.IsCloudFlareProtected)
|
||||
return await Downloader.AuthedClient.GetAsync(uri);
|
||||
|
||||
throw new NotImplementedException();
|
||||
|
||||
/*
|
||||
using var driver = await Downloader.GetAuthedDriver();
|
||||
TaskCompletionSource<Uri?> promise = new();
|
||||
driver.DownloadHandler = uri1 =>
|
||||
@ -465,6 +468,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
if (url == null) throw new Exception("No Url to download");
|
||||
var location = await driver.GetLocation();
|
||||
return await Helpers.GetClient(await Helpers.GetCookies(), location!.ToString()).GetAsync(uri);
|
||||
*/
|
||||
}
|
||||
|
||||
public override string[] GetMetaIni()
|
||||
|
@ -48,6 +48,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public override async Task<bool> Download(Archive a, AbsolutePath destination)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
/*
|
||||
using var driver = await WebAutomation.Driver.Create();
|
||||
var tcs = new TaskCompletionSource<Uri?>();
|
||||
driver.DownloadHandler = uri => tcs.SetResult(uri);
|
||||
@ -55,6 +57,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
await driver.EvalJavascript("document.getElementsByClassName(\"download-button\")[0].click();");
|
||||
var uri = await tcs.Task;
|
||||
return await new HTTPDownloader.State(uri!.ToString()).Download(destination);
|
||||
*/
|
||||
}
|
||||
|
||||
public override async Task<bool> Verify(Archive archive, CancellationToken? token)
|
||||
|
@ -22,7 +22,7 @@ namespace Wabbajack.Lib.NexusApi
|
||||
/// <summary>
|
||||
/// Forces the client to do manual downloading via CEF (for testing)
|
||||
/// </summary>
|
||||
private static bool ManualTestingMode = false;
|
||||
private static bool ManualTestingMode = true;
|
||||
|
||||
public Http.Client HttpClient { get; } = new();
|
||||
|
||||
|
@ -18,12 +18,10 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
public class CefSharpWrapper : IWebDriver
|
||||
{
|
||||
private readonly IWebBrowser _browser;
|
||||
public Action<Uri>? DownloadHandler { get; set; }
|
||||
public CefSharpWrapper(IWebBrowser browser)
|
||||
{
|
||||
_browser = browser;
|
||||
|
||||
_browser.DownloadHandler = new DownloadHandler(this);
|
||||
_browser.LifeSpanHandler = new PopupBlocker(this);
|
||||
}
|
||||
|
||||
@ -217,26 +215,4 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
callback.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
public class DownloadHandler : IDownloadHandler
|
||||
{
|
||||
private CefSharpWrapper _wrapper;
|
||||
|
||||
public DownloadHandler(CefSharpWrapper wrapper)
|
||||
{
|
||||
_wrapper = wrapper;
|
||||
}
|
||||
|
||||
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
IBeforeDownloadCallback callback)
|
||||
{
|
||||
_wrapper.DownloadHandler?.Invoke(new Uri(downloadItem.Url));
|
||||
}
|
||||
|
||||
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
IDownloadItemCallback callback)
|
||||
{
|
||||
callback.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,5 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
Task NavigateTo(Uri uri, CancellationToken? token = null);
|
||||
Task<string> EvaluateJavaScript(string text);
|
||||
Task<Helpers.Cookie[]> GetCookies(string domainPrefix);
|
||||
public Action<Uri>? DownloadHandler { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +93,6 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
return doc;
|
||||
}
|
||||
|
||||
public Action<Uri?> DownloadHandler {
|
||||
set => _driver.DownloadHandler = value;
|
||||
}
|
||||
|
||||
public Task<string> GetAttr(string selector, string attr)
|
||||
{
|
||||
return _driver.EvaluateJavaScript($"document.querySelector(\"{selector}\").{attr}");
|
||||
|
@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<AssemblyVersion>2.5.3.5</AssemblyVersion>
|
||||
<FileVersion>2.5.3.5</FileVersion>
|
||||
<AssemblyVersion>2.5.3.6</AssemblyVersion>
|
||||
<FileVersion>2.5.3.6</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>Wabbajack Server</Description>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
@ -33,7 +33,7 @@ namespace Wabbajack
|
||||
|
||||
private async Task WrapBrowserJob(IUserIntervention intervention, Func<WebBrowserVM, CancellationTokenSource, Task> toDo)
|
||||
{
|
||||
var wait = await _browserLock.WaitAsync();
|
||||
using var wait = await _browserLock.WaitAsync();
|
||||
var cancel = new CancellationTokenSource();
|
||||
var oldPane = MainWindow.ActivePane;
|
||||
using var vm = await WebBrowserVM.GetNew();
|
||||
@ -58,10 +58,6 @@ namespace Wabbajack
|
||||
Utils.Error(ex);
|
||||
intervention.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
wait.Dispose();
|
||||
}
|
||||
|
||||
MainWindow.NavigateTo(oldPane);
|
||||
}
|
||||
@ -166,13 +162,9 @@ namespace Wabbajack
|
||||
|
||||
var result = new TaskCompletionSource<Uri>();
|
||||
|
||||
browser.DownloadHandler = uri =>
|
||||
{
|
||||
//var client = Helpers.GetClient(browser.GetCookies("").Result, browser.Location);
|
||||
result.SetResult(uri);
|
||||
};
|
||||
|
||||
|
||||
await vm.Driver.WaitForInitialized();
|
||||
using var _ = browser.SetDownloadHandler(new ManualDownloadHandler(result));
|
||||
|
||||
await browser.NavigateTo(new Uri(manuallyDownloadFile.State.Url));
|
||||
|
||||
@ -190,7 +182,30 @@ namespace Wabbajack
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ManualDownloadHandler : IDownloadHandler
|
||||
{
|
||||
private readonly TaskCompletionSource<Uri> _tcs;
|
||||
|
||||
public ManualDownloadHandler(TaskCompletionSource<Uri> tcs)
|
||||
{
|
||||
_tcs = tcs;
|
||||
}
|
||||
|
||||
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
IBeforeDownloadCallback callback)
|
||||
{
|
||||
_tcs.TrySetResult(new Uri(downloadItem.Url));
|
||||
}
|
||||
|
||||
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
IDownloadItemCallback callback)
|
||||
{
|
||||
callback.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task HandleManualMegaDownload(WebBrowserVM vm, CancellationTokenSource cancel, ManuallyDownloadMegaFile manuallyDownloadFile)
|
||||
{
|
||||
var browser = new CefSharpWrapper(vm.Browser);
|
||||
@ -224,7 +239,7 @@ namespace Wabbajack
|
||||
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
IBeforeDownloadCallback callback)
|
||||
{
|
||||
callback.Continue(_manualFile.ToString(), false);
|
||||
callback.Continue(_manualFile.Destination.ToString(), false);
|
||||
}
|
||||
|
||||
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
|
||||
@ -235,7 +250,7 @@ namespace Wabbajack
|
||||
_tcs.TrySetResult();
|
||||
}
|
||||
callback.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleManualNexusDownload(WebBrowserVM vm, CancellationTokenSource cancel, ManuallyDownloadNexusFile manuallyDownloadNexusFile)
|
||||
@ -243,19 +258,27 @@ namespace Wabbajack
|
||||
var state = manuallyDownloadNexusFile.State;
|
||||
var game = state.Game.MetaData();
|
||||
await vm.Driver.WaitForInitialized();
|
||||
IWebDriver browser = new CefSharpWrapper(vm.Browser);
|
||||
vm.Instructions = $"Click the download button to continue (get a NexusMods.com Premium account to automate this)";
|
||||
browser.DownloadHandler = uri =>
|
||||
{
|
||||
manuallyDownloadNexusFile.Resume(uri);
|
||||
browser.DownloadHandler = null;
|
||||
};
|
||||
var browser = new CefSharpWrapper(vm.Browser);
|
||||
var tcs = new TaskCompletionSource<Uri>();
|
||||
using var _ = browser.SetDownloadHandler(new ManualDownloadHandler(tcs));
|
||||
|
||||
var url = new Uri(@$"https://www.nexusmods.com/{game.NexusName}/mods/{state.ModID}?tab=files&file_id={state.FileID}");
|
||||
await browser.NavigateTo(url);
|
||||
|
||||
while (!cancel.IsCancellationRequested && !manuallyDownloadNexusFile.Task.IsCompleted) {
|
||||
while (!cancel.IsCancellationRequested && !tcs.Task.IsCompleted) {
|
||||
await Task.Delay(250);
|
||||
}
|
||||
|
||||
if (tcs.Task.IsFaulted)
|
||||
{
|
||||
manuallyDownloadNexusFile.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
var uri = await tcs.Task;
|
||||
manuallyDownloadNexusFile.Resume(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<AssemblyVersion>2.5.3.5</AssemblyVersion>
|
||||
<FileVersion>2.5.3.5</FileVersion>
|
||||
<AssemblyVersion>2.5.3.6</AssemblyVersion>
|
||||
<FileVersion>2.5.3.6</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
Loading…
Reference in New Issue
Block a user