Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Jul 10, 2024
1 parent 0f1c04b commit ce4a99f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@inherits LayoutComponentBase
@attribute [IgnoreAntiforgeryToken(Order = 700)]

<div class="page">
<main>
Expand Down
1 change: 1 addition & 0 deletions src/ProfanityFilter.WebApi/Components/Pages/Error.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/Error"
@attribute [IgnoreAntiforgeryToken(Order = 700)]
@using System.Diagnostics

<PageTitle>Error</PageTitle>
Expand Down
7 changes: 3 additions & 4 deletions src/ProfanityFilter.WebApi/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@page "/"
@attribute [StreamRendering]
@attribute [IgnoreAntiforgeryToken]

<PageTitle>Filter</PageTitle>

Expand All @@ -15,7 +13,8 @@
</header>

<div class="container d-flex py-5">
<textarea value="@_text"
<textarea value="@_text" title="Text area for user input"
placeholder="User input"
@oninput="@OnTextChanged"
class="form-control flex-fill" id="content" style="height: 80vh;">
</textarea>
Expand All @@ -25,7 +24,7 @@
<div class="container justify-content-center">
<div class="row g-3 align-items-center">
<div class="col-12">
<InputSelect @bind-Value="@_selectedStrategy" class="form-select form-select-lg">
<InputSelect @bind-Value="@_selectedStrategy" title="Strategy" class="form-select form-select-lg">
@foreach (var strategy in _strategies)
{
var text = strategy.ToString().SplitCamelCase();
Expand Down
2 changes: 2 additions & 0 deletions src/ProfanityFilter.WebApi/Components/Pages/Home.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace ProfanityFilter.WebApi.Components.Pages;

[StreamRendering]
[IgnoreAntiforgeryToken(Order = 700)]
public sealed partial class Home : IAsyncDisposable
{
private readonly SystemTimer _debounceTimer = new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ internal static class ProfanityFilterEndpointExtensions
{
internal static WebApplication MapProfanityFilterEndpoints(this WebApplication app)
{
var profanity = app.MapGroup("profanity");
var profanity = app.MapGroup("profanity")
.DisableAntiforgery();

profanity.MapHub<ProfanityHub>("hub", options =>
{
Expand All @@ -21,8 +22,7 @@ internal static WebApplication MapProfanityFilterEndpoints(this WebApplication a
.WithOpenApi()
.WithSummary("""
The profanity filter hub endpoint, used for live bi-directional updates.
""")
.DisableAntiforgery();
""");

profanity.MapPost("filter", OnApplyFilterAsync)
.WithOpenApi()
Expand All @@ -32,8 +32,7 @@ internal static WebApplication MapProfanityFilterEndpoints(this WebApplication a
.WithSummary("""
Use this endpoint to attempt applying a profanity-filter. The response is returned as Markdown.
""")
.WithHttpLogging(HttpLoggingFields.All)
.DisableAntiforgery();
.WithHttpLogging(HttpLoggingFields.All);

profanity.MapGet("strategies", OnGetStrategies)
.WithOpenApi()
Expand All @@ -43,8 +42,7 @@ Use this endpoint to attempt applying a profanity-filter. The response is return
.WithSummary("""
Returns an array of the possible replacement strategies available. See https://github.com/IEvangelist/profanity-filter?tab=readme-ov-file#-replacement-strategies
""")
.WithHttpLogging(HttpLoggingFields.All)
.DisableAntiforgery();
.WithHttpLogging(HttpLoggingFields.All);

profanity.MapGet("targets", OnGetTargets)
.WithOpenApi()
Expand All @@ -54,10 +52,10 @@ Use this endpoint to attempt applying a profanity-filter. The response is return
.WithSummary("""
Returns an array of the possible filter targets available.
""")
.WithHttpLogging(HttpLoggingFields.All)
.DisableAntiforgery();
.WithHttpLogging(HttpLoggingFields.All);

var data = profanity.MapGroup("data");
var data = profanity.MapGroup("data")
.DisableAntiforgery();

data.MapGet("", OnGetDataNamesAsync)
.WithOpenApi()
Expand All @@ -67,8 +65,7 @@ Returns an array of the possible filter targets available.
.WithSummary("""
Returns an array of the data names.
""")
.WithHttpLogging(HttpLoggingFields.All)
.DisableAntiforgery();
.WithHttpLogging(HttpLoggingFields.All);

data.MapGet("{name}", OnGetDataByNameAsync)
.WithOpenApi()
Expand All @@ -78,8 +75,7 @@ Returns an array of the data names.
.WithSummary("""
Returns an array of the profane words for a given data name.
""")
.WithHttpLogging(HttpLoggingFields.All)
.DisableAntiforgery();
.WithHttpLogging(HttpLoggingFields.All);

return app;
}
Expand Down

0 comments on commit ce4a99f

Please sign in to comment.