Another's profile and posts can be reported from the client (/api/v1/reports): a category, words, and for a remote account a copy to its server, which PrivaPub sends from its own actor, never naming the persona. Who liked or boosted a post opens from its card's menu (favourited_by, reblogged_by). e2e: a report from a Mastodon account's profile reaches PrivaPub's moderators forwarded, and a post's likes and boosts list the persona who gave them; the admin helper the tests share moves to Support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
27 lines
1.0 KiB
C#
27 lines
1.0 KiB
C#
using System.Net.Http.Json;
|
|
using System.Text.Json.Nodes;
|
|
|
|
namespace decePubClient.E2E.Support
|
|
{
|
|
// PrivaPub's /clientapi as the pasture's administrator (pastureroot, whom the scenarios make): what its moderators
|
|
// and administrators see
|
|
public static class PastureAdmin
|
|
{
|
|
public const string Root = "pastureroot";
|
|
public const string Password = "Pasture-Pass-1!";
|
|
|
|
public static async Task<JsonNode> Get(string path)
|
|
{
|
|
using var http = Pasture.Http();
|
|
var login = await http.PostAsJsonAsync($"{Pasture.Api}/clientapi/user/login", new { userName = Root, password = Password });
|
|
login.EnsureSuccessStatusCode();
|
|
var jwt = (await login.Content.ReadFromJsonAsync<JsonObject>())!["token"]!.GetValue<string>();
|
|
using var request = new HttpRequestMessage(HttpMethod.Get, Pasture.Api + path);
|
|
request.Headers.Authorization = new("Bearer", jwt);
|
|
using var response = await http.SendAsync(request);
|
|
response.EnsureSuccessStatusCode();
|
|
return JsonNode.Parse(await response.Content.ReadAsStringAsync());
|
|
}
|
|
}
|
|
}
|