mirror of https://codeberg.org/pzp/pzp-invite.git
parse token=none in join command
This commit is contained in:
parent
f18c329434
commit
8daee8c268
|
@ -68,12 +68,16 @@ function parseJoinCommand(pieces, uri) {
|
||||||
throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub pubkey`)
|
throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub pubkey`)
|
||||||
}
|
}
|
||||||
// TODO: base58 validation for the token, if present at all
|
// 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()
|
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
|
const address = `net:${host}:${port}~${shse}` // TODO: add ws address here
|
||||||
return { type: 'join', address }
|
return { type: 'join', address }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue