mirror of
https://github.com/streamwall/streamwall.git
synced 2025-12-06 01:45:37 -05:00
Share token link generation
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
type AuthTokenInfo,
|
type AuthTokenInfo,
|
||||||
type ControlCommandMessage,
|
type ControlCommandMessage,
|
||||||
type ControlUpdateMessage,
|
type ControlUpdateMessage,
|
||||||
|
inviteLink,
|
||||||
roleCan,
|
roleCan,
|
||||||
stateDiff,
|
stateDiff,
|
||||||
type StreamwallRole,
|
type StreamwallRole,
|
||||||
@@ -456,7 +457,11 @@ async function initialInviteCodes({
|
|||||||
)
|
)
|
||||||
console.log(
|
console.log(
|
||||||
'🔑 Admin invite:',
|
'🔑 Admin invite:',
|
||||||
`${baseURL}/invite/${adminToken.tokenId}?token=${adminToken.secret}`,
|
inviteLink({
|
||||||
|
baseURL,
|
||||||
|
tokenId: adminToken.tokenId,
|
||||||
|
secret: adminToken.secret,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
ControlCommand,
|
ControlCommand,
|
||||||
idColor,
|
idColor,
|
||||||
idxInBox,
|
idxInBox,
|
||||||
|
inviteLink,
|
||||||
LocalStreamData,
|
LocalStreamData,
|
||||||
roleCan,
|
roleCan,
|
||||||
StreamData,
|
StreamData,
|
||||||
@@ -804,7 +805,10 @@ export function ControlUI({
|
|||||||
<StyledNewInviteBox>
|
<StyledNewInviteBox>
|
||||||
Invite link created:{' '}
|
Invite link created:{' '}
|
||||||
<a
|
<a
|
||||||
href={`/invite/${newInvite.tokenId}?token=${newInvite.secret}`}
|
href={inviteLink({
|
||||||
|
tokenId: newInvite.tokenId,
|
||||||
|
secret: newInvite.secret,
|
||||||
|
})}
|
||||||
onClick={preventLinkClick}
|
onClick={preventLinkClick}
|
||||||
>
|
>
|
||||||
"{newInvite.name}"
|
"{newInvite.name}"
|
||||||
|
|||||||
@@ -47,3 +47,15 @@ export function roleCan(role: StreamwallRole | null, action: StreamwallAction) {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function inviteLink({
|
||||||
|
baseURL = '',
|
||||||
|
tokenId,
|
||||||
|
secret,
|
||||||
|
}: {
|
||||||
|
baseURL?: string
|
||||||
|
tokenId: string
|
||||||
|
secret: string
|
||||||
|
}) {
|
||||||
|
return `${baseURL}/invite/${tokenId}?token=${secret}`
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user