check embed.external.uri in backfill

backfill was only checking post text, missing embed-only link cards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Changed files
+29 -5
src
+25 -4
src/atproto.zig
··· 802 802 uri: []const u8, 803 803 cid: []const u8, 804 804 text: []const u8, 805 + embed_uri: ?[]const u8, 805 806 }; 806 807 807 808 /// fetch recent posts from an author's feed. ··· 813 814 allocator.free(p.uri); 814 815 allocator.free(p.cid); 815 816 allocator.free(p.text); 817 + if (p.embed_uri) |eu| allocator.free(eu); 816 818 } 817 819 posts.deinit(allocator); 818 820 } ··· 858 860 const cid_val = post_obj.get("cid") orelse continue; 859 861 if (cid_val != .string) continue; 860 862 861 - // extract record.text 863 + // extract record 862 864 const record_val = post_obj.get("record") orelse continue; 863 865 if (record_val != .object) continue; 864 - const text_val = record_val.object.get("text") orelse continue; 865 - if (text_val != .string) continue; 866 + 867 + // extract text (may be empty) 868 + const text_val = record_val.object.get("text"); 869 + const text = if (text_val) |tv| (if (tv == .string) tv.string else "") else ""; 870 + 871 + // extract embed.external.uri if present 872 + var embed_uri: ?[]const u8 = null; 873 + if (record_val.object.get("embed")) |embed_val| { 874 + if (embed_val == .object) { 875 + if (embed_val.object.get("external")) |ext_val| { 876 + if (ext_val == .object) { 877 + if (ext_val.object.get("uri")) |eu_val| { 878 + if (eu_val == .string) { 879 + embed_uri = eu_val.string; 880 + } 881 + } 882 + } 883 + } 884 + } 885 + } 866 886 867 887 try posts.append(allocator, .{ 868 888 .uri = try allocator.dupe(u8, uri_val.string), 869 889 .cid = try allocator.dupe(u8, cid_val.string), 870 - .text = try allocator.dupe(u8, text_val.string), 890 + .text = try allocator.dupe(u8, text), 891 + .embed_uri = if (embed_uri) |eu| try allocator.dupe(u8, eu) else null, 871 892 }); 872 893 } 873 894
+4 -1
src/db.zig
··· 414 414 alloc.free(p.uri); 415 415 alloc.free(p.cid); 416 416 alloc.free(p.text); 417 + if (p.embed_uri) |eu| alloc.free(eu); 417 418 } 418 419 alloc.free(posts); 419 420 } 420 421 421 422 var added: usize = 0; 422 423 for (posts) |post| { 423 - if (filter.textContainsMusicLink(post.text)) { 424 + const text_match = filter.textContainsMusicLink(post.text); 425 + const embed_match = if (post.embed_uri) |eu| filter.textContainsMusicLink(eu) else false; 426 + if (text_match or embed_match) { 424 427 addPost(post.uri, post.cid) catch continue; 425 428 added += 1; 426 429 }