Compare commits

...

2 Commits

1 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,7 @@ addHandler("registrySubscription", handleRegistrySubscription, {
receiveUpdates: true,
});
addHandler("cat", handleCat);
addHandler("stat", handleStat);
async function handlePresentKey(aq: ActiveQuery) {
handlePresentKeyModule({
@ -197,3 +198,16 @@ async function handleCat(aq: ActiveQuery) {
aq.reject(e);
}
}
async function handleStat(aq: ActiveQuery) {
if (!("cid" in aq.callerInput)) {
aq.reject("cid required");
return;
}
try {
const ret = await node.getMetadataByCID(aq.callerInput.cid);
aq.respond(ret.toJson());
} catch (e) {
aq.reject(e);
}
}