@@ -255,6 +255,10 @@ public function collectData()
255
255
$ description .= '<a href=" ' . $ uri_reconstructed . '">Quoted post detached.</a> ' ;
256
256
} elseif (isset ($ quotedRecord ['blocked ' ]) && $ quotedRecord ['blocked ' ]) { //blocked by quote author
257
257
$ description .= 'Author of quoted post has blocked OP. ' ;
258
+ } elseif (($ quotedRecord ['$type ' ] ?? '' ) === 'app.bsky.feed.defs#generatorView ' ) {
259
+ $ description .= '</p> ' ;
260
+ $ description .= $ this ->getGeneratorViewDescription ($ quotedRecord );
261
+ $ description .= '<p> ' ;
258
262
} else {
259
263
$ quotedAuthorDid = $ quotedRecord ['author ' ]['did ' ];
260
264
$ quotedDisplayName = $ quotedRecord ['author ' ]['displayName ' ] ?? '' ;
@@ -399,6 +403,10 @@ public function collectData()
399
403
$ description .= '<a href=" ' . $ uri_reconstructed . '">Quoted post detached.</a> ' ;
400
404
} elseif (isset ($ replyQuotedRecord ['blocked ' ]) && $ replyQuotedRecord ['blocked ' ]) { //blocked by quote author
401
405
$ description .= 'Author of quoted post has blocked OP. ' ;
406
+ } elseif (($ replyQuotedRecord ['$type ' ] ?? '' ) === 'app.bsky.feed.defs#generatorView ' ) {
407
+ $ description .= '</p> ' ;
408
+ $ description .= $ this ->getGeneratorViewDescription ($ replyQuotedRecord );
409
+ $ description .= '<p> ' ;
402
410
} else {
403
411
$ quotedAuthorDid = $ replyQuotedRecord ['author ' ]['did ' ];
404
412
$ quotedDisplayName = $ replyQuotedRecord ['author ' ]['displayName ' ] ?? '' ;
@@ -584,4 +592,29 @@ private function getAuthorFeed($did, $filter)
584
592
$ response = json_decode (getContents ($ uri ), true );
585
593
return $ response ;
586
594
}
595
+
596
+ private function getGeneratorViewDescription (array $ record ): string
597
+ {
598
+ $ avatar = e ($ record ['avatar ' ]);
599
+ $ displayName = e ($ record ['displayName ' ]);
600
+ $ displayHandle = e ($ record ['creator ' ]['handle ' ]);
601
+ $ likeCount = e ($ record ['likeCount ' ]);
602
+ preg_match ('/\/([^\/]+)$/ ' , $ record ['uri ' ], $ matches );
603
+ $ uri = e ('https://bsky.app/profile/ ' . $ record ['creator ' ]['did ' ] . '/feed/ ' . $ matches [1 ]);
604
+
605
+ return <<<END
606
+ <a href=" {$ uri }" style="color: inherit;">
607
+ <div style="border: 1px solid #333; padding: 10px;">
608
+ <div style="display: flex; margin-bottom: 10px;">
609
+ <img src=" {$ avatar }" height="50" width="50" style="margin-right: 10px;">
610
+ <div style="display: flex; flex-direction: column; justify-content: center;">
611
+ <h3> {$ displayName }</h3>
612
+ <span>Feed by @ {$ displayHandle }</span>
613
+ </div>
614
+ </div>
615
+ <span>Liked by {$ likeCount } users</span>
616
+ </div>
617
+ </a>
618
+ END ;
619
+ }
587
620
}
0 commit comments