mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-25 12:55:43 +00:00
Merge 3a7a056c20
into e30698f12f
This commit is contained in:
commit
a30f30d67d
@ -528,8 +528,9 @@ class BlueskyBridge extends BridgeAbstract
|
|||||||
$postType = isset($postRecord['reply']) ? 'reply' : 'post';
|
$postType = isset($postRecord['reply']) ? 'reply' : 'post';
|
||||||
$description .= "Replying to <b>$postDisplayName</b> $postAuthorHandle's <a href=\"$postUri\">$postType</a>:<br>";
|
$description .= "Replying to <b>$postDisplayName</b> $postAuthorHandle's <a href=\"$postUri\">$postType</a>:<br>";
|
||||||
} else {
|
} else {
|
||||||
// aaa @aaa.com posted:
|
// aaa @aaa.com posted/replied:
|
||||||
$description .= "<b>$postDisplayName</b> $postAuthorHandle <a href=\"$postUri\">posted</a>:<br>";
|
$postType = isset($postRecord['reply']) ? 'replied' : 'posted';
|
||||||
|
$description .= "<b>$postDisplayName</b> $postAuthorHandle <a href=\"$postUri\">$postType</a>:<br>";
|
||||||
}
|
}
|
||||||
$description .= $this->textToDescription($postRecord);
|
$description .= $this->textToDescription($postRecord);
|
||||||
return $description;
|
return $description;
|
||||||
@ -555,10 +556,20 @@ class BlueskyBridge extends BridgeAbstract
|
|||||||
//use "Post by A, replying to B, quoting C" instead of post contents
|
//use "Post by A, replying to B, quoting C" instead of post contents
|
||||||
$title = '';
|
$title = '';
|
||||||
if (isset($post['reason']) && str_contains($post['reason']['$type'], 'reasonRepost')) {
|
if (isset($post['reason']) && str_contains($post['reason']['$type'], 'reasonRepost')) {
|
||||||
$title .= 'Repost by ' . $this->fallbackAuthor($post['reason']['by'], 'display') . ', post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
|
$title .= 'Repost by ' . $this->fallbackAuthor($post['reason']['by'], 'display');
|
||||||
|
if (isset($post['reply'])) {
|
||||||
|
$title .= ', reply by ';
|
||||||
|
} else {
|
||||||
|
$title .= ', post by ';
|
||||||
|
}
|
||||||
|
$title .= $this->fallbackAuthor($post['post']['author'], 'display');
|
||||||
|
} else {
|
||||||
|
if (isset($post['reply'])) {
|
||||||
|
$title .= 'Reply by ' . $this->fallbackAuthor($post['post']['author'], 'display');
|
||||||
} else {
|
} else {
|
||||||
$title .= 'Post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
|
$title .= 'Post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($post['reply'])) {
|
if (isset($post['reply'])) {
|
||||||
if (isset($post['reply']['parent']['blocked'])) {
|
if (isset($post['reply']['parent']['blocked'])) {
|
||||||
@ -595,15 +606,21 @@ class BlueskyBridge extends BridgeAbstract
|
|||||||
|
|
||||||
private function resolveHandle($handle)
|
private function resolveHandle($handle)
|
||||||
{
|
{
|
||||||
$uri = 'https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=' . urlencode($handle);
|
$url = 'https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=' . urlencode($handle);
|
||||||
$response = json_decode(getContents($uri), true);
|
$response = $this->loadCacheValue($url) ?? json_decode(getContents($url), true);
|
||||||
|
if (isset($response['did'])) {
|
||||||
|
$this->saveCacheValue($url, $response, 604800);
|
||||||
|
}
|
||||||
return $response['did'];
|
return $response['did'];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getProfile($did)
|
private function getProfile($did)
|
||||||
{
|
{
|
||||||
$uri = 'https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=' . urlencode($did);
|
$url = 'https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=' . urlencode($did);
|
||||||
$response = json_decode(getContents($uri), true);
|
$response = $this->loadCacheValue($url) ?? json_decode(getContents($url), true);
|
||||||
|
if ($response['did'] === $did ?? false) {
|
||||||
|
$this->saveCacheValue($url, $response);
|
||||||
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user