feat(api): add account workspaces and signed content events

This commit is contained in:
justme committed 2026-10-14 04:05:30 +08:00
1 parent 937b774a93
commit 7b8d61d1ba
63 files changed
+5407 -370

No files matched your search

+20 -1
View File
@@ -53,6 +53,7 @@ public class RestTests(ServerFixture s) : IClassFixture<ServerFixture>
var body = new Dictionary<string, object?>
{
["id"] = ch.Id, ["mode"] = "enc",
["settings"] = new { name = "Duplicate" },
["owner_hash"] = B64(TokenHash.Compute(ch.OwnerToken)),
["read_hash"] = B64(TokenHash.Compute(ch.ReadToken)),
};
@@ -69,6 +70,24 @@ public class RestTests(ServerFixture s) : IClassFixture<ServerFixture>
await AssertErrorAsync(await s.Http.SendAsync(badJson), 400, "bad_request");
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public async Task CreateRequiresSpaceName(string? name)
{
var ch = new Chan(NewId(), ChannelMode.Raw);
var body = new Dictionary<string, object?>
{
["id"] = ch.Id,
["mode"] = "raw",
["owner_hash"] = B64(TokenHash.Compute(ch.OwnerToken)),
};
if (name is not null) body["settings"] = new { name };
using var req = s.Req(HttpMethod.Post, "/api/v1/channels", ch.Owner, JsonBody(body));
await AssertErrorAsync(await s.Http.SendAsync(req), 400, "space_name_required");
}
[Fact]
public async Task ErrorsUseStableCodes()
{
@@ -367,7 +386,7 @@ public class RateLimitTests
{
var ch = new Chan(NewId(), ChannelMode.Raw);
using var req = server.Req(HttpMethod.Post, "/api/v1/channels", ch.Owner,
JsonBody(new { id = ch.Id, mode = "raw", owner_hash = B64(TokenHash.Compute(ch.OwnerToken)) }));
JsonBody(new { id = ch.Id, mode = "raw", settings = new { name = "Rate limit space" }, owner_hash = B64(TokenHash.Compute(ch.OwnerToken)) }));
using var r = await server.Http.SendAsync(req);
statuses.Add((int)r.StatusCode);
}