parse token=none in join command

This commit is contained in:
Andre Staltz 2024-01-09 10:39:26 +02:00
parent f18c329434
commit 8daee8c268
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 5 additions and 1 deletions

View File

@ -68,12 +68,16 @@ function parseJoinCommand(pieces, uri) {
throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub pubkey`)
}
// TODO: base58 validation for the token, if present at all
if (!token) {
// prettier-ignore
throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub token`)
}
pieces.shift()
pieces.shift()
pieces.shift()
pieces.shift()
pieces.shift()
const shse = token ? `shse:${pubkey}:${token}` : `shse:${pubkey}`
const shse = token === 'none' ? `shse:${pubkey}` : `shse:${pubkey}:${token}`
const address = `net:${host}:${port}~${shse}` // TODO: add ws address here
return { type: 'join', address }
}