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:
@@ -40,6 +40,7 @@ const API_CHAT_JOIN_MESSAGES_ENABLED = '/chat/joinmessagesenabled';
|
||||
const API_CHAT_ESTABLISHED_MODE = '/chat/establishedusermode';
|
||||
const API_CHAT_SPAM_PROTECTION_ENABLED = '/chat/spamprotectionenabled';
|
||||
const API_CHAT_SLUR_FILTER_ENABLED = '/chat/slurfilterenabled';
|
||||
const API_CHAT_REQUIRE_AUTHENTICATION = '/chat/requireauthentication';
|
||||
const API_DISABLE_SEARCH_INDEXING = '/disablesearchindexing';
|
||||
const API_SOCKET_HOST_OVERRIDE = '/sockethostoverride';
|
||||
const API_VIDEO_SERVING_ENDPOINT = '/videoservingendpoint';
|
||||
@@ -292,6 +293,14 @@ export const CHAT_ESTABLISHED_USER_MODE = {
|
||||
useSubmit: true,
|
||||
};
|
||||
|
||||
export const FIELD_PROPS_CHAT_REQUIRE_AUTHENTICATION = {
|
||||
apiPath: API_CHAT_REQUIRE_AUTHENTICATION,
|
||||
configPath: '',
|
||||
label: 'Require Authentication',
|
||||
tip: 'Only users who have authenticated may chat.',
|
||||
useSubmit: true,
|
||||
};
|
||||
|
||||
export const TEXTFIELD_PROPS_CHAT_FORBIDDEN_USERNAMES = {
|
||||
apiPath: API_CHAT_FORBIDDEN_USERNAMES,
|
||||
placeholder: 'username',
|
||||
|
||||
@@ -71,6 +71,7 @@ const initialServerConfigState: ConfigDetails = {
|
||||
chatDisabled: false,
|
||||
chatSpamProtectionEnabled: true,
|
||||
chatSlurFilterEnabled: false,
|
||||
chatRequireAuthentication: false,
|
||||
chatJoinMessagesEnabled: true,
|
||||
chatEstablishedUserMode: false,
|
||||
hideViewerCount: false,
|
||||
@@ -127,6 +128,7 @@ const ServerStatusProvider: FC<ServerStatusProviderProps> = ({ children }) => {
|
||||
|
||||
setStatus({ ...result, error: { type: null, msg: null } });
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch server status:', error);
|
||||
setStatus(initialStatus => ({
|
||||
...initialStatus,
|
||||
error: {
|
||||
@@ -134,7 +136,6 @@ const ServerStatusProvider: FC<ServerStatusProviderProps> = ({ children }) => {
|
||||
msg: 'Cannot connect to the Owncast service. Please check you are connected to the internet and the Owncast server is running.',
|
||||
},
|
||||
}));
|
||||
// todo
|
||||
}
|
||||
};
|
||||
const getConfig = async () => {
|
||||
|
||||
Reference in New Issue
Block a user