From 608351be4e7182b7af4b85c4afaddf6aaea24a4c Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 16 Sep 2022 13:51:10 +0100 Subject: [PATCH] Links provided by dock/overlay buttons are now correct. --- web/lib/twitch/link-twitch-account.ts | 10 ++++++++++ web/pages/twitch.tsx | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web/lib/twitch/link-twitch-account.ts b/web/lib/twitch/link-twitch-account.ts index 71bc847d..c9c704eb 100644 --- a/web/lib/twitch/link-twitch-account.ts +++ b/web/lib/twitch/link-twitch-account.ts @@ -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}` +} diff --git a/web/pages/twitch.tsx b/web/pages/twitch.tsx index bd745a91..158d8e20 100644 --- a/web/pages/twitch.tsx +++ b/web/pages/twitch.tsx @@ -24,6 +24,8 @@ import { } from 'web/lib/firebase/users' import { track } from 'web/lib/service/analytics' import { + getDockURLForUser, + getOverlayURLForUser, linkTwitchAccountRedirect, updateBotEnabledForUser, } from 'web/lib/twitch/link-twitch-account' @@ -306,18 +308,18 @@ function SetUpBot(props: { }) { const { user, privateUser } = props const twitchLinked = privateUser?.twitchInfo?.twitchName - const controlToken = privateUser?.twitchInfo?.controlToken - const toastTheme = { className: '!bg-primary !text-white', icon: