The persona's filters (PrivaPub's /api/v2/filters): made, given words and whole-word rules, contexts, an action and an expiry on /filters (linked from Settings), and deleted; posts filtered one by one can be taken out. Every status says which filters it matches; each page tells its cards where they are (home and lists, notifications, public feeds, the thread around the opened post, profiles), and a card leaves its post out (hide), folds it behind the filter's title with a way to show it anyway (warn), or blurs its media (blur). The e2e test folds and then hides a post of the persona's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using System.Net;
|
|
using System.Net.Http.Headers;
|
|
using System.Text.Json.Nodes;
|
|
|
|
namespace decePubClient.E2E.Support
|
|
{
|
|
// PrivaPub's Mastodon API as a persona (its town token), for what a test sets up or checks behind the page
|
|
public static class PersonaApi
|
|
{
|
|
// the answer's JSON, or null for a 404
|
|
public static async Task<JsonNode> Call(Pasture.Persona persona, string path, HttpMethod method = null, JsonObject body = null)
|
|
{
|
|
using var http = Pasture.Http();
|
|
using var request = new HttpRequestMessage(method ?? HttpMethod.Get, Pasture.Api + path);
|
|
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", persona.Token);
|
|
if (body is not null)
|
|
request.Content = new StringContent(body.ToJsonString(), System.Text.Encoding.UTF8, "application/json");
|
|
using var response = await http.SendAsync(request);
|
|
if (response.StatusCode == HttpStatusCode.NotFound)
|
|
return null;
|
|
response.EnsureSuccessStatusCode();
|
|
return JsonNode.Parse(await response.Content.ReadAsStringAsync());
|
|
}
|
|
}
|
|
}
|