mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Endpoint for downloading meta.ini data
This commit is contained in:
parent
5393ed4a84
commit
4d2f887517
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using Wabbajack.BuildServer.Models;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.VirtualFileSystem;
|
||||
@ -18,6 +19,23 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/{xxHashAsBase64}/meta.ini")]
|
||||
public async Task<IActionResult> GetFileMeta(string xxHashAsBase64)
|
||||
{
|
||||
var id = xxHashAsBase64.FromHex().ToBase64();
|
||||
var state = await Db.DownloadStates.AsQueryable()
|
||||
.Where(d => d.Hash == id && d.IsValid)
|
||||
.OrderByDescending(d => d.LastValidationTime)
|
||||
.Take(1)
|
||||
.ToListAsync();
|
||||
|
||||
if (state.Count == 0)
|
||||
return NotFound();
|
||||
Response.ContentType = "text/plain";
|
||||
return Ok(string.Join("\r\n", state.FirstOrDefault().State.GetMetaIni()));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{xxHashAsBase64}")]
|
||||
public async Task<IActionResult> GetFile(string xxHashAsBase64)
|
||||
|
Loading…
Reference in New Issue
Block a user