atproto pds in zig pds.zat.dev
pds atproto
24

Configure Feed

Select the types of activity you want to include in your feed.

Fix space permission-set type fallback

zzstoatzz (Jun 8, 2026, 12:04 PM -0500) d861e68b c89afc11

+17 -2
+17 -2
src/atproto/oauth/permission_sets.zig
··· 293 293 var skey_buf: [64][]const u8 = undefined; 294 294 var collection_buf: [64][]const u8 = undefined; 295 295 const maybe_space = try optionalStringArray(permission, "space", &space_type_buf); 296 - const maybe_type = try optionalStringArray(permission, "type", &type_buf); 297 - const maybe_space_types = maybe_space orelse maybe_type; 296 + const maybe_space_types = maybe_space orelse try optionalStringArray(permission, "type", &type_buf); 298 297 const maybe_dids = try optionalStringArray(permission, "did", &did_buf); 299 298 const maybe_skeys = try optionalStringArray(permission, "skey", &skey_buf); 300 299 const maybe_collections = try optionalStringArray(permission, "collection", &collection_buf); ··· 610 609 defer allocator.free(expanded); 611 610 try std.testing.expectEqualStrings("", expanded); 612 611 } 612 + 613 + test "space permission accepts lexicon permission type string when space field is present" { 614 + const allocator = std.testing.allocator; 615 + const text = 616 + \\{"value":{"defs":{"main":{"type":"permission-set","permissions":[{"type":"permission","resource":"space","action":["read","create"],"space":["fm.plyr.stg.privateMedia"],"skey":["self"],"did":["*"],"collection":["fm.plyr.stg.track"]}]}}}} 617 + ; 618 + const parsed = try std.json.parseFromSlice(std.json.Value, allocator, text, .{}); 619 + defer parsed.deinit(); 620 + const main = try mainPermissionSet(parsed); 621 + const expanded = try buildExpandedScope(allocator, "fm.plyr.stg.privateMedia", null, main); 622 + defer allocator.free(expanded); 623 + try std.testing.expectEqualStrings( 624 + "space:fm.plyr.stg.privateMedia?action=read&did=*&skey=self space:fm.plyr.stg.privateMedia?action=create&did=*&skey=self&collection=fm.plyr.stg.track", 625 + expanded, 626 + ); 627 + }