Need to see console

This commit is contained in:
CatAClock 2025-07-16 20:54:31 -07:00
parent 013839b8a1
commit 3f27873fcf
2 changed files with 32 additions and 0 deletions

View file

@ -100,6 +100,23 @@ export async function GetPosts(URIs) {
return body;
}
export async function GetPostThread(URI) {
if (Token == null) {
return "";
}
let FetchThing = localStorage.getItem(Variables.BlueskyPDS) + "/xrpc/app.bsky.feed.getPostThread?uri=" + URI;
let DPoP = await ClientDPoPPDS("GET", FetchThing);
let request = fetch(FetchThing, { method: "GET", headers: {"Authorization": "DPoP " + Token, "DPoP": DPoP}});
let body = await request.then((response) => response.json());
let status = await request.then((response) => response.status);
let header = await request.then((response) => response.headers.get("dpop-nonce"));
if (status == 401) {
await HandleError(body, header);
body = await GetPostThread(URI);
}
return body;
}
// Get a blob (like an image or video). Authentication need not apply.
export async function GetBlob(DID, CID) {
let request = fetch("https://bsky.social/xrpc/com.atproto.sync.getBlob?did=" + DID + "&cid=" + CID, {method: "GET"});

View file

@ -182,6 +182,21 @@ async function GetPost() {
}
NumberOfThreads += 1;
}
// Replies, anyone?
let Context = await BlueskyAPI.GetPostThread(post.record.uri);
console.log(Context);
for (let i of Context.descendants) {
TemporaryPost = await BlueskyReplyFunction(NumberOfThreads, i);
ThreadedPost.push(TemporaryPost);
// Any posts? Give them the thing :3
for (let j of document.getElementsByClassName(NumberOfThreads)) {
let TempID = NumberOfThreads;
j.onclick = (event) => {
SetThreadPost(ThreadedPost[TempID], j);
}
}
NumberOfThreads += 1;
}
} else {
document.getElementsByClassName("PostText")[0].innerHTML = "Nothing to load.";
}