mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Full path of files should now work
This commit is contained in:
@ -14,6 +14,8 @@ using Org.BouncyCastle.Asn1.Cms;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.CompilationSteps;
|
using Wabbajack.Lib.CompilationSteps;
|
||||||
using Wabbajack.Lib.Downloaders;
|
using Wabbajack.Lib.Downloaders;
|
||||||
|
using Wabbajack.Lib.FileUploader;
|
||||||
|
using Wabbajack.Lib.GitHub;
|
||||||
using Wabbajack.Lib.ModListRegistry;
|
using Wabbajack.Lib.ModListRegistry;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
|
|
||||||
@ -34,9 +36,10 @@ namespace Wabbajack.Lib
|
|||||||
public string? ModListName, ModListAuthor, ModListDescription, ModListWebsite, ModlistReadme;
|
public string? ModListName, ModListAuthor, ModListDescription, ModListWebsite, ModlistReadme;
|
||||||
public Version? ModlistVersion;
|
public Version? ModlistVersion;
|
||||||
protected Version? WabbajackVersion;
|
protected Version? WabbajackVersion;
|
||||||
|
public UpdateRequest? PublishData;
|
||||||
|
|
||||||
public ACompiler(int steps, string modlistName, AbsolutePath sourcePath, AbsolutePath downloadsPath,
|
public ACompiler(int steps, string modlistName, AbsolutePath sourcePath, AbsolutePath downloadsPath,
|
||||||
AbsolutePath outputModListName)
|
AbsolutePath outputModListName, UpdateRequest? publishData)
|
||||||
: base(steps)
|
: base(steps)
|
||||||
{
|
{
|
||||||
SourcePath = sourcePath;
|
SourcePath = sourcePath;
|
||||||
@ -48,8 +51,11 @@ namespace Wabbajack.Lib
|
|||||||
Settings = new CompilerSettings();
|
Settings = new CompilerSettings();
|
||||||
ModListOutputFolder = AbsolutePath.EntryPoint.Combine("output_folder", Guid.NewGuid().ToString());
|
ModListOutputFolder = AbsolutePath.EntryPoint.Combine("output_folder", Guid.NewGuid().ToString());
|
||||||
CompilingGame = new GameMetaData();
|
CompilingGame = new GameMetaData();
|
||||||
|
PublishData = publishData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true to include game files during compilation, only ever disabled
|
/// Set to true to include game files during compilation, only ever disabled
|
||||||
/// in testing (to speed up tests)
|
/// in testing (to speed up tests)
|
||||||
@ -171,6 +177,35 @@ namespace Wabbajack.Lib
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task PreflightChecks()
|
||||||
|
{
|
||||||
|
Utils.Log($"Running preflight checks");
|
||||||
|
if (PublishData == null) return;
|
||||||
|
|
||||||
|
var ourLists = await (await AuthorApi.Client.Create()).GetMyModlists();
|
||||||
|
if (ourLists.All(l => l.MachineURL != PublishData.MachineUrl))
|
||||||
|
{
|
||||||
|
Utils.ErrorThrow(new CriticalFailureIntervention(
|
||||||
|
$"Cannot publish to {PublishData.MachineUrl}, you are not listed as a maintainer",
|
||||||
|
"Cannot publish"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task PublishModlist()
|
||||||
|
{
|
||||||
|
if (PublishData == null) return;
|
||||||
|
var api = await AuthorApi.Client.Create();
|
||||||
|
Utils.Log($"Uploading modlist {PublishData!.MachineUrl}");
|
||||||
|
|
||||||
|
var metadata = ((AbsolutePath)(ModListOutputFile + ".meta.json")).FromJson<DownloadMetadata>();
|
||||||
|
var uri = await api.UploadFile(Queue, ModListOutputFile, (s, percent) => Utils.Status(s, percent));
|
||||||
|
PublishData.DownloadUrl = uri;
|
||||||
|
PublishData.DownloadMetadata = metadata;
|
||||||
|
|
||||||
|
Utils.Log($"Publishing modlist {PublishData!.MachineUrl}");
|
||||||
|
await api.UpdateModListInformation(PublishData);
|
||||||
|
}
|
||||||
|
|
||||||
protected async Task IndexGameFileHashes()
|
protected async Task IndexGameFileHashes()
|
||||||
{
|
{
|
||||||
if (UseGamePaths)
|
if (UseGamePaths)
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.Lib.GitHub;
|
||||||
using Wabbajack.Lib.ModListRegistry;
|
using Wabbajack.Lib.ModListRegistry;
|
||||||
|
|
||||||
namespace Wabbajack.Lib.AuthorApi
|
namespace Wabbajack.Lib.AuthorApi
|
||||||
@ -77,12 +78,12 @@ namespace Wabbajack.Lib.AuthorApi
|
|||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateModListInformation(string machineUrl, DownloadMetadata metadata)
|
public async Task UpdateModListInformation(UpdateRequest metadata)
|
||||||
{
|
{
|
||||||
await CircuitBreaker.WithAutoRetryAllAsync(async () =>
|
await CircuitBreaker.WithAutoRetryAllAsync(async () =>
|
||||||
{
|
{
|
||||||
Utils.Log($"Updating modlist information for {machineUrl} - {metadata.Version}");
|
Utils.Log($"Updating modlist information for {metadata.MachineUrl} - {metadata.Version}");
|
||||||
using var result = await _client.PostAsync($"{Consts.WabbajackBuildServerUri}author_controls/{machineUrl}/download_metadata",
|
using var result = await _client.PostAsync($"{Consts.WabbajackBuildServerUri}author_controls/lists/download_metadata",
|
||||||
new StringContent(metadata.ToJson()));
|
new StringContent(metadata.ToJson()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,18 +56,19 @@ namespace Wabbajack.Lib.GitHub
|
|||||||
await _client.Repository.Content.UpdateFile("wabbajack-tools", "mod-lists", PathNames[file], updateRequest);
|
await _client.Repository.Content.UpdateFile("wabbajack-tools", "mod-lists", PathNames[file], updateRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateList(string maintainer, string machineUrl, DownloadMetadata newData)
|
public async Task UpdateList(string maintainer, UpdateRequest newData)
|
||||||
{
|
{
|
||||||
foreach (var file in Enum.GetValues<List>())
|
foreach (var file in Enum.GetValues<List>())
|
||||||
{
|
{
|
||||||
var data = await GetData(file);
|
var data = await GetData(file);
|
||||||
var found = data.Lists.FirstOrDefault(l => l.Links.MachineURL == machineUrl && l.Maintainers.Contains(maintainer));
|
var found = data.Lists.FirstOrDefault(l => l.Links.MachineURL == newData.MachineUrl && l.Maintainers.Contains(maintainer));
|
||||||
if (found == null) continue;
|
if (found == null) continue;
|
||||||
|
|
||||||
found.DownloadMetadata = newData;
|
found.DownloadMetadata = newData.DownloadMetadata;
|
||||||
found.Version = newData.Version;
|
found.Version = newData.Version;
|
||||||
|
found.Links.Download = newData.DownloadUrl.ToString();
|
||||||
|
|
||||||
await WriteData(file, machineUrl, data.Hash, data.Lists);
|
await WriteData(file, newData.MachineUrl, data.Hash, data.Lists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
Wabbajack.Lib/GitHub/UpdateRequest.cs
Normal file
15
Wabbajack.Lib/GitHub/UpdateRequest.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using Wabbajack.Common.Serialization.Json;
|
||||||
|
using Wabbajack.Lib.ModListRegistry;
|
||||||
|
|
||||||
|
namespace Wabbajack.Lib.GitHub
|
||||||
|
{
|
||||||
|
[JsonName("UpdateRequest")]
|
||||||
|
public class UpdateRequest
|
||||||
|
{
|
||||||
|
public string MachineUrl { get; set; } = "";
|
||||||
|
public Version? Version { get; set; } = new();
|
||||||
|
public Uri DownloadUrl { get; set; } = new("https://www.wabbajack.org");
|
||||||
|
public DownloadMetadata DownloadMetadata { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ using Alphaleonis.Win32.Filesystem;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.CompilationSteps;
|
using Wabbajack.Lib.CompilationSteps;
|
||||||
using Wabbajack.Lib.Downloaders;
|
using Wabbajack.Lib.Downloaders;
|
||||||
|
using Wabbajack.Lib.GitHub;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
|
|
||||||
@ -15,8 +16,8 @@ namespace Wabbajack.Lib
|
|||||||
{
|
{
|
||||||
public class MO2Compiler : ACompiler
|
public class MO2Compiler : ACompiler
|
||||||
{
|
{
|
||||||
public MO2Compiler(AbsolutePath sourcePath, AbsolutePath downloadsPath, string mo2Profile, AbsolutePath outputFile)
|
public MO2Compiler(AbsolutePath sourcePath, AbsolutePath downloadsPath, string mo2Profile, AbsolutePath outputFile, UpdateRequest? publishData = null)
|
||||||
: base(21, mo2Profile, sourcePath, downloadsPath, outputFile)
|
: base(23, mo2Profile, sourcePath, downloadsPath, outputFile, publishData)
|
||||||
{
|
{
|
||||||
MO2Profile = mo2Profile;
|
MO2Profile = mo2Profile;
|
||||||
MO2Ini = SourcePath.Combine("ModOrganizer.ini").LoadIniFile();
|
MO2Ini = SourcePath.Combine("ModOrganizer.ini").LoadIniFile();
|
||||||
@ -25,6 +26,7 @@ namespace Wabbajack.Lib
|
|||||||
GamePath = CompilingGame.GameLocation();
|
GamePath = CompilingGame.GameLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UpdateRequest? PublishData { get; set; }
|
||||||
public AbsolutePath MO2ModsFolder => SourcePath.Combine(Consts.MO2ModFolderName);
|
public AbsolutePath MO2ModsFolder => SourcePath.Combine(Consts.MO2ModFolderName);
|
||||||
|
|
||||||
public string MO2Profile { get; }
|
public string MO2Profile { get; }
|
||||||
@ -58,6 +60,10 @@ namespace Wabbajack.Lib
|
|||||||
FileExtractor2.FavorPerfOverRAM = FavorPerfOverRam;
|
FileExtractor2.FavorPerfOverRAM = FavorPerfOverRam;
|
||||||
|
|
||||||
UpdateTracker.Reset();
|
UpdateTracker.Reset();
|
||||||
|
|
||||||
|
UpdateTracker.NextStep("Running Preflight Checks");
|
||||||
|
await PreflightChecks();
|
||||||
|
|
||||||
UpdateTracker.NextStep("Gathering information");
|
UpdateTracker.NextStep("Gathering information");
|
||||||
|
|
||||||
Utils.Log("Loading compiler Settings");
|
Utils.Log("Loading compiler Settings");
|
||||||
@ -363,6 +369,9 @@ namespace Wabbajack.Lib
|
|||||||
UpdateTracker.NextStep("Exporting Modlist");
|
UpdateTracker.NextStep("Exporting Modlist");
|
||||||
await ExportModList();
|
await ExportModList();
|
||||||
|
|
||||||
|
UpdateTracker.NextStep("Publishing Modlist");
|
||||||
|
await PublishModlist();
|
||||||
|
|
||||||
ResetMembers();
|
ResetMembers();
|
||||||
|
|
||||||
UpdateTracker.NextStep("Done Building Modlist");
|
UpdateTracker.NextStep("Done Building Modlist");
|
||||||
|
@ -138,8 +138,6 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
{
|
{
|
||||||
public Hash Hash { get; set; }
|
public Hash Hash { get; set; }
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
|
|
||||||
public Version Version { get; set; } = new();
|
|
||||||
public long NumberOfArchives { get; set; }
|
public long NumberOfArchives { get; set; }
|
||||||
public long SizeOfArchives { get; set; }
|
public long SizeOfArchives { get; set; }
|
||||||
public long NumberOfInstalledFiles { get; set; }
|
public long NumberOfInstalledFiles { get; set; }
|
||||||
|
@ -5,6 +5,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib.CompilationSteps;
|
using Wabbajack.Lib.CompilationSteps;
|
||||||
|
using Wabbajack.Lib.GitHub;
|
||||||
using Wabbajack.Lib.Validation;
|
using Wabbajack.Lib.Validation;
|
||||||
using Wabbajack.VirtualFileSystem;
|
using Wabbajack.VirtualFileSystem;
|
||||||
|
|
||||||
@ -12,8 +13,8 @@ namespace Wabbajack.Lib
|
|||||||
{
|
{
|
||||||
public class NativeCompiler : ACompiler
|
public class NativeCompiler : ACompiler
|
||||||
{
|
{
|
||||||
public NativeCompiler(NativeCompilerSettings settings, AbsolutePath sourcePath, AbsolutePath downloadsPath, AbsolutePath outputModListPath)
|
public NativeCompiler(NativeCompilerSettings settings, AbsolutePath sourcePath, AbsolutePath downloadsPath, AbsolutePath outputModListPath, UpdateRequest? publishData = null)
|
||||||
: base(3, settings.ModListName, sourcePath, downloadsPath, outputModListPath)
|
: base(5, settings.ModListName, sourcePath, downloadsPath, outputModListPath, publishData)
|
||||||
{
|
{
|
||||||
CompilingGame = settings.CompilingGame.MetaData();
|
CompilingGame = settings.CompilingGame.MetaData();
|
||||||
GamePath = CompilingGame.GameLocation();
|
GamePath = CompilingGame.GameLocation();
|
||||||
@ -34,6 +35,10 @@ namespace Wabbajack.Lib
|
|||||||
FileExtractor2.FavorPerfOverRAM = FavorPerfOverRam;
|
FileExtractor2.FavorPerfOverRAM = FavorPerfOverRam;
|
||||||
|
|
||||||
UpdateTracker.Reset();
|
UpdateTracker.Reset();
|
||||||
|
|
||||||
|
UpdateTracker.NextStep("Running Preflight Checks");
|
||||||
|
await PreflightChecks();
|
||||||
|
|
||||||
UpdateTracker.NextStep("Gathering information");
|
UpdateTracker.NextStep("Gathering information");
|
||||||
|
|
||||||
Utils.Log($"Compiling Game: {CompilingGame.Game}");
|
Utils.Log($"Compiling Game: {CompilingGame.Game}");
|
||||||
@ -244,6 +249,9 @@ namespace Wabbajack.Lib
|
|||||||
UpdateTracker.NextStep("Exporting Modlist");
|
UpdateTracker.NextStep("Exporting Modlist");
|
||||||
await ExportModList();
|
await ExportModList();
|
||||||
|
|
||||||
|
UpdateTracker.NextStep("Publishing Modlist");
|
||||||
|
await PublishModlist();
|
||||||
|
|
||||||
ResetMembers();
|
ResetMembers();
|
||||||
|
|
||||||
UpdateTracker.NextStep("Done Building Modlist");
|
UpdateTracker.NextStep("Done Building Modlist");
|
||||||
|
@ -16,6 +16,7 @@ using Wabbajack.Common;
|
|||||||
using Wabbajack.Lib.GitHub;
|
using Wabbajack.Lib.GitHub;
|
||||||
using Wabbajack.Lib.ModListRegistry;
|
using Wabbajack.Lib.ModListRegistry;
|
||||||
using Wabbajack.Server.DataLayer;
|
using Wabbajack.Server.DataLayer;
|
||||||
|
using Wabbajack.Server.Services;
|
||||||
|
|
||||||
namespace Wabbajack.BuildServer.Controllers
|
namespace Wabbajack.BuildServer.Controllers
|
||||||
{
|
{
|
||||||
@ -25,11 +26,13 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
{
|
{
|
||||||
private ILogger<AuthorControls> _logger;
|
private ILogger<AuthorControls> _logger;
|
||||||
private SqlService _sql;
|
private SqlService _sql;
|
||||||
|
private readonly QuickSync _quickSync;
|
||||||
|
|
||||||
public AuthorControls(ILogger<AuthorControls> logger, SqlService sql)
|
public AuthorControls(ILogger<AuthorControls> logger, SqlService sql, QuickSync quickSync)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_sql = sql;
|
_sql = sql;
|
||||||
|
_quickSync = quickSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("login/{authorKey}")]
|
[Route("login/{authorKey}")]
|
||||||
@ -56,19 +59,21 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
return Ok(lists);
|
return Ok(lists);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("lists/{machineUrl}/download_metadata")]
|
[Route("lists/download_metadata")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> AuthorLists(string machineUrl)
|
public async Task<IActionResult> PostDownloadMetadata()
|
||||||
{
|
{
|
||||||
var user = User.FindFirstValue(ClaimTypes.Name);
|
var user = User.FindFirstValue(ClaimTypes.Name);
|
||||||
var data = (await Request.Body.ReadAllTextAsync()).FromJsonString<DownloadMetadata>();
|
var data = (await Request.Body.ReadAllTextAsync()).FromJsonString<UpdateRequest>();
|
||||||
var client = await Client.Get();
|
var client = await Client.Get();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await client.UpdateList(user, machineUrl, data);
|
await client.UpdateList(user, data);
|
||||||
|
await _quickSync.Notify<ModListDownloader>();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.LogError(ex, "During posting of download_metadata");
|
||||||
return BadRequest(ex);
|
return BadRequest(ex);
|
||||||
}
|
}
|
||||||
return Ok(data);
|
return Ok(data);
|
||||||
|
@ -141,6 +141,7 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
var definition = await _sql.GetCDNFileDefinition(serverAssignedUniqueId);
|
var definition = await _sql.GetCDNFileDefinition(serverAssignedUniqueId);
|
||||||
if (definition.Author != user)
|
if (definition.Author != user)
|
||||||
return Forbid("File Id does not match authorized user");
|
return Forbid("File Id does not match authorized user");
|
||||||
|
await _discord.Send(Channel.Ham, new DiscordMessage() {Content = $"{user} is deleting {definition.MungedName}, {definition.Size.ToFileSizeString()} to be freed"});
|
||||||
_logger.Log(LogLevel.Information, $"Finalizing file upload {definition.OriginalFileName}");
|
_logger.Log(LogLevel.Information, $"Finalizing file upload {definition.OriginalFileName}");
|
||||||
|
|
||||||
await DeleteFolderOrSilentlyFail($"{definition.MungedName}");
|
await DeleteFolderOrSilentlyFail($"{definition.MungedName}");
|
||||||
|
@ -24,17 +24,23 @@ namespace Wabbajack.Test
|
|||||||
NumberOfInstalledFiles = rnd.Next(1000),
|
NumberOfInstalledFiles = rnd.Next(1000),
|
||||||
SizeOfInstalledFiles = rnd.Next(1000000),
|
SizeOfInstalledFiles = rnd.Next(1000000),
|
||||||
Size = rnd.Next(10000),
|
Size = rnd.Next(10000),
|
||||||
Version = new Version(1, 0, rnd.Next(10), 0)
|
|
||||||
};
|
};
|
||||||
await client.UpdateList("ci_tester", "ci_test", meta);
|
var update = new UpdateRequest
|
||||||
|
{
|
||||||
|
DownloadMetadata = meta,
|
||||||
|
DownloadUrl = new Uri($"https://www.google.com/{rnd.Next()}"),
|
||||||
|
MachineUrl = "ci_test",
|
||||||
|
Version = new Version(1, rnd.Next(10), rnd.Next(10), rnd.Next(10))
|
||||||
|
};
|
||||||
|
await client.UpdateList("ci_tester", update);
|
||||||
|
|
||||||
var updated = await client.GetData(Client.List.CI);
|
var updated = await client.GetData(Client.List.CI);
|
||||||
var lst = updated.Lists.FirstOrDefault(l => l.Links.MachineURL == "ci_test");
|
var lst = updated.Lists.FirstOrDefault(l => l.Links.MachineURL == "ci_test");
|
||||||
var newMeta = lst!.DownloadMetadata!;
|
var newMeta = lst!.DownloadMetadata!;
|
||||||
Assert.Equal(meta.Hash, newMeta.Hash);
|
Assert.Equal(meta.Hash, newMeta.Hash);
|
||||||
Assert.Equal(meta.Size, newMeta.Size);
|
Assert.Equal(meta.Size, newMeta.Size);
|
||||||
Assert.Equal(meta.Version, newMeta.Version);
|
Assert.Equal(update.Version, lst.Version);
|
||||||
Assert.Equal(lst.Version, newMeta.Version);
|
|
||||||
|
|
||||||
Assert.Equal(meta.NumberOfArchives, newMeta.NumberOfArchives);
|
Assert.Equal(meta.NumberOfArchives, newMeta.NumberOfArchives);
|
||||||
Assert.Equal(meta.NumberOfInstalledFiles, newMeta.NumberOfInstalledFiles);
|
Assert.Equal(meta.NumberOfInstalledFiles, newMeta.NumberOfInstalledFiles);
|
||||||
|
@ -180,7 +180,10 @@ namespace Wabbajack
|
|||||||
public string Website { get; set; }
|
public string Website { get; set; }
|
||||||
public string Readme { get; set; }
|
public string Readme { get; set; }
|
||||||
public bool IsNSFW { get; set; }
|
public bool IsNSFW { get; set; }
|
||||||
|
|
||||||
|
public string MachineUrl { get; set; }
|
||||||
public AbsolutePath SplashScreen { get; set; }
|
public AbsolutePath SplashScreen { get; set; }
|
||||||
|
public bool Publish { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonName("MO2CompilationSettings")]
|
[JsonName("MO2CompilationSettings")]
|
||||||
|
@ -16,6 +16,8 @@ using System.Windows.Media.Imaging;
|
|||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Common.StatusFeed;
|
using Wabbajack.Common.StatusFeed;
|
||||||
using Wabbajack.Lib;
|
using Wabbajack.Lib;
|
||||||
|
using Wabbajack.Lib.AuthorApi;
|
||||||
|
using Wabbajack.Lib.FileUploader;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using ReactiveUI.Fody.Helpers;
|
using ReactiveUI.Fody.Helpers;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
@ -10,6 +11,9 @@ using System.Threading.Tasks;
|
|||||||
using DynamicData;
|
using DynamicData;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Lib;
|
using Wabbajack.Lib;
|
||||||
|
using Wabbajack.Lib.AuthorApi;
|
||||||
|
using Wabbajack.Lib.FileUploader;
|
||||||
|
using Wabbajack.Lib.GitHub;
|
||||||
using WebSocketSharp;
|
using WebSocketSharp;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
@ -34,6 +38,7 @@ namespace Wabbajack
|
|||||||
public ACompiler ActiveCompilation { get; private set; }
|
public ACompiler ActiveCompilation { get; private set; }
|
||||||
|
|
||||||
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _modlistSettings;
|
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _modlistSettings;
|
||||||
|
private readonly IObservable<IChangeSet<string>> _authorKeys;
|
||||||
public ModlistSettingsEditorVM ModlistSettings => _modlistSettings.Value;
|
public ModlistSettingsEditorVM ModlistSettings => _modlistSettings.Value;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
@ -201,11 +206,20 @@ namespace Wabbajack
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ACompiler compiler;
|
ACompiler compiler;
|
||||||
|
UpdateRequest request = null;
|
||||||
|
if (ModlistSettings.Publish)
|
||||||
|
{
|
||||||
|
request = new UpdateRequest
|
||||||
|
{
|
||||||
|
MachineUrl = ModlistSettings.MachineUrl.Trim(),
|
||||||
|
Version = ModlistSettings.Version,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (ModListLocation.TargetPath.FileName == Consts.NativeSettingsJson)
|
if (ModListLocation.TargetPath.FileName == Consts.NativeSettingsJson)
|
||||||
{
|
{
|
||||||
var settings = ModListLocation.TargetPath.FromJson<NativeCompilerSettings>();
|
var settings = ModListLocation.TargetPath.FromJson<NativeCompilerSettings>();
|
||||||
compiler = new NativeCompiler(settings, Mo2Folder, DownloadLocation.TargetPath, outputFile)
|
compiler = new NativeCompiler(settings, Mo2Folder, DownloadLocation.TargetPath, outputFile, request)
|
||||||
{
|
{
|
||||||
ModListName = ModlistSettings.ModListName,
|
ModListName = ModlistSettings.ModListName,
|
||||||
ModListAuthor = ModlistSettings.AuthorText,
|
ModListAuthor = ModlistSettings.AuthorText,
|
||||||
@ -219,11 +233,13 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
compiler = new MO2Compiler(
|
compiler = new MO2Compiler(
|
||||||
sourcePath: Mo2Folder,
|
sourcePath: Mo2Folder,
|
||||||
downloadsPath: DownloadLocation.TargetPath,
|
downloadsPath: DownloadLocation.TargetPath,
|
||||||
mo2Profile: MOProfile,
|
mo2Profile: MOProfile,
|
||||||
outputFile: outputFile)
|
outputFile: outputFile,
|
||||||
|
publishData: request)
|
||||||
{
|
{
|
||||||
ModListName = ModlistSettings.ModListName,
|
ModListName = ModlistSettings.ModListName,
|
||||||
ModListAuthor = ModlistSettings.AuthorText,
|
ModListAuthor = ModlistSettings.AuthorText,
|
||||||
|
@ -34,6 +34,9 @@ namespace Wabbajack
|
|||||||
[Reactive]
|
[Reactive]
|
||||||
public string Readme { get; set; }
|
public string Readme { get; set; }
|
||||||
|
|
||||||
|
[Reactive] public string MachineUrl { get; set; } = "";
|
||||||
|
[Reactive] public bool Publish { get; set; } = false;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string Website { get; set; }
|
public string Website { get; set; }
|
||||||
|
|
||||||
@ -85,6 +88,8 @@ namespace Wabbajack
|
|||||||
Website = _settings.Website;
|
Website = _settings.Website;
|
||||||
VersionText = _settings.Version;
|
VersionText = _settings.Version;
|
||||||
IsNSFW = _settings.IsNSFW;
|
IsNSFW = _settings.IsNSFW;
|
||||||
|
MachineUrl = _settings.MachineUrl;
|
||||||
|
Publish = _settings.Publish;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
@ -97,6 +102,8 @@ namespace Wabbajack
|
|||||||
_settings.SplashScreen = ImagePath.TargetPath;
|
_settings.SplashScreen = ImagePath.TargetPath;
|
||||||
_settings.Website = Website;
|
_settings.Website = Website;
|
||||||
_settings.IsNSFW = IsNSFW;
|
_settings.IsNSFW = IsNSFW;
|
||||||
|
_settings.MachineUrl = MachineUrl;
|
||||||
|
_settings.Publish = Publish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,15 @@
|
|||||||
x:Name="NSFWSetting"
|
x:Name="NSFWSetting"
|
||||||
Content="NSFW"
|
Content="NSFW"
|
||||||
ToolTip="Select this if your Modlist has adult themed content such as SexLab or other mods involving sexual acts. Nude body replacer do not fall under this category neither do revealing outfits or gore." />
|
ToolTip="Select this if your Modlist has adult themed content such as SexLab or other mods involving sexual acts. Nude body replacer do not fall under this category neither do revealing outfits or gore." />
|
||||||
|
<CheckBox
|
||||||
|
x:Name="PublishUpdate"
|
||||||
|
Content="Publish Update"
|
||||||
|
ToolTip="Select this if your want Wabbajack to automatically publish this modlist when compilation finished (requires a selected machineURL)" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource TitleMargin}"
|
||||||
|
Text="MachineUrl"
|
||||||
|
ToolTip="If this box has a value the modlist will be published to this MachineUrl after compilation" />
|
||||||
|
<TextBox x:Name="MachineUrl" Style="{StaticResource ValueStyle}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5"
|
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System.Reactive.Disposables;
|
using System.Linq;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using DynamicData;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
@ -79,6 +81,12 @@ namespace Wabbajack
|
|||||||
this.BindStrict(ViewModel, x => x.CurrentModlistSettings.IsNSFW, x => x.NSFWSetting.IsChecked)
|
this.BindStrict(ViewModel, x => x.CurrentModlistSettings.IsNSFW, x => x.NSFWSetting.IsChecked)
|
||||||
.DisposeWith(dispose);
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
|
this.BindStrict(ViewModel, x => x.CurrentModlistSettings.MachineUrl, x => x.MachineUrl.Text)
|
||||||
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
|
this.BindStrict(ViewModel, x => x.CurrentModlistSettings.Publish, x => x.PublishUpdate.IsChecked)
|
||||||
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
// Bottom Compiler Settings
|
// Bottom Compiler Settings
|
||||||
this.WhenAny(x => x.ViewModel.StartedCompilation)
|
this.WhenAny(x => x.ViewModel.StartedCompilation)
|
||||||
.Select(started => started ? Visibility.Hidden : Visibility.Visible)
|
.Select(started => started ? Visibility.Hidden : Visibility.Visible)
|
||||||
|
Reference in New Issue
Block a user