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(route) Redirect to a custom welcome page
Horatiu Muresan768f10d96676
diff --git a/config.js b/config.jsindex 07878a4675..aba126dff6 100644--- a/config.js+++ b/config.js@@ -580,9 +580,19 @@ var config = {// Require users to always specify a display name.// requireDisplayName: true,+ // DEPRECATED! Use 'welcomePage.disabled' instead.// Whether to use a welcome page or not. In case it's false a random room// will be joined when no room is specified.- enableWelcomePage: true,+ // enableWelcomePage: true,++ // Configs for welcome page.+ // welcomePage: {+ // // Whether to disable welcome page. In case it's disabled a random room+ // // will be joined when no room is specified.+ // disabled: false,+ // // If set,landing page will redirect to this URL.+ // customUrl: ''+ // },// Disable app shortcuts that are registered upon joining a conference// disableShortcuts: false,diff --git a/react/features/app/actions.web.ts b/react/features/app/actions.web.tsindex 8234135a0d..4742258269 100644--- a/react/features/app/actions.web.ts+++ b/react/features/app/actions.web.ts@@ -21,6 +21,7 @@ import { isVpaasMeeting } from '../jaas/functions';import { clearNotifications, showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';import { setFatalError } from '../overlay/actions';+import { isWelcomePageEnabled } from '../welcome/functions';import {redirectToStaticPage,@@ -203,7 +204,7 @@ export function maybeRedirectToWelcomePage(options: { feedbackSubmitted?: boolea// if Welcome page is enabled redirect to welcome page after 3 sec, if// there is a thank you message to be shown, 0.5s otherwise.- if (getState()['features/base/config'].enableWelcomePage) {+ if (isWelcomePageEnabled(getState())) {setTimeout(() => {dispatch(redirectWithStoredParams('/'));diff --git a/react/features/app/getRouteToRender.web.js b/react/features/app/getRouteToRender.web.jsindex 29f22d5dfb..7c8b45e5f8 100644--- a/react/features/app/getRouteToRender.web.js+++ b/react/features/app/getRouteToRender.web.js@@ -8,7 +8,7 @@ import { Conference } from '../conference';import { getDeepLinkingPage } from '../deep-linking';import { UnsupportedDesktopBrowser } from '../unsupported-browser';import { BlankPage, WelcomePage } from '../welcome';-import { isWelcomePageEnabled } from '../welcome/functions';+import { getCustomLandingPageURL, isWelcomePageEnabled } from '../welcome/functions';/*** Determines which route is to be rendered in order to depict a specific Redux@@ -75,7 +75,13 @@ function _getWebWelcomePageRoute(state) {if (isWelcomePageEnabled(state)) {if (isSupportedBrowser()) {- route.component = WelcomePage;+ const customLandingPage = getCustomLandingPageURL(state);++ if (customLandingPage) {+ route.href = customLandingPage;+ } else {+ route.component = WelcomePage;+ }} else {route.component = UnsupportedDesktopBrowser;}diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.tsindex 468deabfcd..ad661b261c 100644--- a/react/features/base/config/configType.ts+++ b/react/features/base/config/configType.ts@@ -505,6 +505,10 @@ export interface IConfig {webrtcIceUdpDisable?: boolean;websocket?: string;websocketKeepAliveUrl?: string;+ welcomePage?: {+ customUrl?: string;+ disabled?: boolean;+ };whiteboard?: {collabServerBaseUrl?: string;enabled?: boolean;diff --git a/react/features/base/config/reducer.ts b/react/features/base/config/reducer.tsindex 43dafb1044..511b0ed53c 100644--- a/react/features/base/config/reducer.ts+++ b/react/features/base/config/reducer.ts@@ -338,6 +338,13 @@ function _translateLegacyConfig(oldValue: IConfig) {});}+ newValue.welcomePage = oldValue.welcomePage || {};+ if (oldValue.hasOwnProperty('enableWelcomePage')+ && !newValue.welcomePage.hasOwnProperty('disabled')+ ) {+ newValue.welcomePage.disabled = !oldValue.enableWelcomePage;+ }+newValue.prejoinConfig = oldValue.prejoinConfig || {};if (oldValue.hasOwnProperty('prejoinPageEnabled')&& !newValue.prejoinConfig.hasOwnProperty('enabled')diff --git a/react/features/welcome/functions.ts b/react/features/welcome/functions.tsindex c96e663a74..75f1106d5b 100644--- a/react/features/welcome/functions.ts+++ b/react/features/welcome/functions.ts@@ -17,5 +17,17 @@ export function isWelcomePageEnabled(stateful: IStateful) {return getFeatureFlag(stateful, WELCOME_PAGE_ENABLED, false);}- return toState(stateful)['features/base/config'].enableWelcomePage;+ const config = toState(stateful)['features/base/config'];++ return !config.welcomePage?.disabled;+}++/**+ * Returns the configured custom URL (if any) to redirect to instead of the normal landing page.+ *+ * @param {IStateful} stateful - The redux state or {@link getState}.+ * @returns {string} - The custom URL.+ */+export function getCustomLandingPageURL(stateful: IStateful) {+ return toState(stateful)['features/base/config'].welcomePage?.customUrl;}