mirror of https://codeberg.org/pzp/pzp-hub.git
no event.parsedAddress
This commit is contained in:
parent
96429e4af4
commit
a63a54987d
|
@ -1,4 +1,3 @@
|
|||
const bs58 = require('bs58')
|
||||
const cat = require('pull-cat')
|
||||
const Notify = require('pull-notify')
|
||||
const pull = require('pull-stream')
|
||||
|
@ -19,13 +18,16 @@ function ErrorDuplex(message) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {Array<[any, any]>} parsedAddress
|
||||
* @param {string} addresses
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
function extractSHSEPubkey(parsedAddress) {
|
||||
for (const [transport, transform] of parsedAddress) {
|
||||
if (transform.name === 'shse') {
|
||||
return bs58.encode(transform.pubkey)
|
||||
function extractSHSEPubkey(addresses) {
|
||||
for (const address of addresses.split(';')) {
|
||||
for (const [transport, transform] of address.split('~')) {
|
||||
const [name, pubkey, extra] = transform.split(':')
|
||||
if (name === 'shse') {
|
||||
return pubkey
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +84,7 @@ module.exports = {
|
|||
pull.filter(
|
||||
({ type }) => type === 'connecting-failed' || type === 'disconnected'
|
||||
),
|
||||
pull.map(({ parsedAddress }) => extractSHSEPubkey(parsedAddress)),
|
||||
pull.map(({ address }) => extractSHSEPubkey(address)),
|
||||
pull.filter((pubkey) => !!pubkey && attendants.has(pubkey)),
|
||||
pull.drain((pubkey) => {
|
||||
debug('farewell %s', pubkey)
|
||||
|
|
Loading…
Reference in New Issue