mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #688 from wabbajack-tools/new-nexus-login
Rework the nexus login to no longer use the buggy SSO server.
This commit is contained in:
commit
fa1ad768b8
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
#### Version - Next
|
#### Version - Next
|
||||||
* Included LOOT configs are no longer Base64 encoded
|
* Included LOOT configs are no longer Base64 encoded
|
||||||
|
* Reworked Wabbajack-cli
|
||||||
|
* Can use a MEGA login (if you have it, not required)
|
||||||
|
* Don't use the buggy Nexus SSO server, instead use the in-browser API key generator
|
||||||
|
* Several fixes for zEdit merge integration, handles several side-cases of improper configuration
|
||||||
|
|
||||||
#### Version - 3/30/2020
|
#### Version - 3/30/2020
|
||||||
* Added support for Morrowind on GOG
|
* Added support for Morrowind on GOG
|
||||||
|
@ -100,33 +100,52 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
await Task.Delay(500, cancel);
|
await Task.Delay(500, cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open a web socket to receive the api key
|
|
||||||
var guid = Guid.NewGuid();
|
|
||||||
using (var websocket = new WebSocket("wss://sso.nexusmods.com")
|
|
||||||
{
|
|
||||||
SslConfiguration =
|
|
||||||
{
|
|
||||||
EnabledSslProtocols = SslProtocols.Tls12
|
|
||||||
}
|
|
||||||
})
|
|
||||||
{
|
|
||||||
updateStatus("Please authorize Wabbajack to download Nexus mods");
|
|
||||||
var api_key = new TaskCompletionSource<string>();
|
|
||||||
websocket.OnMessage += (sender, msg) => { api_key.SetResult(msg.Data); };
|
|
||||||
|
|
||||||
websocket.Connect();
|
await browser.NavigateTo(new Uri("https://www.nexusmods.com/users/myaccount?tab=api"));
|
||||||
websocket.Send("{\"id\": \"" + guid + "\", \"appid\": \"" + Consts.AppName + "\"}");
|
|
||||||
await Task.Delay(1000, cancel);
|
|
||||||
|
|
||||||
// open a web browser to get user permission
|
updateStatus("Looking for API Key");
|
||||||
await browser.NavigateTo(new Uri($"https://www.nexusmods.com/sso?id={guid}&application={Consts.AppName}"));
|
|
||||||
using (cancel.Register(() =>
|
|
||||||
|
var apiKey = new TaskCompletionSource<string>();
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var key = "";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
api_key.SetCanceled();
|
key = await browser.EvaluateJavaScript(
|
||||||
}))
|
"document.querySelector(\"input[value=wabbajack]\").parentElement.parentElement.querySelector(\"textarea.application-key\").innerHTML");
|
||||||
{
|
|
||||||
return await api_key.Task;
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await browser.EvaluateJavaScript(
|
||||||
|
"var found = document.querySelector(\"input[value=wabbajack]\").parentElement.parentElement.querySelector(\"form button[type=submit]\");" +
|
||||||
|
"found.onclick= function() {return true;};" +
|
||||||
|
"found.class = \" \"; " +
|
||||||
|
"found.click();" +
|
||||||
|
"found.remove(); found = undefined;"
|
||||||
|
);
|
||||||
|
updateStatus("Generating API Key, Please Wait...");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel.ThrowIfCancellationRequested();
|
||||||
|
await Task.Delay(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user