perlsky is a Perl 5 implementation of an AT Protocol Personal Data Server.
13
fork

Configure Feed

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

Proxy remote quote appview reads upstream

alice 75a51b94 67249bce

+44
+9
lib/ATProto/PDS/ServiceProxy/Threads.pm
··· 48 48 cursor => $c->param('cursor'), 49 49 reverse => 1, 50 50 ); 51 + return undef if grep { _post_requires_upstream($self, $c, $_) } @{ $page->{items} || [] }; 51 52 my $profile_value = $self->_profile_record_value($c, $account); 52 53 my @feed = map { 53 54 +{ ··· 80 81 } 81 82 return undef unless defined $resolved; 82 83 my ($account, $row) = @$resolved; 84 + return undef if _post_requires_upstream($self, $c, $row); 83 85 my $canonical_uri = $self->_post_uri($account, $row); 84 86 next if $seen_uri{$canonical_uri}++; 85 87 push @resolved, $resolved; ··· 159 161 return 1 if !$resolved || $@; 160 162 } 161 163 return 0; 164 + } 165 + 166 + sub _post_requires_upstream ($self, $c, $row) { 167 + my $quoted_uri = $self->_quoted_uri($row->{value}); 168 + return 0 unless defined $quoted_uri && length $quoted_uri; 169 + my $resolved = eval { $self->_resolve_local_post_uri($c, $quoted_uri) }; 170 + return !$resolved || $@ ? 1 : 0; 162 171 } 163 172 164 173 sub _thread_view ($self, $c, $account, $row, $profile_value = undef, $viewer = undef, $depth = 6, $parent_height = 80) {
+35
t/service-proxy.t
··· 468 468 ok(!exists($t->tx->res->json->{feed}[0]{post}{replyCount}), 'local post view omits non-authoritative replyCount'); 469 469 ok(!exists($t->tx->res->json->{feed}[0]{post}{likeCount}), 'local post view omits non-authoritative likeCount'); 470 470 471 + $t->post_ok('/xrpc/com.atproto.repo.createRecord' => { 472 + Authorization => "Bearer $access", 473 + } => json => { 474 + repo => $did, 475 + collection => 'app.bsky.feed.post', 476 + rkey => 'quoted-remote', 477 + record => { 478 + '$type' => 'app.bsky.feed.post', 479 + text => 'quoted remote post', 480 + embed => { 481 + '$type' => 'app.bsky.embed.record', 482 + record => { 483 + uri => 'at://did:plc:remote/app.bsky.feed.post/quoted', 484 + cid => 'bafyremote-quoted', 485 + }, 486 + }, 487 + createdAt => '2026-03-10T18:01:00Z', 488 + }, 489 + })->status_is(200) 490 + ->json_has('/uri'); 491 + 492 + my $quoted_remote_uri = $t->tx->res->json->{uri}; 493 + 494 + $t->get_ok("/xrpc/app.bsky.feed.getAuthorFeed?actor=$did&limit=10" => { 495 + Authorization => "Bearer $access", 496 + })->status_is(200) 497 + ->json_is('/nsid' => 'app.bsky.feed.getAuthorFeed'); 498 + ok($t->tx->res->json->{auth}, 'author feed proxies upstream when quoted remote records need non-local context'); 499 + 500 + $t->get_ok('/xrpc/app.bsky.feed.getPosts?uris=' . _uri_escape($quoted_remote_uri) => { 501 + Authorization => "Bearer $access", 502 + })->status_is(200) 503 + ->json_is('/nsid' => 'app.bsky.feed.getPosts'); 504 + ok($t->tx->res->json->{auth}, 'getPosts proxies upstream when quoted remote records need non-local context'); 505 + 471 506 $t->get_ok('/xrpc/app.bsky.feed.getPostThread?uri=' . _uri_escape($post_uri) => { 472 507 Authorization => "Bearer $access", 473 508 })->status_is(200)