mirror of https://codeberg.org/pzp/pzp-hub.git
monkey patch base64 IDs to base58 for now
This commit is contained in:
parent
f2296cfae0
commit
11fa0eba58
|
@ -1,3 +1,4 @@
|
|||
const bs58 = require('bs58')
|
||||
const cat = require('pull-cat')
|
||||
const Notify = require('pull-notify')
|
||||
const pull = require('pull-stream')
|
||||
|
@ -81,11 +82,12 @@ module.exports = {
|
|||
|
||||
return {
|
||||
attendants() {
|
||||
const clientId = this.id
|
||||
if (clientId && clientId !== sstack.id) {
|
||||
debug('welcome %s', clientId)
|
||||
if (!attendants.has(clientId)) {
|
||||
attendants.set(clientId, sstack.peers[clientId][0])
|
||||
const clientPubkey = bs58.encode(Buffer.from(this.id, 'base64'))
|
||||
const clientRPC = sstack.peers[this.id][0]
|
||||
if (clientPubkey && clientPubkey !== sstack.pubkey) {
|
||||
debug('welcome %s', clientPubkey)
|
||||
if (!attendants.has(clientPubkey)) {
|
||||
attendants.set(clientPubkey, clientRPC)
|
||||
notifyAttendants([...attendants.keys()])
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +104,7 @@ module.exports = {
|
|||
if (attendants.has(target)) {
|
||||
// prettier-ignore
|
||||
debug('received tunnel request for target %s from %s', target, this.id)
|
||||
const origin = this.id
|
||||
const origin = bs58.encode(Buffer.from(this.id, 'base64'))
|
||||
return attendants.get(target).hubClient.connect(origin, () => {})
|
||||
} else {
|
||||
// prettier-ignore
|
||||
|
|
Loading…
Reference in New Issue