Links provided by dock/overlay buttons are now correct.
This commit is contained in:
parent
be4b0441f0
commit
608351be4e
|
@ -62,3 +62,13 @@ export async function updateBotEnabledForUser(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getOverlayURLForUser(privateUser: PrivateUser) {
|
||||||
|
const controlToken = privateUser?.twitchInfo?.controlToken
|
||||||
|
return `${TWITCH_BOT_PUBLIC_URL}/overlay?t=${controlToken}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDockURLForUser(privateUser: PrivateUser) {
|
||||||
|
const controlToken = privateUser?.twitchInfo?.controlToken
|
||||||
|
return `${TWITCH_BOT_PUBLIC_URL}/dock?t=${controlToken}`
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import {
|
||||||
} from 'web/lib/firebase/users'
|
} from 'web/lib/firebase/users'
|
||||||
import { track } from 'web/lib/service/analytics'
|
import { track } from 'web/lib/service/analytics'
|
||||||
import {
|
import {
|
||||||
|
getDockURLForUser,
|
||||||
|
getOverlayURLForUser,
|
||||||
linkTwitchAccountRedirect,
|
linkTwitchAccountRedirect,
|
||||||
updateBotEnabledForUser,
|
updateBotEnabledForUser,
|
||||||
} from 'web/lib/twitch/link-twitch-account'
|
} from 'web/lib/twitch/link-twitch-account'
|
||||||
|
@ -306,18 +308,18 @@ function SetUpBot(props: {
|
||||||
}) {
|
}) {
|
||||||
const { user, privateUser } = props
|
const { user, privateUser } = props
|
||||||
const twitchLinked = privateUser?.twitchInfo?.twitchName
|
const twitchLinked = privateUser?.twitchInfo?.twitchName
|
||||||
const controlToken = privateUser?.twitchInfo?.controlToken
|
|
||||||
|
|
||||||
const toastTheme = {
|
const toastTheme = {
|
||||||
className: '!bg-primary !text-white',
|
className: '!bg-primary !text-white',
|
||||||
icon: <LinkIcon className="mr-2 h-6 w-6" aria-hidden="true" />,
|
icon: <LinkIcon className="mr-2 h-6 w-6" aria-hidden="true" />,
|
||||||
}
|
}
|
||||||
const copyOverlayLink = async () => {
|
const copyOverlayLink = async () => {
|
||||||
copyToClipboard(`http://localhost:1000/overlay?t=${controlToken}`) //!!!TODO: Fix link
|
if (!privateUser) return
|
||||||
|
copyToClipboard(getOverlayURLForUser(privateUser))
|
||||||
toast.success('Overlay link copied!', toastTheme)
|
toast.success('Overlay link copied!', toastTheme)
|
||||||
}
|
}
|
||||||
const copyDockLink = async () => {
|
const copyDockLink = async () => {
|
||||||
copyToClipboard(`http://localhost:1000/dock?t=${controlToken}`) //!!!TODO: Fix link
|
if (!privateUser) return
|
||||||
|
copyToClipboard(getDockURLForUser(privateUser))
|
||||||
toast.success('Dock link copied!', toastTheme)
|
toast.success('Dock link copied!', toastTheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user