Implement privacySettings, /t_conf, /showModerated, and /match

This commit is contained in:
jvyden 2021-10-08 20:17:20 -04:00
commit ec35e6f9bb
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
4 changed files with 35 additions and 4 deletions

View file

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Serialization; using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
namespace ProjectLighthouse.Controllers { namespace ProjectLighthouse.Controllers {
[ApiController] [ApiController]
@ -12,8 +13,9 @@ namespace ProjectLighthouse.Controllers {
} }
[HttpGet("t_conf")] [HttpGet("t_conf")]
[Produces("text/json")]
public IActionResult TConf() { public IActionResult TConf() {
return this.Ok(); return this.Ok("[{\"StatusCode\":200}]");
} }
[HttpGet("farc_hashes")] [HttpGet("farc_hashes")]
@ -22,8 +24,14 @@ namespace ProjectLighthouse.Controllers {
} }
[HttpGet("privacySettings")] [HttpGet("privacySettings")]
[Produces("text/xml")]
public IActionResult PrivacySettings() { public IActionResult PrivacySettings() {
return this.Ok(); PrivacySettings ps = new() {
LevelVisibility = "unset",
ProfileVisibility = "unset"
};
return this.Ok(ps.Serialize());
} }
} }
} }

View file

@ -25,9 +25,16 @@ namespace ProjectLighthouse.Controllers {
return this.Ok(slot.Serialize()); return this.Ok(slot.Serialize());
} }
[HttpGet("slots/lolcatftw/{username}")]
public IActionResult SlotsLolCat(string username) {
string response = Enumerable.Aggregate(new Database().Slots, string.Empty, (current, slot) => current + slot.Serialize());
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
}
[HttpPost("showModerated")] [HttpPost("showModerated")]
public IActionResult ShowModerated() { public IActionResult ShowModerated() {
return this.Ok(); return this.Ok("<resources/>");
} }
} }
} }

View file

@ -109,8 +109,9 @@ namespace ProjectLighthouse.Controllers {
} }
[HttpPost("match")] [HttpPost("match")]
[Produces("text/json")]
public IActionResult Match() { public IActionResult Match() {
return this.Ok(); return this.Ok("[{\"StatusCode\":200}]");
} }
} }
} }

View file

@ -0,0 +1,15 @@
using ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types {
public class PrivacySettings {
public string LevelVisibility { get; set; }
public string ProfileVisibility { get; set; }
public string Serialize() {
return LbpSerializer.StringElement("privacySettings",
LbpSerializer.StringElement("levelVisibility", LevelVisibility) +
LbpSerializer.StringElement("profileVisibility", ProfileVisibility)
);
}
}
}