mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
merge and fix changes to http client code
This commit is contained in:
parent
bec10fdea1
commit
1b79a64542
@ -13,6 +13,8 @@
|
||||
* Rework UI to support a slideshow of used mods during installation and compilation
|
||||
* Remove support for extracting `.exe` installers
|
||||
* Added support for `.omod` files
|
||||
* Stop emitting `.exe` modlist installers
|
||||
* Reworked Nexus HTTP API - Thanks Cyclonit
|
||||
|
||||
#### Version 0.9.2 - 9/18/2013
|
||||
* Fixed a bug with BSA string encoding
|
||||
|
@ -493,7 +493,7 @@ namespace Wabbajack
|
||||
ModID = general.modID,
|
||||
Version = general.version ?? "0.0.0.0"
|
||||
};
|
||||
var info = _nexusApiClient.GetModInfo(nm);
|
||||
var info = NexusApiClient.GetModInfo(nm);
|
||||
nm.Author = info.author;
|
||||
nm.UploadedBy = info.uploaded_by;
|
||||
nm.UploaderProfile = info.uploaded_users_profile_url;
|
||||
@ -528,7 +528,8 @@ namespace Wabbajack
|
||||
Info($"Checking link for {found.Name}");
|
||||
|
||||
var installer = new Installer(null, "");
|
||||
installer.NexusAPIKey = NexusKey;
|
||||
installer.NexusClient = NexusApiClient;
|
||||
|
||||
if (!installer.DownloadArchive(result, false))
|
||||
Error(
|
||||
$"Unable to resolve link for {found.Name}. If this is hosted on the Nexus the file may have been removed.");
|
||||
|
@ -25,8 +25,20 @@ namespace Wabbajack
|
||||
public class Installer
|
||||
{
|
||||
private string _downloadsFolder;
|
||||
private NexusApiClient _nexusClient;
|
||||
|
||||
private NexusApiClient _nexusApiClient;
|
||||
public NexusApiClient NexusClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_nexusClient == null)
|
||||
_nexusClient = new NexusApiClient();
|
||||
return _nexusClient;
|
||||
}
|
||||
set => _nexusClient = value;
|
||||
}
|
||||
|
||||
public string NexusAPIKey { get; set; }
|
||||
|
||||
public Installer(ModList mod_list, string output_folder)
|
||||
{
|
||||
@ -161,7 +173,7 @@ namespace Wabbajack
|
||||
|
||||
mods.PMap(mod =>
|
||||
{
|
||||
var er = _nexusApiClient.EndorseMod(mod);
|
||||
var er = NexusClient.EndorseMod(mod);
|
||||
Utils.Log($"Endorsed {mod.GameName} - {mod.ModID} - Result: {er.message}");
|
||||
});
|
||||
Info("Done! You may now exit the application!");
|
||||
@ -404,19 +416,19 @@ namespace Wabbajack
|
||||
Info("Getting Nexus API Key, if a browser appears, please accept");
|
||||
if (ModList.Archives.OfType<NexusMod>().Any())
|
||||
{
|
||||
_nexusApiClient = new NexusApiClient();
|
||||
NexusClient = new NexusApiClient();
|
||||
|
||||
if (!_nexusApiClient.IsAuthenticated)
|
||||
if (!NexusClient.IsAuthenticated)
|
||||
{
|
||||
Error(
|
||||
$"Authenticating for the Nexus failed. A nexus account is required to automatically download mods.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_nexusApiClient.IsPremium)
|
||||
if (!NexusClient.IsPremium)
|
||||
{
|
||||
Error(
|
||||
$"Automated installs with Wabbajack requires a premium nexus account. {_nexusApiClient.Username} is not a premium account.");
|
||||
$"Automated installs with Wabbajack requires a premium nexus account. {NexusClient.Username} is not a premium account.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -449,7 +461,7 @@ namespace Wabbajack
|
||||
string url;
|
||||
try
|
||||
{
|
||||
url = _nexusApiClient.GetNexusDownloadLink(a, !download);
|
||||
url = NexusClient.GetNexusDownloadLink(a, !download);
|
||||
if (!download) return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -16,7 +16,7 @@ using WebSocketSharp;
|
||||
|
||||
namespace Wabbajack.NexusApi
|
||||
{
|
||||
internal class NexusApiClient : INotifyPropertyChanged
|
||||
public class NexusApiClient : INotifyPropertyChanged
|
||||
{
|
||||
private static readonly string API_KEY_CACHE_FILE = "nexus.key_cache";
|
||||
|
||||
@ -121,10 +121,10 @@ namespace Wabbajack.NexusApi
|
||||
{
|
||||
_dailyRemaining = Math.Min(dailyRemaining, hourlyRemaining);
|
||||
_hourlyRemaining = Math.Min(dailyRemaining, hourlyRemaining);
|
||||
|
||||
OnPropertyChanged(nameof(DailyRemaining));
|
||||
OnPropertyChanged(nameof(HourlyRemaining));
|
||||
}
|
||||
OnPropertyChanged(nameof(DailyRemaining));
|
||||
OnPropertyChanged(nameof(HourlyRemaining));
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user