Compare commits

..

2 Commits

1 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,7 @@ BigInt.prototype.toJSON = function () {
}; };
addHandler("presentSeed", handlePresentSeed); addHandler("presentSeed", handlePresentSeed);
addHandler("ready", handleReady);
addHandler("stat", handleStat); addHandler("stat", handleStat);
addHandler("ls", handleLs, { receiveUpdates: true }); addHandler("ls", handleLs, { receiveUpdates: true });
addHandler("cat", handleCat, { receiveUpdates: true }); addHandler("cat", handleCat, { receiveUpdates: true });
@ -220,6 +221,12 @@ async function handlePresentSeed() {
moduleDefer.resolve(); moduleDefer.resolve();
} }
async function handleReady(aq: ActiveQuery) {
await ready();
aq.respond();
}
async function handleStat(aq: ActiveQuery) { async function handleStat(aq: ActiveQuery) {
await ready(); await ready();
@ -339,6 +346,10 @@ async function handleIpnsResolve(aq: ActiveQuery) {
} }
function getCID(cid: string): CID { function getCID(cid: string): CID {
try {
return CID.parse(cid);
} catch {}
const prefix = substr(cid, 0, 1); const prefix = substr(cid, 0, 1);
if (!(prefix in basesByPrefix)) { if (!(prefix in basesByPrefix)) {