Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Add support to disable chat join messages. Closes https://github.com/owncast/owncast/issues/1582 (#452)
Gabe Kangasff3cda97f3c2
diff --git a/web/pages/config-chat.tsx b/web/pages/config-chat.tsxindex e1c6ca39b9..3c1c9acae9 100644--- a/web/pages/config-chat.tsx+++ b/web/pages/config-chat.tsx@@ -15,6 +15,7 @@ import { UpdateArgs } from '../types/config-section';import {API_CHAT_FORBIDDEN_USERNAMES,API_CHAT_SUGGESTED_USERNAMES,+ FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED,FIELD_PROPS_DISABLE_CHAT,postConfigUpdateToAPI,RESET_TIMEOUT,@@ -32,7 +33,13 @@ export default function ConfigChat() {const serverStatusData = useContext(ServerStatusContext);const { serverConfig, setFieldInConfigState } = serverStatusData || {};- const { chatDisabled, forbiddenUsernames, instanceDetails, suggestedUsernames } = serverConfig;+ const {+ chatDisabled,+ chatJoinMessagesEnabled,+ forbiddenUsernames,+ instanceDetails,+ suggestedUsernames,+ } = serverConfig;const { welcomeMessage } = instanceDetails;const handleFieldChange = ({ fieldName, value }: UpdateArgs) => {@@ -46,6 +53,10 @@ export default function ConfigChat() {handleFieldChange({ fieldName: 'chatDisabled', value: !disabled });}+ function handleChatJoinMessagesEnabledChange(enabled: boolean) {+ handleFieldChange({ fieldName: 'chatJoinMessagesEnabled', value: enabled });+ }+function resetForbiddenUsernameState() {setForbiddenUsernameSaveState(null);}@@ -131,6 +142,7 @@ export default function ConfigChat() {useEffect(() => {setFormDataValues({chatDisabled,+ chatJoinMessagesEnabled,forbiddenUsernames,suggestedUsernames,welcomeMessage,@@ -152,6 +164,12 @@ export default function ConfigChat() {reversedonChange={handleChatDisableChange}/>+ <ToggleSwitch+ fieldName="chatJoinMessagesEnabled"+ {...FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED}+ checked={formDataValues.chatJoinMessagesEnabled}+ onChange={handleChatJoinMessagesEnabledChange}+ /><TextFieldWithSubmitfieldName="welcomeMessage"{...TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE}diff --git a/web/types/config-section.ts b/web/types/config-section.tsindex 211279cd30..840da79cd9 100644--- a/web/types/config-section.ts+++ b/web/types/config-section.ts@@ -113,5 +113,6 @@ export interface ConfigDetails {forbiddenUsernames: string[];suggestedUsernames: string[];chatDisabled: boolean;+ chatJoinMessagesEnabled: boolean;federation: Federation;}diff --git a/web/utils/config-constants.tsx b/web/utils/config-constants.tsxindex 8ddcd1814e..04b033b6ba 100644--- a/web/utils/config-constants.tsx+++ b/web/utils/config-constants.tsx@@ -30,6 +30,7 @@ export const API_VIDEO_VARIANTS = '/video/streamoutputvariants';export const API_WEB_PORT = '/webserverport';export const API_YP_SWITCH = '/directoryenabled';export const API_CHAT_DISABLE = '/chat/disable';+export const API_CHAT_JOIN_MESSAGES_ENABLED = '/chat/joinmessagesenabled';export const API_CHAT_FORBIDDEN_USERNAMES = '/chat/forbiddenusernames';export const API_CHAT_SUGGESTED_USERNAMES = '/chat/suggestedusernames';export const API_EXTERNAL_ACTIONS = '/externalactions';@@ -192,6 +193,14 @@ export const FIELD_PROPS_DISABLE_CHAT = {useSubmit: true,};+export const FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED = {+ apiPath: API_CHAT_JOIN_MESSAGES_ENABLED,+ configPath: '',+ label: 'Join Messages',+ tip: 'Show when a viewer joins the chat.',+ useSubmit: true,+};+export const TEXTFIELD_PROPS_CHAT_FORBIDDEN_USERNAMES = {apiPath: API_CHAT_FORBIDDEN_USERNAMES,placeholder: 'username',diff --git a/web/utils/server-status-context.tsx b/web/utils/server-status-context.tsxindex 4b66ff2cb1..b42a322c9f 100644--- a/web/utils/server-status-context.tsx+++ b/web/utils/server-status-context.tsx@@ -59,6 +59,7 @@ export const initialServerConfigState: ConfigDetails = {forbiddenUsernames: [],suggestedUsernames: [],chatDisabled: false,+ chatJoinMessagesEnabled: true,};const initialServerStatusState = {