diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e569f9..f2f9f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for EventSub Websocket subscriptions on Twitch, making Twitch integration fully in-app without having to rely on third party servers. Check the "Events" tab in Twitch configuration for setting it up. The new keys for redeems are `twitch/ev/eventsub-event` and `twitch/eventsub-history`. History has been reduced to 50 to alleviate memory concerns. - Application logs are now visible from the UI, check the little floating boxes in the top right! - A new app icon drawn by [Sonic_chan](https://twitter.com/Sonic__Chan), say hello to Renko, strimertul's mascot! +- Hidden fields (Client secret, Kilovolt password) now have a "Reveal" toggle to show the hidden value ### Changed diff --git a/frontend/src/locale/en/translation.json b/frontend/src/locale/en/translation.json index 8081263..168d4c0 100644 --- a/frontend/src/locale/en/translation.json +++ b/frontend/src/locale/en/translation.json @@ -261,7 +261,9 @@ "add": "Add", "warning-delete": "This cannot be undone", "create": "Create", - "submit": "Submit" + "submit": "Submit", + "password-reveal": "Reveal", + "password-hide": "Hide" }, "debug": { "dev-build": "Development build" diff --git a/frontend/src/ui/components/utils/PasswordField.tsx b/frontend/src/ui/components/utils/PasswordField.tsx new file mode 100644 index 0000000..7f56289 --- /dev/null +++ b/frontend/src/ui/components/utils/PasswordField.tsx @@ -0,0 +1,23 @@ +import React from 'react'; + +export interface PasswordFieldProps { + reveal: boolean; +} + +function PasswordField( + props: PasswordFieldProps & + React.PropsWithChildren< + React.DetailedHTMLProps< + React.InputHTMLAttributes, + HTMLInputElement + > + >, +) { + return ( + + {props.children} + + ); +} + +export default React.memo(PasswordField); diff --git a/frontend/src/ui/components/utils/RevealLink.tsx b/frontend/src/ui/components/utils/RevealLink.tsx new file mode 100644 index 0000000..61064e4 --- /dev/null +++ b/frontend/src/ui/components/utils/RevealLink.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { Button } from '../../theme'; + +export interface RevealLinkProps { + value: boolean; + setter: (newValue: boolean) => void; +} + +function RevealLink({ value, setter }: RevealLinkProps) { + const { t } = useTranslation(); + const text = value + ? t('form-actions.password-hide') + : t('form-actions.password-reveal'); + return ( + + ); +} + +export default React.memo(RevealLink); diff --git a/frontend/src/ui/pages/ServerSettings.tsx b/frontend/src/ui/pages/ServerSettings.tsx index 96ab9a0..3270fd3 100644 --- a/frontend/src/ui/pages/ServerSettings.tsx +++ b/frontend/src/ui/pages/ServerSettings.tsx @@ -1,8 +1,9 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useModule, useStatus } from '../../lib/react-utils'; import { useAppDispatch } from '../../store'; import apiReducer, { modules } from '../../store/api/reducer'; +import RevealLink from '../components/utils/RevealLink'; import SaveButton from '../components/utils/SaveButton'; import { APPNAME, @@ -13,6 +14,7 @@ import { PageContainer, PageHeader, PageTitle, + PasswordInputBox, } from '../theme'; export default function ServerSettingsPage(): React.ReactElement { @@ -24,6 +26,7 @@ export default function ServerSettingsPage(): React.ReactElement { const status = useStatus(loadStatus.save); const busy = loadStatus.load?.type !== 'success' || loadStatus.save?.type === 'pending'; + const [revealKVPassword, setRevealKVPassword] = useState(false); return ( @@ -59,22 +62,23 @@ export default function ServerSettingsPage(): React.ReactElement { - + {' '} + + onChange={(e) => { dispatch( apiReducer.actions.httpConfigChanged({ ...serverConfig, kv_password: e.target.value, }), - ) - } + ); + }} /> {t('pages.http.kilovolt-placeholder')} diff --git a/frontend/src/ui/pages/TwitchSettings.tsx b/frontend/src/ui/pages/TwitchSettings.tsx index 0edf4dd..0c37069 100644 --- a/frontend/src/ui/pages/TwitchSettings.tsx +++ b/frontend/src/ui/pages/TwitchSettings.tsx @@ -11,6 +11,7 @@ import { RootState, useAppDispatch } from '../../store'; import apiReducer, { modules } from '../../store/api/reducer'; import BrowserLink from '../components/BrowserLink'; import DefinitionTable from '../components/DefinitionTable'; +import RevealLink from '../components/utils/RevealLink'; import SaveButton from '../components/utils/SaveButton'; import { APPNAME, @@ -26,6 +27,7 @@ import { PageContainer, PageHeader, PageTitle, + PasswordInputBox, SectionHeader, styled, TabButton, @@ -59,6 +61,7 @@ function TwitchBotSettings() { const status = useStatus(loadStatus.save); const dispatch = useAppDispatch(); const { t } = useTranslation(); + const [revealBotToken, setRevealBotToken] = useState(false); const active = twitchConfig?.enable_bot ?? false; return ( @@ -138,9 +141,10 @@ function TwitchBotSettings() { - -