Compare commits

..

1 Commits

Author SHA1 Message Date
Aaron van Meerten
4ed9d5893b util updates 2019-09-09 08:42:00 -05:00
11 changed files with 140 additions and 161 deletions

View File

@@ -2257,8 +2257,7 @@ export default {
APP.keyboardshortcut.init();
if (config.requireDisplayName
&& !APP.conference.getLocalDisplayName()
&& !this._room.isHidden()) {
&& !APP.conference.getLocalDisplayName()) {
APP.UI.promptDisplayName();
}

View File

@@ -121,7 +121,6 @@
"deepLinking": {
"appNotInstalled": "You need the __app__ mobile app to join this meeting on your phone.",
"description": "Nothing happened? We tried launching your meeting in the __app__ desktop app. Try again or launch it in the __app__ web app.",
"descriptionWithoutWeb": "Nothing happened? We tried launching your meeting in the __app__ desktop app.",
"downloadApp": "Download the app",
"launchWebButton": "Launch in web",
"openApp": "Continue to the app",

4
package-lock.json generated
View File

@@ -8927,8 +8927,8 @@
}
},
"lib-jitsi-meet": {
"version": "github:jitsi/lib-jitsi-meet#985a0bbfab72f88db668b64c25d5a4224452dfd6",
"from": "github:jitsi/lib-jitsi-meet#985a0bbfab72f88db668b64c25d5a4224452dfd6",
"version": "github:jitsi/lib-jitsi-meet#0ee30bf12a549d10bb5d559e19bd557c3ed179eb",
"from": "github:jitsi/lib-jitsi-meet#0ee30bf12a549d10bb5d559e19bd557c3ed179eb",
"requires": {
"@jitsi/sdp-interop": "0.1.14",
"@jitsi/sdp-simulcast": "0.2.1",

View File

@@ -52,7 +52,7 @@
"js-utils": "github:jitsi/js-utils#73a67a7a60d52f8e895f50939c8fcbd1f20fe7b5",
"jsrsasign": "8.0.12",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#985a0bbfab72f88db668b64c25d5a4224452dfd6",
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#0ee30bf12a549d10bb5d559e19bd557c3ed179eb",
"libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
"lodash": "4.17.11",
"moment": "2.19.4",

View File

@@ -4,8 +4,9 @@ import { generateRoomWithoutSeparator } from 'js-utils/random';
import type { Component } from 'react';
import { isRoomValid } from '../base/conference';
import JitsiMeetJS from '../base/lib-jitsi-meet';
import { Platform } from '../base/react';
import { toState } from '../base/redux';
import { isSupportedBrowser } from '../base/environment';
import { Conference } from '../conference';
import { getDeepLinkingPage } from '../deep-linking';
import { UnsupportedDesktopBrowser } from '../unsupported-browser';
@@ -39,109 +40,69 @@ export type Route = {
*/
export function _getRouteToRender(stateful: Function | Object): Promise<Route> {
const state = toState(stateful);
if (navigator.product === 'ReactNative') {
return _getMobileRoute(state);
}
return _getWebConferenceRoute(state) || _getWebWelcomePageRoute(state);
}
/**
* Returns the {@code Route} to display on the React Native app.
*
* @param {Object} state - The redux state.
* @returns {Promise<Route>}
*/
function _getMobileRoute(state): Promise<Route> {
const route = _getEmptyRoute();
if (isRoomValid(state['features/base/conference'].room)) {
route.component = Conference;
} else if (isWelcomePageAppEnabled(state)) {
route.component = WelcomePage;
} else {
route.component = BlankPage;
}
return Promise.resolve(route);
}
/**
* Returns the {@code Route} to display when trying to access a conference if
* a valid conference is being joined.
*
* @param {Object} state - The redux state.
* @returns {Promise<Route>|undefined}
*/
function _getWebConferenceRoute(state): ?Promise<Route> {
if (!isRoomValid(state['features/base/conference'].room)) {
return;
}
const route = _getEmptyRoute();
// Update the location if it doesn't match. This happens when a room is
// joined from the welcome page. The reason for doing this instead of using
// the history API is that we want to load the config.js which takes the
// room into account.
const { locationURL } = state['features/base/connection'];
if (window.location.href !== locationURL.href) {
route.href = locationURL.href;
return Promise.resolve(route);
}
return getDeepLinkingPage(state)
.then(deepLinkComponent => {
if (deepLinkComponent) {
route.component = deepLinkComponent;
} else if (isSupportedBrowser()) {
route.component = Conference;
} else {
route.component = UnsupportedDesktopBrowser;
}
return route;
});
}
/**
* Returns the {@code Route} to display when trying to access the welcome page.
*
* @param {Object} state - The redux state.
* @returns {Promise<Route>}
*/
function _getWebWelcomePageRoute(state): Promise<Route> {
const route = _getEmptyRoute();
if (isWelcomePageUserEnabled(state)) {
if (isSupportedBrowser()) {
route.component = WelcomePage;
} else {
route.component = UnsupportedDesktopBrowser;
}
} else {
// Web: if the welcome page is disabled, go directly to a random room.
let href = window.location.href;
href.endsWith('/') || (href += '/');
route.href = href + generateRoomWithoutSeparator();
}
return Promise.resolve(route);
}
/**
* Returns the default {@code Route}.
*
* @returns {Route}
*/
function _getEmptyRoute(): Route {
return {
const { room } = state['features/base/conference'];
const isMobileApp = navigator.product === 'ReactNative';
const isMobileBrowser
= !isMobileApp && (Platform.OS === 'android' || Platform.OS === 'ios');
const route: Route = {
component: BlankPage,
href: undefined
};
return new Promise(resolve => {
// First, check if the current endpoint supports WebRTC. We are
// intentionally not performing the check for mobile browsers because:
// - the WelcomePage is mobile ready;
// - if the URL points to a conference, getDeepLinkingPage will take
// care of it.
if (!isMobileBrowser && !JitsiMeetJS.isWebRtcSupported()) {
route.component = UnsupportedDesktopBrowser;
resolve(route);
return;
}
if (isRoomValid(room)) {
if (isMobileApp) {
route.component = Conference;
resolve(route);
} else {
// Update the location if it doesn't match. This happens when a
// room is joined from the welcome page. The reason for doing
// this instead of using the history API is that we want to load
// the config.js which takes the room into account.
const { locationURL } = state['features/base/connection'];
// eslint-disable-next-line no-negated-condition
if (window.location.href !== locationURL.href) {
route.href = locationURL.href;
resolve(route);
} else {
// Maybe show deep-linking, otherwise go to Conference.
getDeepLinkingPage(state).then(component => {
route.component = component || Conference;
resolve(route);
});
}
}
return;
}
if (!isWelcomePageUserEnabled(state)) {
// Web: if the welcome page is disabled, go directly to a random
// room.
let href = window.location.href;
href.endsWith('/') || (href += '/');
route.href = href + generateRoomWithoutSeparator();
} else if (isWelcomePageAppEnabled(state)) {
// Mobile: only go to the welcome page if enabled.
route.component = WelcomePage;
}
resolve(route);
});
}

View File

@@ -1,25 +0,0 @@
// @flow
import JitsiMeetJS from '../lib-jitsi-meet';
import { Platform } from '../react';
import { isBlacklistedEnvironment } from './isBlacklistedEnvironment';
/**
* Returns whether or not the current browser should allow the app to display.
*
* @returns {boolean}
*/
export function isSupportedBrowser() {
if (navigator.product === 'ReactNative' || isBlacklistedEnvironment()) {
return false;
}
// We are intentionally allow mobile browsers because:
// - the WelcomePage is mobile ready;
// - if the URL points to a conference then deep-linking will take
// care of it.
return Platform.OS === 'android'
|| Platform.OS === 'ios'
|| JitsiMeetJS.isWebRtcSupported();
}

View File

@@ -1 +0,0 @@
export * from './environment';

View File

@@ -1,11 +0,0 @@
/**
* Returns whether or not the current browser is supported for showing meeting
* based on any custom overrides. This file should be overridden with branding
* as needed to fit deployment needs.
*
* @returns {boolean} True the browser is unsupported due to being blacklisted
* by the logic within this function.
*/
export function isBlacklistedEnvironment() {
return false;
}

View File

@@ -7,7 +7,6 @@ import { connect } from '../../base/redux';
import type { Dispatch } from 'redux';
import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
import { isSupportedBrowser } from '../../base/environment';
import { translate } from '../../base/i18n';
import {
@@ -108,12 +107,8 @@ class DeepLinkingDesktopPage<P : Props> extends Component<P> {
</h1>
<p className = 'description'>
{
t(
`${_TNS}.${isSupportedBrowser()
? 'description'
: 'descriptionWithoutWeb'}`,
{ app: NATIVE_APP_NAME }
)
t(`${_TNS}.description`,
{ app: NATIVE_APP_NAME })
}
</p>
<div className = 'buttons'>
@@ -123,12 +118,9 @@ class DeepLinkingDesktopPage<P : Props> extends Component<P> {
onClick = { this._onTryAgain }>
{ t(`${_TNS}.tryAgainButton`) }
</Button>
{
isSupportedBrowser()
&& <Button onClick = { this._onLaunchWeb }>
{ t(`${_TNS}.launchWebButton`) }
</Button>
}
<Button onClick = { this._onLaunchWeb }>
{ t(`${_TNS}.launchWebButton`) }
</Button>
</ButtonGroup>
</div>
</div>

View File

@@ -3,8 +3,9 @@
import React, { Component } from 'react';
import { translate } from '../../base/i18n';
import { Platform } from '../../base/react';
import { CHROME, FIREFOX } from './browserLinks';
import { CHROME, /* EDGE, */ FIREFOX, SAFARI } from './browserLinks';
/**
* The namespace of the CSS styles of UnsupportedDesktopBrowser.
@@ -50,11 +51,55 @@ class UnsupportedDesktopBrowser extends Component<Props> {
href = { CHROME } >Chrome</a> and&nbsp;
<a
className = { `${_SNS}__link` }
href = { FIREFOX }>Firefox</a>
href = { FIREFOX }>Firefox</a>&nbsp;
{
this._renderOSSpecificBrowserDownloadLink()
}
</p>
</div>
);
}
/**
* Depending on the platform returns the link to Safari browser.
*
* @returns {ReactElement|null}
* @private
*/
_renderOSSpecificBrowserDownloadLink() {
let link;
let text;
switch (Platform.OS) {
case 'macos':
link = SAFARI;
text = 'Safari';
break;
/*
case 'windows':
link = EDGE;
text = 'Edge';
break;
*/
}
if (typeof link !== 'undefined') {
return (
<span>
or&nbsp;
<a
className = { `${_SNS}__link` }
href = { link }>
{
text
}
</a>
</span>
);
}
return null;
}
}
export default translate(UnsupportedDesktopBrowser);

View File

@@ -39,6 +39,25 @@ local function room_jid_match_rewrite(room_jid)
return room_jid
end
-- Utility function to check and convert a room JID from real [foo]room1@muc.example.com to virtual room1@muc.foo.example.com
local function room_jid_match_rewrite_from_internal(room_jid)
local node, host, resource = jid.split(room_jid);
if host ~= muc_domain or not node then
module:log("debug", "No need to rewrite %s (not from the MUC host)", room_jid);
return room_jid;
end
local target_subdomain, target_node = node:match("^%[([^%]]+)%](.+)$");
if not (target_node and target_subdomain) then
module:log("debug", "Not rewriting... unexpected node format: %s", node);
return room_jid;
end
-- Ok, rewrite room_jid address to pretty format
local new_node, new_host, new_resource = target_node, muc_domain_prefix..".".. target_subdomain.."."..muc_domain_base, resource;
room_jid = jid.join(new_node, new_host, new_resource);
module:log("debug", "Rewrote to %s", room_jid);
return room_jid
end
--- Finds and returns room by its jid
-- @param room_jid the room jid to search in the muc component
@@ -194,5 +213,6 @@ return {
wrap_async_run = wrap_async_run;
async_handler_wrapper = async_handler_wrapper;
room_jid_match_rewrite = room_jid_match_rewrite;
room_jid_match_rewrite_from_internal = room_jid_match_rewrite_from_internal
update_presence_identity = update_presence_identity;
};