friendship ended with social-app. php is my new best friend

undo some things

Changed files
+17 -22
lib
+17 -22
lib/bskyToucher.php
···
preg_match('/at:\/\/(did:plc:[a-z0-9]+)\/app.bsky.feed.post\/([a-z0-9]+)/', $feed->post, $uriComponents);
$did = $uriComponents[1];
$rkey = $uriComponents[2];
-
return async(fn() => $this->getPost($did, $rkey, true));
+
return $this->getPost($did, $rkey, true);
}, $body->feed)));
return $res;
···
}
function getReplyRecords(string $post):array {
-
$ret = $this->getConstellationLinkData($post, "app.bsky.feed.post", ".reply.root.uri");
+
/*$ret = $this->getConstellationLinkData($post, "app.bsky.feed.post", ".reply.root.uri");
if ($ret) {
-
return await(all(array_map(function ($rec) {
-
return async(fn() => $this->sanitizePost($this->getSlingshotData($rec->did, $rec->collection, $rec->rkey, ['reverse' => true]), true));
-
}, $ret->linking_records)));
-
}
+
return array_map(function ($rec) {
+
$slingshotRecord = $this->getSlingshotData($rec->did, $rec->collection, $rec->rkey, ['reverse' => true]);
+
return $this->sanitizePost($slingshotRecord, true);
+
}, $ret->linking_records);
+
}*/
return [];
}
···
$uriComponents = $this->splitAtUri($p->uri);
$cache = \requestPostCache($uriComponents->rkey);
if ($cache) return $this->sanitizeCachedPost($cache);
-
return async(fn() => $this->getPost($uriComponents->did, $uriComponents->rkey, true));
+
$post = $this->getPost($uriComponents->did, $uriComponents->rkey, true);
+
return $post;
}, $postData->records)));
return $postData;
}
···
$rkey = $uriComponents[2];
$authorInfo = $this->getUserInfo($did, 'did');
$facets = property_exists($post->value, 'facets') ? $this->sanitizeFacets($post->value->facets) : [];
-
$waitingFor = await(all([
-
'authorInfo' => async(fn() => $this->getUserInfo($did, 'did')),
-
'replyCount' => async(fn() => $this->getReplies($post->uri)),
-
'repostCount' => async(fn() => $this->getReposts($post->uri)),
-
'likeCount' => async(fn() => $this->getLikes($post->uri)),
-
'quoteCount' => async(fn() => $this->getQuotes($post->uri))
-
]));
$ret = (object) [
'author' => (object) [
-
'displayName' => $waitingFor['authorInfo']->displayName,
-
'handle' => $waitingFor['authorInfo']->handle,
-
'avatar' => $waitingFor['authorInfo']->avatar,
+
'displayName' => $authorInfo->displayName,
+
'handle' => $authorInfo->handle,
+
'avatar' => $authorInfo->avatar,
'did' => $did,
-
'profileLink' => '/u/'.$waitingFor['authorInfo']->handle,
+
'profileLink' => '/u/'.$authorInfo->handle,
],
'uri' => $post->uri,
'pds' => $authorInfo->pds,
'postId' => $rkey,
'postLink' => '/u/'.$authorInfo->handle.'/'.$rkey,
'content' => property_exists($post->value, 'text') ? $this->applyFacets($post->value->text, $facets) : '',
-
'replyCount' => $waitingFor['replyCount'],
-
'repostCount' => $waitingFor['repostCount'],
-
'likeCount' => $waitingFor['likeCount'],
-
'quoteCount' => $waitingFor['quoteCount'],
+
'replyCount' => $this->getReplies($post->uri),
+
'repostCount' => $this->getReposts($post->uri),
+
'likeCount' => $this->getLikes($post->uri),
+
'quoteCount' => $this->getQuotes($post->uri),
'createdAt' => $post->value->createdAt,
'embedType' => property_exists($post->value, 'embed') ? $post->value->embed->{'$type'} : null,
'embeds' => property_exists($post->value, 'embed') ? $this->sanitizeEmbeds($post->value->embed, $authorInfo) : [],