Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Add admin support for established user mode. https://github.com/owncast/owncast/issues/1587 (#430)

Gabe Kangas181a7c343168
diff --git a/web/pages/config-chat.tsx b/web/pages/config-chat.tsx
index 3c1c9acae9..029b521167 100644
--- a/web/pages/config-chat.tsx
+++ b/web/pages/config-chat.tsx
@@ -16,6 +16,7 @@ import {
API_CHAT_FORBIDDEN_USERNAMES,
API_CHAT_SUGGESTED_USERNAMES,
FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED,
+ CHAT_ESTABLISHED_USER_MODE,
FIELD_PROPS_DISABLE_CHAT,
postConfigUpdateToAPI,
RESET_TIMEOUT,
@@ -39,6 +40,7 @@ export default function ConfigChat() {
forbiddenUsernames,
instanceDetails,
suggestedUsernames,
+ chatEstablishedUserMode,
} = serverConfig;
const { welcomeMessage } = instanceDetails;
@@ -57,6 +59,10 @@ export default function ConfigChat() {
handleFieldChange({ fieldName: 'chatJoinMessagesEnabled', value: enabled });
}
+ function handleEstablishedUserModeChange(enabled: boolean) {
+ handleFieldChange({ fieldName: 'chatEstablishedUserMode', value: enabled });
+ }
+
function resetForbiddenUsernameState() {
setForbiddenUsernameSaveState(null);
}
@@ -146,6 +152,7 @@ export default function ConfigChat() {
forbiddenUsernames,
suggestedUsernames,
welcomeMessage,
+ chatEstablishedUserMode,
});
}, [serverConfig]);
@@ -170,6 +177,12 @@ export default function ConfigChat() {
checked={formDataValues.chatJoinMessagesEnabled}
onChange={handleChatJoinMessagesEnabledChange}
/>
+ <ToggleSwitch
+ fieldName="establishedUserMode"
+ {...CHAT_ESTABLISHED_USER_MODE}
+ checked={formDataValues.chatEstablishedUserMode}
+ onChange={handleEstablishedUserModeChange}
+ />
<TextFieldWithSubmit
fieldName="welcomeMessage"
{...TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE}
diff --git a/web/types/config-section.ts b/web/types/config-section.ts
index 1ba71d62a3..87a0f2199f 100644
--- a/web/types/config-section.ts
+++ b/web/types/config-section.ts
@@ -115,5 +115,6 @@ export interface ConfigDetails {
suggestedUsernames: string[];
chatDisabled: boolean;
chatJoinMessagesEnabled: boolean;
+ chatEstablishedUserMode: boolean;
federation: Federation;
}
diff --git a/web/utils/config-constants.tsx b/web/utils/config-constants.tsx
index 14ea2677be..c9f4c4d079 100644
--- a/web/utils/config-constants.tsx
+++ b/web/utils/config-constants.tsx
@@ -31,6 +31,7 @@ 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_ESTABLISHED_MODE = '/chat/establishedusermode';
export const API_CHAT_FORBIDDEN_USERNAMES = '/chat/forbiddenusernames';
export const API_CHAT_SUGGESTED_USERNAMES = '/chat/suggestedusernames';
export const API_EXTERNAL_ACTIONS = '/externalactions';
@@ -212,6 +213,13 @@ export const FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED = {
configPath: '',
label: 'Join Messages',
tip: 'Show when a viewer joins the chat.',
+};
+
+export const CHAT_ESTABLISHED_USER_MODE = {
+ apiPath: API_CHAT_ESTABLISHED_MODE,
+ configPath: '',
+ label: 'Established users only',
+ tip: 'Only users who have previously been established for some time may chat.',
useSubmit: true,
};
diff --git a/web/utils/server-status-context.tsx b/web/utils/server-status-context.tsx
index 16bb30c62b..81d580fe91 100644
--- a/web/utils/server-status-context.tsx
+++ b/web/utils/server-status-context.tsx
@@ -61,6 +61,7 @@ export const initialServerConfigState: ConfigDetails = {
suggestedUsernames: [],
chatDisabled: false,
chatJoinMessagesEnabled: true,
+ chatEstablishedUserMode: false,
};
const initialServerStatusState = {