mirror of
https://github.com/owncast/owncast.git
synced 2025-11-02 20:23:29 +08:00
Add admin support for established user mode. https://github.com/owncast/owncast/issues/1587 (#430)
This commit is contained in:
@ -16,6 +16,7 @@ import {
|
|||||||
API_CHAT_FORBIDDEN_USERNAMES,
|
API_CHAT_FORBIDDEN_USERNAMES,
|
||||||
API_CHAT_SUGGESTED_USERNAMES,
|
API_CHAT_SUGGESTED_USERNAMES,
|
||||||
FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED,
|
FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED,
|
||||||
|
CHAT_ESTABLISHED_USER_MODE,
|
||||||
FIELD_PROPS_DISABLE_CHAT,
|
FIELD_PROPS_DISABLE_CHAT,
|
||||||
postConfigUpdateToAPI,
|
postConfigUpdateToAPI,
|
||||||
RESET_TIMEOUT,
|
RESET_TIMEOUT,
|
||||||
@ -39,6 +40,7 @@ export default function ConfigChat() {
|
|||||||
forbiddenUsernames,
|
forbiddenUsernames,
|
||||||
instanceDetails,
|
instanceDetails,
|
||||||
suggestedUsernames,
|
suggestedUsernames,
|
||||||
|
chatEstablishedUserMode,
|
||||||
} = serverConfig;
|
} = serverConfig;
|
||||||
const { welcomeMessage } = instanceDetails;
|
const { welcomeMessage } = instanceDetails;
|
||||||
|
|
||||||
@ -57,6 +59,10 @@ export default function ConfigChat() {
|
|||||||
handleFieldChange({ fieldName: 'chatJoinMessagesEnabled', value: enabled });
|
handleFieldChange({ fieldName: 'chatJoinMessagesEnabled', value: enabled });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleEstablishedUserModeChange(enabled: boolean) {
|
||||||
|
handleFieldChange({ fieldName: 'chatEstablishedUserMode', value: enabled });
|
||||||
|
}
|
||||||
|
|
||||||
function resetForbiddenUsernameState() {
|
function resetForbiddenUsernameState() {
|
||||||
setForbiddenUsernameSaveState(null);
|
setForbiddenUsernameSaveState(null);
|
||||||
}
|
}
|
||||||
@ -146,6 +152,7 @@ export default function ConfigChat() {
|
|||||||
forbiddenUsernames,
|
forbiddenUsernames,
|
||||||
suggestedUsernames,
|
suggestedUsernames,
|
||||||
welcomeMessage,
|
welcomeMessage,
|
||||||
|
chatEstablishedUserMode,
|
||||||
});
|
});
|
||||||
}, [serverConfig]);
|
}, [serverConfig]);
|
||||||
|
|
||||||
@ -170,6 +177,12 @@ export default function ConfigChat() {
|
|||||||
checked={formDataValues.chatJoinMessagesEnabled}
|
checked={formDataValues.chatJoinMessagesEnabled}
|
||||||
onChange={handleChatJoinMessagesEnabledChange}
|
onChange={handleChatJoinMessagesEnabledChange}
|
||||||
/>
|
/>
|
||||||
|
<ToggleSwitch
|
||||||
|
fieldName="establishedUserMode"
|
||||||
|
{...CHAT_ESTABLISHED_USER_MODE}
|
||||||
|
checked={formDataValues.chatEstablishedUserMode}
|
||||||
|
onChange={handleEstablishedUserModeChange}
|
||||||
|
/>
|
||||||
<TextFieldWithSubmit
|
<TextFieldWithSubmit
|
||||||
fieldName="welcomeMessage"
|
fieldName="welcomeMessage"
|
||||||
{...TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE}
|
{...TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE}
|
||||||
|
|||||||
@ -115,5 +115,6 @@ export interface ConfigDetails {
|
|||||||
suggestedUsernames: string[];
|
suggestedUsernames: string[];
|
||||||
chatDisabled: boolean;
|
chatDisabled: boolean;
|
||||||
chatJoinMessagesEnabled: boolean;
|
chatJoinMessagesEnabled: boolean;
|
||||||
|
chatEstablishedUserMode: boolean;
|
||||||
federation: Federation;
|
federation: Federation;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export const API_WEB_PORT = '/webserverport';
|
|||||||
export const API_YP_SWITCH = '/directoryenabled';
|
export const API_YP_SWITCH = '/directoryenabled';
|
||||||
export const API_CHAT_DISABLE = '/chat/disable';
|
export const API_CHAT_DISABLE = '/chat/disable';
|
||||||
export const API_CHAT_JOIN_MESSAGES_ENABLED = '/chat/joinmessagesenabled';
|
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_FORBIDDEN_USERNAMES = '/chat/forbiddenusernames';
|
||||||
export const API_CHAT_SUGGESTED_USERNAMES = '/chat/suggestedusernames';
|
export const API_CHAT_SUGGESTED_USERNAMES = '/chat/suggestedusernames';
|
||||||
export const API_EXTERNAL_ACTIONS = '/externalactions';
|
export const API_EXTERNAL_ACTIONS = '/externalactions';
|
||||||
@ -212,6 +213,13 @@ export const FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED = {
|
|||||||
configPath: '',
|
configPath: '',
|
||||||
label: 'Join Messages',
|
label: 'Join Messages',
|
||||||
tip: 'Show when a viewer joins the chat.',
|
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,
|
useSubmit: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,7 @@ export const initialServerConfigState: ConfigDetails = {
|
|||||||
suggestedUsernames: [],
|
suggestedUsernames: [],
|
||||||
chatDisabled: false,
|
chatDisabled: false,
|
||||||
chatJoinMessagesEnabled: true,
|
chatJoinMessagesEnabled: true,
|
||||||
|
chatEstablishedUserMode: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialServerStatusState = {
|
const initialServerStatusState = {
|
||||||
|
|||||||
Reference in New Issue
Block a user