Require authentication to participate in chat (#4762)

* feat(chat): require authentication to participate in chat

* fix: it's pretty much impossible to bypass the auth requirement, addressing review feedback anyway

* feat(chat): render chat text input as disabled if chat auth is required

* Commit updated API documentation

---------

Co-authored-by: Owncast <owncast@owncast.online>
This commit is contained in:
Gabe Kangas
2026-01-28 11:49:07 -08:00
committed by GitHub
co-authored by Owncast
parent 83c8b2b3d5
commit 93b482871f
29 changed files with 5194 additions and 5143 deletions
@@ -30,6 +30,7 @@ export type ChatTextFieldProps = {
defaultText?: string;
enabled: boolean;
focusInput: boolean;
disabledPlaceholder?: string;
};
const characterLimit = 300;
@@ -119,7 +120,12 @@ const getTextContent = node => {
return text;
};
export const ChatTextField: FC<ChatTextFieldProps> = ({ defaultText, enabled, focusInput }) => {
export const ChatTextField: FC<ChatTextFieldProps> = ({
defaultText,
enabled,
focusInput,
disabledPlaceholder,
}) => {
const [inputDraft, setInputDraft] = useRecoilState(chatInputDraftAtom);
const [characterCount, setCharacterCount] = useState(defaultText?.length);
const websocketService = useRecoilValue<WebsocketService>(websocketServiceAtom);
@@ -276,7 +282,9 @@ export const ChatTextField: FC<ChatTextFieldProps> = ({ defaultText, enabled, fo
<ContentEditable
id="chat-input-content-editable"
html={defaultText || ''}
placeholder={enabled ? 'Send a message to chat' : 'Chat is disabled'}
placeholder={
enabled ? 'Send a message to chat' : disabledPlaceholder || 'Chat is disabled'
}
disabled={!enabled}
onKeyDown={onKeyDown}
onContentChange={handleChange}