mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 07:58:40 +00:00
Get /r/ endpoint working
This commit is contained in:
parent
2d64d914c6
commit
a01fd08c33
5 changed files with 32 additions and 7 deletions
30
ProjectLighthouse/Controllers/ResourcesController.cs
Normal file
30
ProjectLighthouse/Controllers/ResourcesController.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,10 +30,5 @@ namespace ProjectLighthouse.Controllers {
|
||||||
|
|
||||||
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("showModerated")]
|
|
||||||
public IActionResult ShowModerated() {
|
|
||||||
return this.Ok(LbpSerializer.BlankElement("resources"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
"ProjectLighthouse": {
|
"ProjectLighthouse": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": "true",
|
"dotnetRunMessages": "true",
|
||||||
"applicationUrl": "http://localhost:10060;https://localhost:10061;http://localhost:1062",
|
"applicationUrl": "http://localhost:10060;http://localhost:10061;http://localhost:1062",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LIGHTHOUSE_DB_CONNECTION_STRING": "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"
|
"LIGHTHOUSE_DB_CONNECTION_STRING": "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"
|
||||||
|
|
BIN
ProjectLighthouse/r/da7190f772a1057a2c8778b67a0d57f87453f266
Normal file
BIN
ProjectLighthouse/r/da7190f772a1057a2c8778b67a0d57f87453f266
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "6.0",
|
"version": "5.0",
|
||||||
"rollForward": "latestMajor",
|
"rollForward": "latestMajor",
|
||||||
"allowPrerelease": true
|
"allowPrerelease": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue