feat(route) Redirect to a custom welcome page
This commit is contained in:
parent
7a247f2b59
commit
56839742b4
12
config.js
12
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,
|
||||
|
|
|
@ -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('/'));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -506,6 +506,10 @@ export interface IConfig {
|
|||
webrtcIceUdpDisable?: boolean;
|
||||
websocket?: string;
|
||||
websocketKeepAliveUrl?: string;
|
||||
welcomePage?: {
|
||||
customUrl?: string;
|
||||
disabled?: boolean;
|
||||
};
|
||||
whiteboard?: {
|
||||
collabServerBaseUrl?: string;
|
||||
enabled?: boolean;
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue