Get /r/ endpoint working

This commit is contained in:
jvyden 2021-10-10 19:44:13 -04:00
parent 2d64d914c6
commit a01fd08c33
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
5 changed files with 32 additions and 7 deletions

View file

@ -0,0 +1,30 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Serialization;
using IOFile = System.IO.File;
namespace ProjectLighthouse.Controllers {
[ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")]
public class ResourcesController : ControllerBase {
[HttpPost("filterResources")]
[HttpPost("showModerated")]
public IActionResult ShowModerated() {
return this.Ok(LbpSerializer.BlankElement("resources"));
}
[HttpGet("r/{hash}")]
public IActionResult GetResource(string hash) {
string path = Path.Combine(Environment.CurrentDirectory, "r", hash);
Console.WriteLine($"path: {path}, exists: {IOFile.Exists(path)}");
if(IOFile.Exists(path)) {
return this.File(IOFile.OpenRead(path), "image/jpg");
}
return this.NotFound();
}
}
}

View file

@ -30,10 +30,5 @@ namespace ProjectLighthouse.Controllers {
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
}
[HttpPost("showModerated")]
public IActionResult ShowModerated() {
return this.Ok(LbpSerializer.BlankElement("resources"));
}
}
}

View file

@ -18,7 +18,7 @@
"ProjectLighthouse": {
"commandName": "Project",
"dotnetRunMessages": "true",
"applicationUrl": "http://localhost:10060;https://localhost:10061;http://localhost:1062",
"applicationUrl": "http://localhost:10060;http://localhost:10061;http://localhost:1062",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"LIGHTHOUSE_DB_CONNECTION_STRING": "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0",
"version": "5.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}