mirror of https://codeberg.org/pzp/pzp-db.git
API: getFeedRoot()
This commit is contained in:
parent
4e334e242c
commit
3a77d02263
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue