this is going well

This commit is contained in:
CatAClock 2025-05-01 15:59:01 -07:00
parent 7b2dc2daf0
commit 1f26ba8d89
2 changed files with 19 additions and 4 deletions

View file

@ -2,9 +2,13 @@ import * as Cookie from "./Cookies.js";
export async function GetBlueskyDID(PDS, Handle) { export async function GetBlueskyDID(PDS, Handle) {
let DPoP = await ClientDPoPPDS("GET", PDS + "/xrpc/com.atproto.identity.resolveDid"); let DPoP = await ClientDPoPPDS("GET", PDS + "/xrpc/com.atproto.identity.resolveDid");
let request = fetch(PDS + "/xrpc/com.atproto.identity.resolveDid?handle=" + Handle, { method: "GET", headers: {"Authorization": "DPoP " + Cookie.BlueskyAccessTokenCookie, "DPoP": DPoP}}) return fetch(PDS + "/xrpc/com.atproto.identity.resolveDid?handle=" + Handle, { method: "GET", headers: {"Authorization": "DPoP " + Cookie.BlueskyAccessTokenCookie, "DPoP": DPoP}});
.then((response) => response.json()); }
return request;
// Added after all the components: in case of nonce mismatch...
export async function FixNonceMismatch(head) {
Cookie.InputCookie(Cookie.BlueskyNonceName, head);
return true;
} }
// Component 1/4 // Component 1/4

View file

@ -95,4 +95,15 @@ async function CheckLogin() {
CheckLogin(); CheckLogin();
// TESTING! // TESTING!
BlueskyAPI.GetBlueskyDID(Cookie.BlueskyPDSName, "crowdedgames.group"); async function TESTING() {
let response = BlueskyAPI.GetBlueskyDID("https://woodear.us-west.host.bsky.network", "crowdedgames.group");
let body = await response.then((res) => res.json());
if (response.status == 401) {
await BlueskyAPI.FixNonceMismatch(response.headers.get("dpop-nonce"));
response = BlueskyAPI.GetBlueskyDID("https://woodear.us-west.host.bsky.network", "crowdedgames.group");
body = await response.then((res) => res.json());
}
console.log(response);
}
TESTING();