FO4VR support and a few server side tweaks

This commit is contained in:
Timothy Baldridge 2020-06-05 14:53:44 -06:00
parent 8c9c527d06
commit c43d9416fb
3 changed files with 38 additions and 3 deletions

View File

@ -26,6 +26,8 @@ namespace Wabbajack.Common
Fallout4,
[Description("Skyrim VR")]
SkyrimVR,
[Description("Fallout 4 VR")]
Fallout4VR
}
public static class GameExtensions
@ -339,7 +341,8 @@ namespace Wabbajack.Common
{
"Fallout4.exe"
},
MainExecutable = "Fallout4.exe"
MainExecutable = "Fallout4.exe",
CommonlyConfusedWith = new [] {Game.Fallout4VR}
}
},
{
@ -375,6 +378,23 @@ namespace Wabbajack.Common
},
MainExecutable = "TESV.exe"
}
},
{
Game.Fallout4VR, new GameMetaData
{
SupportedModManager = ModManager.MO2,
Game = Game.Fallout4VR,
NexusName = "fallout4",
MO2Name = "Fallout 4 VR",
MO2ArchiveName = "Fallout4",
SteamIDs = new List<int>{611660},
RequiredFiles = new List<string>
{
"Fallout4VR.exe"
},
MainExecutable = "Fallout4VR.exe",
CommonlyConfusedWith = new [] {Game.Fallout4}
}
}
};

View File

@ -31,26 +31,33 @@ namespace Wabbajack.BuildServer.Controllers
var request = (await Request.Body.ReadAllTextAsync()).FromJsonString<ModUpgradeRequest>();
if (!request.IsValid)
{
_logger.Log(LogLevel.Information, $"Upgrade requested from {request.OldArchive.Hash} to {request.NewArchive.Hash} rejected as upgrade is invalid");
return BadRequest("Invalid mod upgrade");
}
if (!await _sql.HashIsInAModlist(request.OldArchive.Hash))
{
_logger.Log(LogLevel.Information, $"Upgrade requested from {request.OldArchive.Hash} to {request.NewArchive.Hash} rejected as src hash is not in a curated modlist");
return BadRequest("Hash is not in a recent modlist");
}
var oldDownload = await _sql.GetOrEnqueueArchive(request.OldArchive);
var newDownload = await _sql.GetOrEnqueueArchive(request.NewArchive);
_logger.Log(LogLevel.Information, $"Upgrade requested from {oldDownload.Archive.Hash} to {newDownload.Archive.Hash}");
var patch = await _sql.FindOrEnqueuePatch(oldDownload.Id, newDownload.Id);
if (patch.Finished.HasValue)
{
if (patch.PatchSize != 0)
{
_logger.Log(LogLevel.Information, $"Upgrade requested from {oldDownload.Archive.Hash} to {newDownload.Archive.Hash} patch Found");
return
Ok(
$"https://{_settings.BunnyCDN_StorageZone}.b-cdn.net/{Consts.ArchiveUpdatesCDNFolder}/{request.OldArchive.Hash.ToHex()}_{request.NewArchive.Hash.ToHex()}");
}
_logger.Log(LogLevel.Information, $"Upgrade requested from {oldDownload.Archive.Hash} to {newDownload.Archive.Hash} patch found but was failed");
return NotFound("Patch creation failed");
}
_logger.Log(LogLevel.Information, $"Upgrade requested from {oldDownload.Archive.Hash} to {newDownload.Archive.Hash} patch found is processing");
// Still processing
return Accepted();
}

View File

@ -59,5 +59,13 @@ namespace Wabbajack.Server.DataLayer
new {MachineUrl = machineUrl, Hash = hash});
return result != null;
}
public async Task<bool> HashIsInAModlist(Hash hash)
{
await using var conn = await Open();
var result = await conn.QueryFirstOrDefaultAsync<bool>("SELECT Hash FROM dbo.ModListArchives Where Hash = @Hash",
new {Hash = hash});
return result;
}
}
}