mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
fix: Ignores disableThirdPartyRequests when using data url.
Fixes #15725.
This commit is contained in:
@@ -30,6 +30,7 @@ import { MEDIA_TYPE } from '../media/constants';
|
||||
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
|
||||
import StateListenerRegistry from '../redux/StateListenerRegistry';
|
||||
import { playSound, registerSound, unregisterSound } from '../sounds/actions';
|
||||
import { isImageDataURL } from '../util/uri';
|
||||
|
||||
import {
|
||||
DOMINANT_SPEAKER_CHANGED,
|
||||
@@ -689,15 +690,20 @@ function _participantJoinedOrUpdated(store: IStore, next: Function, action: AnyA
|
||||
// even if disableThirdPartyRequests is set to true in config
|
||||
if (getState()['features/base/config']?.hosts) {
|
||||
const { disableThirdPartyRequests } = getState()['features/base/config'];
|
||||
const participantId = !id && local ? getLocalParticipant(getState())?.id : id;
|
||||
|
||||
if (!disableThirdPartyRequests && (avatarURL || email || id || name)) {
|
||||
const participantId = !id && local ? getLocalParticipant(getState())?.id : id;
|
||||
const updatedParticipant = getParticipantById(getState(), participantId);
|
||||
if (avatarURL || email || id || name) {
|
||||
if (!disableThirdPartyRequests) {
|
||||
const updatedParticipant = getParticipantById(getState(), participantId);
|
||||
|
||||
getFirstLoadableAvatarUrl(updatedParticipant ?? { id: '' }, store)
|
||||
.then((urlData?: { isUsingCORS: boolean; src: string; }) => {
|
||||
dispatch(setLoadableAvatarUrl(participantId, urlData?.src ?? '', Boolean(urlData?.isUsingCORS)));
|
||||
});
|
||||
getFirstLoadableAvatarUrl(updatedParticipant ?? { id: '' }, store)
|
||||
.then((urlData?: { isUsingCORS: boolean; src: string; }) => {
|
||||
dispatch(setLoadableAvatarUrl(
|
||||
participantId, urlData?.src ?? '', Boolean(urlData?.isUsingCORS)));
|
||||
});
|
||||
} else if (isImageDataURL(avatarURL)) {
|
||||
dispatch(setLoadableAvatarUrl(participantId, avatarURL, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,14 @@ const _URI_AUTHORITY_PATTERN = '(//[^/?#]+)';
|
||||
*/
|
||||
const _URI_PATH_PATTERN = '([^?#]*)';
|
||||
|
||||
/**
|
||||
* The {@link RegExp} pattern of the image data scheme.
|
||||
*
|
||||
* @private
|
||||
* @type {RegExp}
|
||||
*/
|
||||
const IMG_DATA_URL: RegExp = /^data:image\/[a-z0-9\-.+]+;base64,/i;
|
||||
|
||||
/**
|
||||
* The {@link RegExp} pattern of the protocol of a URI.
|
||||
*
|
||||
@@ -690,3 +698,13 @@ export function sanitizeUrl(url?: string | URL): URL | null {
|
||||
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given url is a valid image data url.
|
||||
*
|
||||
* @param {string} url - The url to check.
|
||||
* @returns {boolean} True if the url is a valid image data url, false otherwise.
|
||||
*/
|
||||
export function isImageDataURL(url: string): boolean {
|
||||
return IMG_DATA_URL.test(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user