From de8bc8d41b89770599ecc030fd3362a9be08e7e2 Mon Sep 17 00:00:00 2001 From: mahmed2000 <49453542+mahmed2000@users.noreply.github.com> Date: Thu, 11 Apr 2024 01:15:53 +0500 Subject: [PATCH] Fix for copying stream key without revealing it only copies asterisks (#3663) * asterisk copy fix for #3460 * rename text to keys for consistency + linting fix * make onCopy spawn an antd message directly, remove redundant copyText function --------- Co-authored-by: Muaz Ahmad --- .../admin/config/server/StreamKeys.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/web/components/admin/config/server/StreamKeys.tsx b/web/components/admin/config/server/StreamKeys.tsx index 3c96b4f2a..22d1e6118 100644 --- a/web/components/admin/config/server/StreamKeys.tsx +++ b/web/components/admin/config/server/StreamKeys.tsx @@ -135,12 +135,6 @@ const AddKeyButton = ({ setShowAddKeyForm }) => ( ); -const copyText = (text: string) => { - navigator.clipboard - .writeText(text) - .then(() => message.success('Copied to clipboard')) - .catch(() => message.error('Failed to copy to clipboard')); -}; const StreamKeys = () => { const serverStatusData = useContext(ServerStatusContext); @@ -171,22 +165,22 @@ const StreamKeys = () => { title: 'Key', dataIndex: 'key', key: 'key', - render: text => ( + render: key => ( copyText(text), + text: key, + onCopy: () => message.success('Copied to clipboard'), }} > - {showKeyMap[text] ? text : '**********'} + {showKeyMap[key] ? key : '**********'}