API: getFeedRoot()

This commit is contained in:
Andre Staltz 2023-04-10 22:59:55 +03:00
parent 4e334e242c
commit 3a77d02263
1 changed files with 5 additions and 1 deletions

View File

@ -168,9 +168,12 @@ exports.init = function initDB(peer, config) {
} }
function getFeedRoot(findWho, findType) { function getFeedRoot(findWho, findType) {
const findWho_ = findWho.startsWith('ppppp:feed/v1/')
? findWho.substring(16)
: findWho
for (const rec of records()) { for (const rec of records()) {
const { who, type, tangles } = rec.msg.metadata const { who, type, tangles } = rec.msg.metadata
if (who === findWho && type === findType && isEmptyObject(tangles)) { if (who === findWho_ && type === findType && isEmptyObject(tangles)) {
return rec.hash return rec.hash
} }
} }
@ -318,6 +321,7 @@ exports.init = function initDB(peer, config) {
records, records,
getRecord, getRecord,
get, get,
getFeedRoot,
// internal // internal
findEncryptionFormatFor, findEncryptionFormatFor,