mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-06 13:21:27 +00:00
Implement basic RPC configuration API endpoint (#864)
* Implement basic RPC information endpoint with test data * Implement configuration options for RPC * Rename RpcConfiguration to RpcResponse * Rider insists on modifying dataSources.xml * Implement documentation and fix code quality/gitignore issues * Use SerializableAttribute instead of UsedImplicitlyAttribute * Add warning regarding nullable assets * Prevent precision issues with application ID * Check asset properties for null/whitespace and return null
This commit is contained in:
parent
7939211308
commit
e072201ec7
7 changed files with 123 additions and 20 deletions
18
ProjectLighthouse.Servers.API/Controllers/RpcController.cs
Normal file
18
ProjectLighthouse.Servers.API/Controllers/RpcController.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Servers.API.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.API.Controllers;
|
||||
|
||||
public class RpcController : ApiEndpointController
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns basic information that Discord RPC clients can use for self-configuration.
|
||||
/// </summary>
|
||||
/// <returns>RpcResponse</returns>
|
||||
/// <response code="200">The RPC configuration.</response>
|
||||
[HttpGet("rpc")]
|
||||
[ProducesResponseType(typeof(RpcResponse), StatusCodes.Status200OK)]
|
||||
public IActionResult GetRpcConfiguration() =>
|
||||
this.Ok(RpcResponse.CreateFromConfiguration(ServerConfiguration.Instance.RichPresenceConfiguration));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue