0

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 <mahmad2000@protonmail.com>
This commit is contained in:
mahmed2000 2024-04-11 01:15:53 +05:00 committed by GitHub
parent 9bbb09c911
commit de8bc8d41b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,12 +135,6 @@ const AddKeyButton = ({ setShowAddKeyForm }) => (
<PlusOutlined /> <PlusOutlined />
</Button> </Button>
); );
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 StreamKeys = () => {
const serverStatusData = useContext(ServerStatusContext); const serverStatusData = useContext(ServerStatusContext);
@ -171,22 +165,22 @@ const StreamKeys = () => {
title: 'Key', title: 'Key',
dataIndex: 'key', dataIndex: 'key',
key: 'key', key: 'key',
render: text => ( render: key => (
<Space direction="horizontal"> <Space direction="horizontal">
<Paragraph <Paragraph
copyable={{ copyable={{
text: showKeyMap[text] ? text : '**********', text: key,
onCopy: () => copyText(text), onCopy: () => message.success('Copied to clipboard'),
}} }}
> >
{showKeyMap[text] ? text : '**********'} {showKeyMap[key] ? key : '**********'}
</Paragraph> </Paragraph>
<Button <Button
type="link" type="link"
style={{ top: '-7px' }} style={{ top: '-7px' }}
icon={<EyeOutlined />} icon={<EyeOutlined />}
onClick={() => handleToggleShowKey(text)} onClick={() => handleToggleShowKey(key)}
/> />
</Space> </Space>
), ),