From 642782a36c6263ecc638abfcbb943b2900c4536f Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 5 Feb 2023 20:08:14 -0800 Subject: [PATCH] Remove admin password generation+copy button. Add auto-generating stream keys. Closes #2683 and #2631 --- web/components/admin/EditInstanceDetails2.tsx | 45 +------------------ .../admin/config/server/StreamKeys.tsx | 8 +++- 2 files changed, 8 insertions(+), 45 deletions(-) diff --git a/web/components/admin/EditInstanceDetails2.tsx b/web/components/admin/EditInstanceDetails2.tsx index f27f8e5d1..beec9de4f 100644 --- a/web/components/admin/EditInstanceDetails2.tsx +++ b/web/components/admin/EditInstanceDetails2.tsx @@ -1,6 +1,5 @@ import React, { useState, useContext, useEffect } from 'react'; -import { Button, Collapse, Typography, Tooltip } from 'antd'; -import dynamic from 'next/dynamic'; +import { Collapse, Typography } from 'antd'; import { TEXTFIELD_TYPE_NUMBER, TEXTFIELD_TYPE_PASSWORD, TEXTFIELD_TYPE_URL } from './TextField'; import { TextFieldWithSubmit } from './TextFieldWithSubmit'; import { ServerStatusContext } from '../../utils/server-status-context'; @@ -15,16 +14,6 @@ import { import { UpdateArgs } from '../../types/config-section'; import { ResetYP } from './ResetYP'; -// Lazy loaded components - -const CopyOutlined = dynamic(() => import('@ant-design/icons/CopyOutlined'), { - ssr: false, -}); - -const RedoOutlined = dynamic(() => import('@ant-design/icons/RedoOutlined'), { - ssr: false, -}); - const { Panel } = Collapse; // eslint-disable-next-line react/function-component-definition @@ -38,10 +27,6 @@ export default function EditInstanceDetails() { const { adminPassword, ffmpegPath, rtmpServerPort, webServerPort, yp, socketHostOverride } = serverConfig; - const [copyIsVisible, setCopyVisible] = useState(false); - - const COPY_TOOLTIP_TIMEOUT = 3000; - useEffect(() => { setFormDataValues({ adminPassword, @@ -79,22 +64,6 @@ export default function EditInstanceDetails() { } }; - function generateStreamKey() { - let key = ''; - for (let i = 0; i < 3; i += 1) { - key += Math.random().toString(36).substring(2); - } - - handleFieldChange({ fieldName: 'streamKey', value: key }); - } - - function copyStreamKey() { - navigator.clipboard.writeText(formDataValues.streamKey).then(() => { - setCopyVisible(true); - setTimeout(() => setCopyVisible(false), COPY_TOOLTIP_TIMEOUT); - }); - } - return (
@@ -108,18 +77,6 @@ export default function EditInstanceDetails() { onChange={handleFieldChange} onSubmit={showStreamKeyChangeMessage} /> -
- -
- +