diff --git a/ProjectLighthouse/Controllers/ResourcesController.cs b/ProjectLighthouse/Controllers/ResourcesController.cs new file mode 100644 index 00000000..2bdfd3f4 --- /dev/null +++ b/ProjectLighthouse/Controllers/ResourcesController.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index d0d0da48..ba095e09 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -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")); - } } } \ No newline at end of file diff --git a/ProjectLighthouse/Properties/launchSettings.json b/ProjectLighthouse/Properties/launchSettings.json index ce1164e7..a8f5a37b 100644 --- a/ProjectLighthouse/Properties/launchSettings.json +++ b/ProjectLighthouse/Properties/launchSettings.json @@ -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" diff --git a/ProjectLighthouse/r/da7190f772a1057a2c8778b67a0d57f87453f266 b/ProjectLighthouse/r/da7190f772a1057a2c8778b67a0d57f87453f266 new file mode 100644 index 00000000..d32d1ce1 Binary files /dev/null and b/ProjectLighthouse/r/da7190f772a1057a2c8778b67a0d57f87453f266 differ diff --git a/global.json b/global.json index f443bd42..1d5e2b17 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0", + "version": "5.0", "rollForward": "latestMajor", "allowPrerelease": true }