Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(shared-video): reset native error on input change and enforce allowed domains
Calin-Teodor605bc7a34425
diff --git a/react/features/base/dialog/components/native/InputDialog.tsx b/react/features/base/dialog/components/native/InputDialog.tsxindex ac0a4283d3..35690909e5 100644--- a/react/features/base/dialog/components/native/InputDialog.tsx+++ b/react/features/base/dialog/components/native/InputDialog.tsx@@ -35,6 +35,11 @@ interface IProps extends AbstractProps, WithTranslation {*/messageKey?: string;+ /**+ * Invoked when the text in the field changes.+ */+ onChangeText?: (value: string) => void;+/*** Props for the text input.*/@@ -144,6 +149,8 @@ class InputDialog extends AbstractDialog<IProps, IState> {* @returns {void}*/_onChangeText(fieldValue: string) {+ this.props.onChangeText?.(fieldValue);+if (this.props.validateInput) {this.setState({isValid: this.props.validateInput(fieldValue),diff --git a/react/features/shared-video/components/AbstractSharedVideoDialog.tsx b/react/features/shared-video/components/AbstractSharedVideoDialog.tsxindex ff4752f561..d05118db54 100644--- a/react/features/shared-video/components/AbstractSharedVideoDialog.tsx+++ b/react/features/shared-video/components/AbstractSharedVideoDialog.tsx@@ -2,7 +2,7 @@ import { Component } from 'react';import { WithTranslation } from 'react-i18next';import { IStore } from '../../app/types';-import { extractYoutubeIdOrURL } from '../functions';+import { extractYoutubeIdOrURL, isURLAllowedForSharedVideo } from '../functions';/*** The type of the React {@code Component} props of@@ -53,11 +53,11 @@ export default class AbstractSharedVideoDialog<S> extends Component < IProps, S* @returns {boolean}*/_onSetVideoLink(link: string) {- const { onPostSubmit } = this.props;+ const { _allowedUrlDomains, onPostSubmit } = this.props;const id = extractYoutubeIdOrURL(link);- if (!id) {+ if (!id || !isURLAllowedForSharedVideo(id, _allowedUrlDomains, true)) {return false;}diff --git a/react/features/shared-video/components/native/SharedVideoDialog.tsx b/react/features/shared-video/components/native/SharedVideoDialog.tsxindex dcc6d3be16..e5062ffe2f 100644--- a/react/features/shared-video/components/native/SharedVideoDialog.tsx+++ b/react/features/shared-video/components/native/SharedVideoDialog.tsx@@ -26,9 +26,19 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<IState> {error: false};+ this._onChangeText = this._onChangeText.bind(this);this._onSubmitValue = this._onSubmitValue.bind(this);}+ /**+ * Callback to be invoked when the value of the link input changes.+ *+ * @returns {void}+ */+ _onChangeText() {+ this.setState({ error: false });+ }+/*** Callback to be invoked when the value of the link input is submitted.*@@ -57,6 +67,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<IState> {return (<InputDialogmessageKey = { error ? 'dialog.sharedVideoDialogError' : undefined }+ onChangeText = { this._onChangeText }onSubmit = { this._onSubmitValue }textInputProps = {{autoCapitalize: 'none',