From 3a77d022636c15d63e96ecc0394add73996bc5c4 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Mon, 10 Apr 2023 22:59:55 +0300 Subject: [PATCH] API: getFeedRoot() --- lib/plugin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugin.js b/lib/plugin.js index e171236..ee9a94a 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -168,9 +168,12 @@ exports.init = function initDB(peer, config) { } function getFeedRoot(findWho, findType) { + const findWho_ = findWho.startsWith('ppppp:feed/v1/') + ? findWho.substring(16) + : findWho for (const rec of records()) { const { who, type, tangles } = rec.msg.metadata - if (who === findWho && type === findType && isEmptyObject(tangles)) { + if (who === findWho_ && type === findType && isEmptyObject(tangles)) { return rec.hash } } @@ -318,6 +321,7 @@ exports.init = function initDB(peer, config) { records, getRecord, get, + getFeedRoot, // internal findEncryptionFormatFor,