fixed the embeds

This commit is contained in:
CatAClock 2025-05-22 16:43:42 -07:00
parent 0471806b7b
commit 57f7f2628e

View file

@ -197,16 +197,16 @@ async function CreateMedia(Media, Element, Author = undefined) {
var Texty = await BlueskyAPI.GetPosts([Media.embed.record.uri]); var Texty = await BlueskyAPI.GetPosts([Media.embed.record.uri]);
console.log(Texty); console.log(Texty);
Element.innerHTML += "<p class='Embed'>" + Texty.posts[0].record.text + "</p><br/>"; Element.innerHTML += "<p class='Embed'>" + Texty.posts[0].record.text + "</p><br/>";
if (Texty.posts[0].embed.$type == "app.bsky.embed.images") { if (Texty.posts[0].record.embed.$type == "app.bsky.embed.images") {
for (let i of Texty.posts[0].embed.images) { for (let i of Texty.posts[0].record.embed.images) {
var Blobby = await BlueskyAPI.GetBlob(Author, i.image.ref.$link); var Blobby = await BlueskyAPI.GetBlob(Texty.posts[0].author.did, i.image.ref.$link);
var ObjectURL = URL.createObjectURL(Blobby); var ObjectURL = URL.createObjectURL(Blobby);
Element.innerHTML += "<img src=" + ObjectURL + " alt='" + i.alt + "'/>"; Element.innerHTML += "<img class='Embed' src=" + ObjectURL + " alt='" + i.alt + "'/>";
} }
} else if (Media.embed.$type == "app.bsky.embed.video") { } else if (Texty.posts[0].record.embed.$type == "app.bsky.embed.video") {
var Blobby = await BlueskyAPI.GetBlob(Author, Texty.posts[0].embed.video.ref.$link); var Blobby = await BlueskyAPI.GetBlob(Texty.posts[0].author.did, Texty.posts[0].record.embed.video.ref.$link);
var ObjectURL = URL.createObjectURL(Blobby); var ObjectURL = URL.createObjectURL(Blobby);
Element.innerHTML += "<video controls src=" + ObjectURL + "></video>"; Element.innerHTML += "<video class='Embed' controls src=" + ObjectURL + "></video>";
} }
// It's not an embed, continue... // It's not an embed, continue...
} else if (Media.embed.$type == "app.bsky.embed.images") { } else if (Media.embed.$type == "app.bsky.embed.images") {