Add filter debug page

This commit is contained in:
jvyden 2022-03-12 23:17:40 -05:00
commit 2d773ed7bf
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,22 @@
@page "/debug/filter"
@model LBPUnion.ProjectLighthouse.Pages.Debug.FilterTestPage
@{
Layout = "Layouts/BaseLayout";
Model.Title = "Debug - Filter Test";
}
@if (Model.FilteredText != null)
{
<p>@Model.FilteredText</p>
}
<form>
<div class="ui right action input">
<input type="text" name="text" placeholder="Text to be filtered" value="@(Model.Text ?? "")">
<button type="submit" class="ui blue button">
<i class="pen icon"></i>
Filter
</button>
</div>
</form>

View file

@ -0,0 +1,28 @@
#nullable enable
using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using Microsoft.AspNetCore.Mvc;
namespace LBPUnion.ProjectLighthouse.Pages.Debug;
public class FilterTestPage : BaseLayout
{
public FilterTestPage(Database database) : base(database)
{}
public string? FilteredText = null;
public string? Text = null;
public async Task<IActionResult> OnGet(string? text = null)
{
#if !DEBUG
return this.NotFound();
#endif
if (text != null) this.FilteredText = CensorHelper.ScanMessage(text);
this.Text = text;
return this.Page();
}
}