mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix race condition in IPS4 login
This commit is contained in:
parent
a4d7f1b3a0
commit
943b460d9d
@ -1,5 +1,8 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 2.5.0.7 - 6/30/2021
|
||||
* Make IPS4 downloader threadsafe during logins
|
||||
|
||||
#### Version - 2.5.0.6 - 6/29/2021
|
||||
* Add Logging for IPS4 scheme handler should help with debugging login issues
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<AssemblyName>wabbajack-cli</AssemblyName>
|
||||
<Company>Wabbajack</Company>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyVersion>2.5.0.6</AssemblyVersion>
|
||||
<FileVersion>2.5.0.6</FileVersion>
|
||||
<AssemblyVersion>2.5.0.7</AssemblyVersion>
|
||||
<FileVersion>2.5.0.7</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</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.0.6</AssemblyVersion>
|
||||
<FileVersion>2.5.0.6</FileVersion>
|
||||
<AssemblyVersion>2.5.0.7</AssemblyVersion>
|
||||
<FileVersion>2.5.0.7</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Application Launcher</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -57,6 +57,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public virtual Uri? IconUri { get; }
|
||||
public Client? AuthedClient { get; set; }
|
||||
|
||||
private AsyncLock _prepareLock = new();
|
||||
|
||||
private bool _isPrepared = false;
|
||||
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode = false)
|
||||
{
|
||||
@ -118,7 +120,6 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public async Task Prepare()
|
||||
{
|
||||
|
||||
if (_isPrepared) return;
|
||||
AuthedClient = (await GetAuthedClient()) ?? throw new Exception($"Not logged into {SiteName}");
|
||||
_isPrepared = true;
|
||||
@ -127,6 +128,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
private async Task<Http.Client?> GetAuthedClient()
|
||||
{
|
||||
using var _ = await _prepareLock.WaitAsync();
|
||||
if (!Utils.HaveEncryptedJson(EncryptedKeyName))
|
||||
{
|
||||
await Utils.CatchAndLog(async () => await Utils.Log(new RequestOAuthLogin(ClientID,
|
||||
|
@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<AssemblyVersion>2.5.0.6</AssemblyVersion>
|
||||
<FileVersion>2.5.0.6</FileVersion>
|
||||
<AssemblyVersion>2.5.0.7</AssemblyVersion>
|
||||
<FileVersion>2.5.0.7</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Server</Description>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
@ -24,6 +24,7 @@ namespace Wabbajack
|
||||
public class UserInterventionHandlers
|
||||
{
|
||||
public MainWindowVM MainWindow { get; }
|
||||
private AsyncLock _browserLock = new();
|
||||
|
||||
public UserInterventionHandlers(MainWindowVM mvm)
|
||||
{
|
||||
@ -32,6 +33,7 @@ namespace Wabbajack
|
||||
|
||||
private async Task WrapBrowserJob(IUserIntervention intervention, Func<WebBrowserVM, CancellationTokenSource, Task> toDo)
|
||||
{
|
||||
var wait = await _browserLock.WaitAsync();
|
||||
var cancel = new CancellationTokenSource();
|
||||
var oldPane = MainWindow.ActivePane;
|
||||
using var vm = await WebBrowserVM.GetNew();
|
||||
@ -56,6 +58,10 @@ namespace Wabbajack
|
||||
Utils.Error(ex);
|
||||
intervention.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
wait.Dispose();
|
||||
}
|
||||
|
||||
MainWindow.NavigateTo(oldPane);
|
||||
}
|
||||
@ -120,8 +126,8 @@ namespace Wabbajack
|
||||
var oldHandler = Helpers.SchemeHandler;
|
||||
Helpers.SchemeHandler = (browser, frame, _, request) =>
|
||||
{
|
||||
Helpers.SchemeHandler = oldHandler;
|
||||
var req = new Uri(request.Url);
|
||||
Utils.LogStraightToFile($"Got Scheme callback {req}");
|
||||
var parsed = HttpUtility.ParseQueryString(req.Query);
|
||||
if (parsed.Contains("state"))
|
||||
{
|
||||
@ -134,6 +140,7 @@ namespace Wabbajack
|
||||
}
|
||||
if (parsed.Contains("code"))
|
||||
{
|
||||
Helpers.SchemeHandler = oldHandler;
|
||||
oa.Resume(parsed.Get("code"));
|
||||
}
|
||||
else
|
||||
|
@ -6,8 +6,8 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<AssemblyVersion>2.5.0.6</AssemblyVersion>
|
||||
<FileVersion>2.5.0.6</FileVersion>
|
||||
<AssemblyVersion>2.5.0.7</AssemblyVersion>
|
||||
<FileVersion>2.5.0.7</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
Loading…
Reference in New Issue
Block a user