···
namespace Smallnest\BskyOps;
4
+
require_once('config.php');
require_once('vendor/autoload.php');
require_once('lib/bskyProvider.php');
···
$embeds = $this->renderEmbeds($post->embedType, $post->embeds, $post);
$imageEmbedClass = $post->embedType === "images" ? " img-".count($post->embeds) : "";
66
+
<div class="post" data-cursor="$post->cursor">
<a href="$profileLink"><img src="$post->avatar" /></a>
···
function renderEmbeds($type, $embeds, $context) {
if ($type === 'images') {
$imageCount = count($embeds);
foreach ($embeds as $embed) {
···
} else if ($type === 'video') {
$thumb = $embeds[0]->thumb;
$vid = $embeds[0]->video;
113
+
$author = $context->did;
114
+
$pds = DEFAULT_PDS;
115
-
<video poster="$thumb" src="$vid" controls type="application/x-mpegURL" />
118
+
src="$pds/xrpc/com.atproto.sync.getBlob?did=$author&cid=$vid"
} else if ($type === 'external') {
124
+
$title = $embeds[0]->title;
125
+
$uri = $embeds[0]->uri;
126
+
$thumb = $embeds[0]->thumb;
127
+
$desc = $embeds[0]->description;
<div class="externalLink">
121
-
<a href="$embeds[0]->uri" rel="external" target="_blank">
130
+
<a href="$uri" rel="external" target="_blank">
<div class="externalLinkImage">
123
-
<img src="$embeds[0]->thumb" alt="$embeds[0]->title" />
132
+
<img src="$thumb" alt="$title" />
<div class="externalLinkInfo">
126
-
<div class="externalLinkTitle">$embeds[0]->title</div>
127
-
<div class="externalLinkDesc">$embeds[0]->description</div>
128
-
<div class="externalLinkUri">$embeds[0]->uri</div>
135
+
<div class="externalLinkTitle">$title</div>
136
+
<div class="externalLinkDesc">$desc</div>
137
+
<div class="externalLinkUri">$uri</div>
···
$feedData = json_decode(file_get_contents($this->bskyApiBase.$this->apiEndpoints['getFeed']."?feed=".$atUri));
144
-
$feed = array_map(function($f) {
153
+
$cursor = $feedData->cursor;
154
+
$feed = array_map(function($f) use ($cursor) {
preg_match('/\/([a-z0-9]+)$/', $post->uri, $postIdRegex);
···
} elseif ($post->embed->{'$type'} === 'app.bsky.embed.video#view') {
178
-
"video" => $post->embed->playlist,
188
+
"video" => $post->embed->cid,
"thumb" => $post->embed->thumbnail
···
'displayName' => $post->author->displayName,
'handle' => $post->author->handle,
201
+
'did' => $post->author->did,
'avatar' => $post->author->avatar,
'content' => $post->record->text,
···
'quoteCount' => $post->quoteCount,
'createdAt' => $post->record->createdAt,
'embedType' => $embedType,
201
-
'embeds' => $embeds
212
+
'embeds' => $embeds,
213
+
'cursor' => $cursor