mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Bump version
This commit is contained in:
parent
237487eac3
commit
076b060afd
@ -1,6 +1,6 @@
|
|||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
#### Version - 0.9.21.1 - 2/24/2020
|
#### Version - 0.9.21.1 - 2/25/2020
|
||||||
* Fix NaN error during installation
|
* Fix NaN error during installation
|
||||||
|
|
||||||
#### Version - 0.9.22.0 - 2/24/2020
|
#### Version - 0.9.22.0 - 2/24/2020
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@ -11,7 +12,7 @@ namespace Wabbajack.Common.Http
|
|||||||
{
|
{
|
||||||
public List<(string, string)> Headers = new List<(string, string)>();
|
public List<(string, string)> Headers = new List<(string, string)>();
|
||||||
public List<Cookie> Cookies = new List<Cookie>();
|
public List<Cookie> Cookies = new List<Cookie>();
|
||||||
public async Task<HttpResponseMessage> GetAsync(string url, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseContentRead)
|
public async Task<HttpResponseMessage> GetAsync(string url, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
||||||
{
|
{
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
||||||
foreach (var (k, v) in Headers)
|
foreach (var (k, v) in Headers)
|
||||||
@ -19,6 +20,23 @@ namespace Wabbajack.Common.Http
|
|||||||
return await SendAsync(request, responseHeadersRead);
|
return await SendAsync(request, responseHeadersRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<HttpResponseMessage> PostAsync(string url, HttpContent content, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Post, url) {Content = content};
|
||||||
|
foreach (var (k, v) in Headers)
|
||||||
|
request.Headers.Add(k, v);
|
||||||
|
return await SendAsync(request, responseHeadersRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<HttpResponseMessage> PutAsync(string url, HttpContent content, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Put, url) {Content = content};
|
||||||
|
foreach (var (k, v) in Headers)
|
||||||
|
request.Headers.Add(k, v);
|
||||||
|
return await SendAsync(request, responseHeadersRead);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<string> GetStringAsync(string url)
|
public async Task<string> GetStringAsync(string url)
|
||||||
{
|
{
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
||||||
@ -29,15 +47,32 @@ namespace Wabbajack.Common.Http
|
|||||||
|
|
||||||
return await SendStringAsync(request);
|
return await SendStringAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Stream> GetStreamAsync(string url)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
||||||
|
foreach (var (k, v) in Headers)
|
||||||
|
request.Headers.Add(k, v);
|
||||||
|
if (Cookies.Count > 0)
|
||||||
|
Cookies.ForEach(c => ClientFactory.Cookies.Add(c));
|
||||||
|
|
||||||
|
return await SendStreamAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<string> SendStringAsync(HttpRequestMessage request)
|
private async Task<string> SendStringAsync(HttpRequestMessage request)
|
||||||
{
|
{
|
||||||
var result = await SendAsync(request);
|
var result = await SendAsync(request);
|
||||||
return await result.Content.ReadAsStringAsync();
|
return await result.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<Stream> SendStreamAsync(HttpRequestMessage request)
|
||||||
|
{
|
||||||
|
var result = await SendAsync(request);
|
||||||
|
return await result.Content.ReadAsStreamAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage msg, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseContentRead)
|
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage msg, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead)
|
||||||
{
|
{
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
TOP:
|
TOP:
|
||||||
|
@ -196,35 +196,34 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<(HttpClient, CDPTree, CollectedBNetInfo)> ResolveDownloadInfo()
|
private async Task<(Common.Http.Client, CDPTree, CollectedBNetInfo)> ResolveDownloadInfo()
|
||||||
{
|
{
|
||||||
var info = new CollectedBNetInfo();
|
var info = new CollectedBNetInfo();
|
||||||
|
|
||||||
var login_info = Utils.FromEncryptedJson<BethesdaNetData>(DataName);
|
var login_info = Utils.FromEncryptedJson<BethesdaNetData>(DataName);
|
||||||
|
|
||||||
var client = new HttpClient();
|
var client = new Common.Http.Client();
|
||||||
|
|
||||||
client.BaseAddress = new Uri("https://api.bethesda.net");
|
client.Headers.Add(("User-Agent", "bnet"));
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", "bnet");
|
|
||||||
foreach (var header in login_info.headers.Where(h => h.Key.ToLower().StartsWith("x-")))
|
foreach (var header in login_info.headers.Where(h => h.Key.ToLower().StartsWith("x-")))
|
||||||
client.DefaultRequestHeaders.Add(header.Key, header.Value);
|
client.Headers.Add((header.Key, header.Value));
|
||||||
|
|
||||||
var posted = await client.PostAsync("/beam/accounts/external_login",
|
var posted = await client.PostAsync("https://api.bethesda.net/beam/accounts/external_login",
|
||||||
new StringContent(login_info.body, Encoding.UTF8, "application/json"));
|
new StringContent(login_info.body, Encoding.UTF8, "application/json"));
|
||||||
|
|
||||||
info.AccessToken = (await posted.Content.ReadAsStringAsync()).FromJSONString<BeamLoginResponse>().access_token;
|
info.AccessToken = (await posted.Content.ReadAsStringAsync()).FromJSONString<BeamLoginResponse>().access_token;
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Add("x-cdp-app", "UGC SDK");
|
client.Headers.Add(("x-cdp-app", "UGC SDK"));
|
||||||
client.DefaultRequestHeaders.Add("x-cdp-app-ver", "0.9.11314/debug");
|
client.Headers.Add(("x-cdp-app-ver", "0.9.11314/debug"));
|
||||||
client.DefaultRequestHeaders.Add("x-cdp-lib-ver", "0.9.11314/debug");
|
client.Headers.Add(("x-cdp-lib-ver", "0.9.11314/debug"));
|
||||||
client.DefaultRequestHeaders.Add("x-cdp-platform","Win/32");
|
client.Headers.Add(("x-cdp-platform","Win/32"));
|
||||||
|
|
||||||
posted = await client.PostAsync("cdp-user/auth",
|
posted = await client.PostAsync("https://api.bethesda.net/cdp-user/auth",
|
||||||
new StringContent("{\"access_token\": \"" + info.AccessToken + "\"}", Encoding.UTF8,
|
new StringContent("{\"access_token\": \"" + info.AccessToken + "\"}", Encoding.UTF8,
|
||||||
"application/json"));
|
"application/json"));
|
||||||
info.CDPToken = (await posted.Content.ReadAsStringAsync()).FromJSONString<CDPLoginResponse>().token;
|
info.CDPToken = (await posted.Content.ReadAsStringAsync()).FromJSONString<CDPLoginResponse>().token;
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Add("X-Access-Token", info.AccessToken);
|
client.Headers.Add(("X-Access-Token", info.AccessToken));
|
||||||
var got = await client.GetAsync($"mods/ugc-workshop/content/get?content_id={ContentId}");
|
var got = await client.GetAsync($"mods/ugc-workshop/content/get?content_id={ContentId}");
|
||||||
JObject data = JObject.Parse(await got.Content.ReadAsStringAsync());
|
JObject data = JObject.Parse(await got.Content.ReadAsStringAsync());
|
||||||
|
|
||||||
@ -233,15 +232,15 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
info.CDPBranchId = (int)content["cdp_branch_id"];
|
info.CDPBranchId = (int)content["cdp_branch_id"];
|
||||||
info.CDPProductId = (int)content["cdp_product_id"];
|
info.CDPProductId = (int)content["cdp_product_id"];
|
||||||
|
|
||||||
client.DefaultRequestHeaders.Add("Authorization", $"Token {info.CDPToken}");
|
client.Headers.Add(("Authorization", $"Token {info.CDPToken}"));
|
||||||
client.DefaultRequestHeaders.Add("Accept", "application/json");
|
client.Headers.Add(("Accept", "application/json"));
|
||||||
|
|
||||||
got = await client.GetAsync(
|
got = await client.GetAsync(
|
||||||
$"/cdp-user/projects/{info.CDPProductId}/branches/{info.CDPBranchId}/tree/.json");
|
$"/cdp-user/projects/{info.CDPProductId}/branches/{info.CDPBranchId}/tree/.json");
|
||||||
|
|
||||||
var tree = (await got.Content.ReadAsStringAsync()).FromJSONString<CDPTree>();
|
var tree = (await got.Content.ReadAsStringAsync()).FromJSONString<CDPTree>();
|
||||||
|
|
||||||
got = await client.PostAsync($"/mods/ugc-content/add-subscription", new StringContent($"{{\"content_id\": \"{ContentId}\"}}", Encoding.UTF8, "application/json"));
|
got = await client.PostAsync($"https://api.bethesda.net/mods/ugc-content/add-subscription", new StringContent($"{{\"content_id\": \"{ContentId}\"}}", Encoding.UTF8, "application/json"));
|
||||||
|
|
||||||
got = await client.GetAsync(
|
got = await client.GetAsync(
|
||||||
$"/cdp-user/projects/{info.CDPProductId}/branches/{info.CDPBranchId}/depots/.json");
|
$"/cdp-user/projects/{info.CDPProductId}/branches/{info.CDPBranchId}/depots/.json");
|
||||||
|
@ -119,11 +119,10 @@ namespace Wabbajack.Lib.FileUploader
|
|||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpClient GetAuthorizedClient()
|
public static Common.Http.Client GetAuthorizedClient()
|
||||||
{
|
{
|
||||||
var handler = new HttpClientHandler {MaxConnectionsPerServer = Consts.MaxConnectionsPerServer};
|
var client = new Common.Http.Client();
|
||||||
var client = new HttpClient(handler);
|
client.Headers.Add(("X-API-KEY", GetAPIKey()));
|
||||||
client.DefaultRequestHeaders.Add("X-API-KEY", AuthorAPI.GetAPIKey());
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ namespace Wabbajack.Lib
|
|||||||
await to_find.PMap(Queue, async f =>
|
await to_find.PMap(Queue, async f =>
|
||||||
{
|
{
|
||||||
var vf = VFS.Index.ByFullPath[f];
|
var vf = VFS.Index.ByFullPath[f];
|
||||||
var client = new HttpClient();
|
var client = new Common.Http.Client();
|
||||||
var response =
|
var response =
|
||||||
await client.GetAsync(
|
await client.GetAsync(
|
||||||
$"http://build.wabbajack.org/indexed_files/{vf.Hash.FromBase64().ToHex()}/meta.ini");
|
$"http://build.wabbajack.org/indexed_files/{vf.Hash.FromBase64().ToHex()}/meta.ini");
|
||||||
|
@ -62,7 +62,7 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
|
|
||||||
public static async Task<List<ModlistMetadata>> LoadFromGithub()
|
public static async Task<List<ModlistMetadata>> LoadFromGithub()
|
||||||
{
|
{
|
||||||
var client = new HttpClient();
|
var client = new Common.Http.Client();
|
||||||
Utils.Log("Loading ModLists from GitHub");
|
Utils.Log("Loading ModLists from GitHub");
|
||||||
var metadataResult = client.GetStringAsync(Consts.ModlistMetadataURL);
|
var metadataResult = client.GetStringAsync(Consts.ModlistMetadataURL);
|
||||||
var summaryResult = client.GetStringAsync(Consts.ModlistSummaryURL);
|
var summaryResult = client.GetStringAsync(Consts.ModlistSummaryURL);
|
||||||
|
@ -38,7 +38,7 @@ namespace Wabbajack.Lib.Validation
|
|||||||
|
|
||||||
public async Task LoadListsFromGithub()
|
public async Task LoadListsFromGithub()
|
||||||
{
|
{
|
||||||
var client = new HttpClient();
|
var client = new Common.Http.Client();
|
||||||
Utils.Log("Loading Nexus mod permissions");
|
Utils.Log("Loading Nexus mod permissions");
|
||||||
using (var result = await client.GetStreamAsync(Consts.ModPermissionsURL))
|
using (var result = await client.GetStreamAsync(Consts.ModPermissionsURL))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user