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
feat(customParticipantButton): metrics
Hristo Terezovfb8e451e2edf
diff --git a/react/features/analytics/functions.ts b/react/features/analytics/functions.tsindex ad8ce3f008..1f7edb6d08 100644--- a/react/features/analytics/functions.ts+++ b/react/features/analytics/functions.ts@@ -154,6 +154,30 @@ export async function createHandlers({ getState }: IStore) {return handlers;}+/**+ * Checks whether a url is a data URL or not.+ *+ * @param {string} url - The URL to be checked.+ * @returns {boolean}+ */+function isDataURL(url?: string): boolean {+ if (typeof url !== 'string') { // The icon will be ignored+ return false;+ }++ try {+ const urlObject = new URL(url);++ if (urlObject.protocol === 'data:') {+ return false;+ }+ } catch {+ return false;+ }++ return true;+}+/*** Inits JitsiMeetJS.analytics by setting permanent properties and setting the handlers from the loaded scripts.* NOTE: Has to be used after JitsiMeetJS.init. Otherwise analytics will be null.@@ -186,6 +210,7 @@ export function initAnalytics(store: IStore, handlers: Array<Object>): boolean {isPromotedFromVisitor?: boolean;isVisitor?: boolean;overwritesCustomButtonsWithURL?: boolean;+ overwritesCustomParticipantButtonsWithURL?: boolean;overwritesDefaultLogoUrl?: boolean;overwritesDeploymentUrls?: boolean;overwritesEtherpadBase?: boolean;@@ -287,23 +312,12 @@ export function initAnalytics(store: IStore, handlers: Array<Object>): boolean {const customToolbarButtons = params['config.customToolbarButtons'] ?? [];permanentProperties.overwritesCustomButtonsWithURL = Boolean(- customToolbarButtons.find(({ icon }: { icon: string; }) => {- if (typeof icon !== 'string') { // The icon will be ignored- return false;- }-- try {- const url = new URL(icon);+ customToolbarButtons.find(({ icon }: { icon: string; }) => isDataURL(icon)));- if (url.protocol === 'data:') {- return false;- }- } catch {- return false;- }+ const customParticipantMenuButtons = params['config.customParticipantMenuButtons'] ?? [];- return true;- }));+ permanentProperties.overwritesCustomParticipantButtonsWithURL = Boolean(+ customParticipantMenuButtons.find(({ icon }: { icon: string; }) => isDataURL(icon)));// Optionally, include local deployment information based on the// contents of window.config.deploymentInfo.