This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.3 kB View raw
1const repo = "did:plc:qsctypxlsrippb5wculrsj7q"; 2const host = "knot1.tangled.sh"; 3async function get(path) { 4 const ctrl = new AbortController(); 5 const t = setTimeout(() => ctrl.abort(), 10000); 6 try { 7 const resp = await fetch(`https://${host}${path}`, { signal: ctrl.signal, headers: { accept: "application/json" } }); 8 const txt = await resp.text(); 9 return { status: resp.status, txt }; 10 } finally { clearTimeout(t); } 11} 12// Full tree (does it include a readme field? top-level keys?) 13const full = await get(`/xrpc/sh.tangled.repo.tree?repo=${repo}&ref=trunk&path=`); 14let j; try { j = JSON.parse(full.txt); } catch {} 15console.log("tree top-level keys:", j ? Object.keys(j) : "(parse fail)"); 16console.log("file names:", (j?.files || []).map((f) => f.name)); 17console.log("has top-level 'readme' key:", j && "readme" in j, "->", JSON.stringify(j?.readme)?.slice(0, 120)); 18// Without ref 19const noref = await get(`/xrpc/sh.tangled.repo.tree?repo=${repo}&path=`); 20console.log("\ntree WITHOUT ref: status", noref.status, "->", noref.txt.slice(0, 120).replace(/\n/g, " ")); 21// Empty ref 22const emptyref = await get(`/xrpc/sh.tangled.repo.tree?repo=${repo}&ref=&path=`); 23console.log("tree EMPTY ref: status", emptyref.status, "->", emptyref.txt.slice(0, 120).replace(/\n/g, " "));