fix conn key conversion to shse.pubkey
This commit is contained in:
parent
fe72a1a86e
commit
62ad921abb
|
@ -33,7 +33,7 @@ const makeTunnelPlugin = (hubs, local) => (/** @type {any}} */ msConfig) => {
|
|||
pull.drain(async ({ address, key, details }) => {
|
||||
if (!key) return
|
||||
// TODO: once ssb-conn is replaced, we won't need this anymore:
|
||||
const pubkey = bs58.encode(Buffer.from(key, 'base64'))
|
||||
const pubkey = key.slice(1, -8) // not base64, it's @BASE58.ed25519
|
||||
if (hubs.has(pubkey)) return
|
||||
if (!details?.rpc) return
|
||||
if (address.startsWith('tunnel:')) return
|
||||
|
@ -61,7 +61,7 @@ const makeTunnelPlugin = (hubs, local) => (/** @type {any}} */ msConfig) => {
|
|||
pull.drain(({ key }) => {
|
||||
if (!key) return
|
||||
// TODO: once ssb-conn is replaced, we won't need this anymore:
|
||||
const pubkey = bs58.encode(Buffer.from(key, 'base64'))
|
||||
const pubkey = key.slice(1, -8) // not base64, it's @BASE58.ed25519
|
||||
if (!hubs.has(pubkey)) return
|
||||
hubs.get(pubkey)?.close()
|
||||
hubs.delete(pubkey)
|
||||
|
@ -95,6 +95,12 @@ const makeTunnelPlugin = (hubs, local) => (/** @type {any}} */ msConfig) => {
|
|||
|
||||
let hubRPC = hubs.get(hub)?.rpc
|
||||
|
||||
// If no hub found, wait a second and try again
|
||||
if (!hubRPC) {
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
hubRPC = hubs.get(hub)?.rpc
|
||||
}
|
||||
|
||||
// If no hub found, look up hub in connDB and connect to it
|
||||
if (!hubRPC) {
|
||||
for (const [msaddr] of local.conn.db().entries()) {
|
||||
|
|
Loading…
Reference in New Issue