mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Vector Plexus now uses a native IPS4 REST API and OAuth2
This commit is contained in:
parent
0441bbaf17
commit
ee8669f3ce
@ -108,11 +108,10 @@ namespace Wabbajack.Lib.Downloaders
|
||||
}
|
||||
|
||||
|
||||
public abstract class State : AbstractDownloadState
|
||||
public abstract class State : AbstractDownloadState, IMetaState
|
||||
{
|
||||
public long IPS4Mod { get; set; }
|
||||
public string IPS4File { get; set; } = "";
|
||||
|
||||
public string IPS4Url { get; set; } = "";
|
||||
|
||||
public override object[] PrimaryKey => new object[] {IPS4Mod, IPS4File};
|
||||
@ -160,6 +159,26 @@ namespace Wabbajack.Lib.Downloaders
|
||||
$"ips4File={IPS4File}"
|
||||
};
|
||||
}
|
||||
|
||||
public Uri URL => new(IPS4Url);
|
||||
public string? Name { get; set; }
|
||||
public string? Author { get; set; }
|
||||
public string? Version { get; set; }
|
||||
public Uri? ImageURL { get; set; }
|
||||
public bool IsNSFW { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public async Task<bool> LoadMetaData()
|
||||
{
|
||||
var data = await TypedDownloader.GetDownloads(IPS4Mod);
|
||||
Name = data.Title;
|
||||
Author = data.Author?.Name;
|
||||
Version = data.Version;
|
||||
ImageURL = data.PrimaryScreenshot.Url != null ? new Uri(data.PrimaryScreenshot.Url) : null;
|
||||
IsNSFW = true;
|
||||
Description = "";
|
||||
IPS4Url = data.Url!;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,11 +416,23 @@ namespace Wabbajack.Test
|
||||
|
||||
Assert.True(converted.IsWhitelisted(new ServerWhitelist { AllowedPrefixes = new List<string>() }));
|
||||
|
||||
await converted.Download(new Archive(state: null!) { Name = "Vector Plexus Test.zip" }, filename.Path);
|
||||
var archive = new Archive(state: null!) {Name = "Vector Plexus Test.zip"};
|
||||
await converted.Download(archive, filename.Path);
|
||||
|
||||
Assert.Equal(Hash.FromBase64("eSIyd+KOG3s="), await filename.Path.FileHashAsync());
|
||||
|
||||
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||
Assert.True(converted is VectorPlexusOAuthDownloader.State);
|
||||
|
||||
var st = (VectorPlexusOAuthDownloader.State)converted;
|
||||
Assert.True(await st.LoadMetaData());
|
||||
Assert.Equal("halgari", st.Author);
|
||||
Assert.Equal("Wabbajack Test File", st.Name);
|
||||
Assert.True(st.IsNSFW);
|
||||
Assert.Equal("1.0.0", st.Version);
|
||||
Assert.Equal("https://vectorplexus.com/files/file/290-wabbajack-test-file/", st.GetManifestURL(archive));
|
||||
Assert.True(st.ImageURL != null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user