33 lines
929 B
C#
33 lines
929 B
C#
using DeluxeBackend.Models;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Text.Json;
|
|
|
|
namespace DeluxeBackend.Controllers.Api
|
|
{
|
|
[Route("api/sanitize")]
|
|
[ApiController]
|
|
public class SanitizeController : ControllerBase
|
|
{
|
|
[HttpPost("v1/isPure")]
|
|
[Authorize(Roles = "gameClient")]
|
|
public async Task<IActionResult> IsPure()
|
|
{
|
|
return Ok(new { IsPure = true});
|
|
}
|
|
|
|
public class SanitizeRequest
|
|
{
|
|
public string Value { get; set; } = string.Empty;
|
|
public int ReplacementChar { get; set; } = 42;
|
|
}
|
|
[HttpPost("v1")]
|
|
public async Task<IActionResult> SanitizeMessage([FromBody] SanitizeRequest request)
|
|
{
|
|
var sanitized = JsonSerializer.Serialize(request.Value);
|
|
return Ok(sanitized);
|
|
}
|
|
}
|
|
}
|