Merge pull request #11848 from antobinary/apr1-merge
Merged 2.2.36 into 2.3-beta
This commit is contained in:
commit
6cc4a8a317
@ -509,7 +509,7 @@ class SIPSession {
|
||||
callerIdName: this.user.callerIdName,
|
||||
},
|
||||
}, 'User agent disconnected: trying to reconnect...'
|
||||
+ ` (userHangup = ${!!this.userRequestedHangup})`);
|
||||
+ ` (userHangup = ${!!this.userRequestedHangup})`);
|
||||
|
||||
logger.info({
|
||||
logCode: 'sip_js_session_ua_reconnecting',
|
||||
@ -605,7 +605,7 @@ class SIPSession {
|
||||
callerIdName: this.user.callerIdName,
|
||||
},
|
||||
}, 'User agent failed to reconnect after'
|
||||
+ ` ${USER_AGENT_RECONNECTION_ATTEMPTS} attemps`);
|
||||
+ ` ${USER_AGENT_RECONNECTION_ATTEMPTS} attemps`);
|
||||
|
||||
this.callback({
|
||||
status: this.baseCallStates.failed,
|
||||
@ -879,7 +879,7 @@ class SIPSession {
|
||||
callerIdName: this.user.callerIdName,
|
||||
},
|
||||
}, 'ICE connection state change - Current connection state - '
|
||||
+ `${peer.connectionState}`);
|
||||
+ `${peer.connectionState}`);
|
||||
|
||||
switch (peer.connectionState) {
|
||||
case 'failed':
|
||||
@ -904,8 +904,8 @@ class SIPSession {
|
||||
callerIdName: this.user.callerIdName,
|
||||
},
|
||||
}, 'ICE connection success, but user is already connected'
|
||||
+ 'ignoring it...'
|
||||
+ `${peer.iceConnectionState}`);
|
||||
+ 'ignoring it...'
|
||||
+ `${peer.iceConnectionState}`);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -917,7 +917,7 @@ class SIPSession {
|
||||
callerIdName: this.user.callerIdName,
|
||||
},
|
||||
}, 'ICE connection success. Current ICE Connection state - '
|
||||
+ `${peer.iceConnectionState}`);
|
||||
+ `${peer.iceConnectionState}`);
|
||||
|
||||
clearTimeout(callTimeout);
|
||||
clearTimeout(iceNegotiationTimeout);
|
||||
@ -1219,7 +1219,7 @@ export default class SIPBridge extends BaseAudioBridge {
|
||||
let shouldTryReconnect = false;
|
||||
|
||||
// Try and get the call to clean up and end on an error
|
||||
this.activeSession.exitAudio().catch(() => {});
|
||||
this.activeSession.exitAudio().catch(() => { });
|
||||
|
||||
if (this.activeSession.webrtcConnected) {
|
||||
// webrtc was able to connect so just try again
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { hashSHA1 } from '/imports/api/common/server/helpers';
|
||||
import { hashSHA1 } from '/imports/api/common/server/etherpad';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
const ETHERPAD = Meteor.settings.private.etherpad;
|
||||
|
@ -1,12 +1,8 @@
|
||||
import axios from 'axios';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import {
|
||||
generatePadId,
|
||||
} from '/imports/api/captions/server/helpers';
|
||||
import {
|
||||
appendTextURL,
|
||||
} from '/imports/api/note/server/helpers';
|
||||
import { generatePadId } from '/imports/api/captions/server/helpers';
|
||||
import { appendTextURL } from '/imports/api/common/server/etherpad';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function appendText(text, locale) {
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
isEnabled,
|
||||
getLocalesURL,
|
||||
} from '/imports/api/captions/server/helpers';
|
||||
import { withInstaceId } from '/imports/api/note/server/helpers';
|
||||
import { withInstaceId } from '/imports/api/common/server/etherpad';
|
||||
import addCaption from '/imports/api/captions/server/modifiers/addCaption';
|
||||
import addCaptionsPads from '/imports/api/captions/server/methods/addCaptionsPads';
|
||||
import axios from 'axios';
|
||||
@ -13,7 +13,7 @@ import axios from 'axios';
|
||||
export default function createCaptions(meetingId, instanceId) {
|
||||
// Avoid captions creation if this feature is disabled
|
||||
if (!isEnabled()) {
|
||||
Logger.warn(`Captions are disabled for ${meetingId}`);
|
||||
Logger.warn(`Closed captions are disabled`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import {
|
||||
getReadOnlyIdURL,
|
||||
getDataFromResponse,
|
||||
} from '/imports/api/note/server/helpers';
|
||||
import { getReadOnlyIdURL } from '/imports/api/common/server/etherpad';
|
||||
import { getDataFromResponse } from '/imports/api/note/server/helpers';
|
||||
import updateReadOnlyPadId from '/imports/api/captions/server/modifiers/updateReadOnlyPadId';
|
||||
import axios from 'axios';
|
||||
|
||||
export default function fetchReadOnlyPadId(padId) {
|
||||
check(padId, String);
|
||||
|
||||
const readOnlyURL = getReadOnlyIdURL(padId);
|
||||
|
||||
axios({
|
||||
method: 'get',
|
||||
url: readOnlyURL,
|
||||
url: getReadOnlyIdURL(padId),
|
||||
responseType: 'json',
|
||||
}).then((response) => {
|
||||
const { status } = response;
|
||||
|
52
bigbluebutton-html5/imports/api/common/server/etherpad.js
Normal file
52
bigbluebutton-html5/imports/api/common/server/etherpad.js
Normal file
@ -0,0 +1,52 @@
|
||||
import axios from 'axios';
|
||||
import sha1 from 'crypto-js/sha1';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import createNote from '/imports/api/note/server/methods/createNote';
|
||||
import createCaptions from '/imports/api/captions/server/methods/createCaptions';
|
||||
|
||||
const ETHERPAD = Meteor.settings.private.etherpad;
|
||||
const BASE_URL = `http://${ETHERPAD.host}:${ETHERPAD.port}/api/${ETHERPAD.version}`;
|
||||
|
||||
const createPadURL = padId => `${BASE_URL}/createPad?apikey=${ETHERPAD.apikey}&padID=${padId}`;
|
||||
|
||||
const getReadOnlyIdURL = padId => `${BASE_URL}/getReadOnlyID?apikey=${ETHERPAD.apikey}&padID=${padId}`;
|
||||
|
||||
const appendTextURL = (padId, text) => `${BASE_URL}/appendText?apikey=${ETHERPAD.apikey}&padID=${padId}&text=${encodeURIComponent(text)}`;
|
||||
|
||||
const checkTokenURL = () => `${BASE_URL}/checkToken?apikey=${ETHERPAD.apikey}`;
|
||||
|
||||
const hashSHA1 = (str) => sha1(str).toString();
|
||||
|
||||
const checkServer = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'get',
|
||||
url: checkTokenURL(),
|
||||
responseType: 'json',
|
||||
}).then((response) => {
|
||||
const { status } = response;
|
||||
if (status !== 200) return reject();
|
||||
const { message } = response.data;
|
||||
if (message !== 'ok') return reject();
|
||||
resolve();
|
||||
}).catch(() => reject());
|
||||
});
|
||||
};
|
||||
|
||||
const initPads = (meetingId, html5InstanceId) => {
|
||||
checkServer().then(() => {
|
||||
createNote(meetingId, html5InstanceId);
|
||||
createCaptions(meetingId, html5InstanceId);
|
||||
}).catch(() => Logger.error(`Pads' server unreachable`));
|
||||
};
|
||||
|
||||
const withInstaceId = (instanceId, id) => `[${instanceId}]${id}`;
|
||||
|
||||
export {
|
||||
hashSHA1,
|
||||
createPadURL,
|
||||
getReadOnlyIdURL,
|
||||
appendTextURL,
|
||||
initPads,
|
||||
withInstaceId,
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
import sha1 from 'crypto-js/sha1';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
const MSG_DIRECT_TYPE = 'DIRECT';
|
||||
@ -39,8 +38,6 @@ export const processForHTML5ServerOnly = fn => (message, ...args) => {
|
||||
return fn(message, ...args);
|
||||
};
|
||||
|
||||
export const hashSHA1 = (str) => sha1(str).toString();
|
||||
|
||||
export const extractCredentials = (credentials) => {
|
||||
if (!credentials) return {};
|
||||
const credentialsArray = credentials.split('--');
|
||||
|
@ -6,8 +6,7 @@ import {
|
||||
import SanitizeHTML from 'sanitize-html';
|
||||
import Meetings, { RecordMeetings } from '/imports/api/meetings';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import createNote from '/imports/api/note/server/methods/createNote';
|
||||
import createCaptions from '/imports/api/captions/server/methods/createCaptions';
|
||||
import { initPads } from '/imports/api/common/server/etherpad';
|
||||
import { addAnnotationsStreamer } from '/imports/api/annotations/server/streamer';
|
||||
import { addCursorStreamer } from '/imports/api/cursor/server/streamer';
|
||||
import { addExternalVideoStreamer } from '/imports/api/external-videos/server/streamer';
|
||||
@ -184,8 +183,7 @@ export default function addMeeting(meeting) {
|
||||
Logger.info(`Added meeting id=${meetingId}`);
|
||||
|
||||
const { html5InstanceId } = meeting.systemProps;
|
||||
createNote(meetingId, html5InstanceId);
|
||||
createCaptions(meetingId, html5InstanceId);
|
||||
initPads(meetingId, html5InstanceId);
|
||||
} else if (numberAffected) {
|
||||
Logger.info(`Upserted meeting id=${meetingId}`);
|
||||
}
|
||||
|
@ -1,21 +1,10 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { hashSHA1 } from '/imports/api/common/server/helpers';
|
||||
import { hashSHA1 } from '/imports/api/common/server/etherpad';
|
||||
|
||||
const ETHERPAD = Meteor.settings.private.etherpad;
|
||||
const NOTE_CONFIG = Meteor.settings.public.note;
|
||||
const BASE_URL = `http://${ETHERPAD.host}:${ETHERPAD.port}/api/${ETHERPAD.version}`;
|
||||
const TOKEN = '_';
|
||||
|
||||
const createPadURL = padId => `${BASE_URL}/createPad?apikey=${ETHERPAD.apikey}&padID=${padId}`;
|
||||
|
||||
const getReadOnlyIdURL = padId => `${BASE_URL}/getReadOnlyID?apikey=${ETHERPAD.apikey}&padID=${padId}`;
|
||||
|
||||
const appendTextURL = (padId, text) => `${BASE_URL}/appendText?apikey=${ETHERPAD.apikey}&padID=${padId}&text=${encodeURIComponent(text)}`;
|
||||
|
||||
const generateNoteId = (meetingId) => hashSHA1(meetingId+ETHERPAD.apikey);
|
||||
|
||||
const withInstaceId = (instanceId, id) => `[${instanceId}]${id}`;
|
||||
|
||||
const isEnabled = () => NOTE_CONFIG.enabled;
|
||||
|
||||
const getDataFromResponse = (data, key) => {
|
||||
@ -38,16 +27,14 @@ const processForNotePadOnly = fn => (message, ...args) => {
|
||||
check(id, String);
|
||||
|
||||
if (isNotePad(id)) return fn(message, ...args);
|
||||
return () => {};
|
||||
return () => { };
|
||||
};
|
||||
|
||||
const generatePadId = meetingId => hashSHA1(meetingId + ETHERPAD.apikey);
|
||||
|
||||
export {
|
||||
generateNoteId,
|
||||
createPadURL,
|
||||
getReadOnlyIdURL,
|
||||
generatePadId,
|
||||
isEnabled,
|
||||
getDataFromResponse,
|
||||
appendTextURL,
|
||||
processForNotePadOnly,
|
||||
withInstaceId,
|
||||
};
|
||||
|
@ -1,12 +1,14 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import {
|
||||
generateNoteId,
|
||||
createPadURL,
|
||||
getReadOnlyIdURL,
|
||||
withInstaceId,
|
||||
} from '/imports/api/common/server/etherpad';
|
||||
import {
|
||||
generatePadId,
|
||||
isEnabled,
|
||||
getDataFromResponse,
|
||||
withInstaceId,
|
||||
} from '/imports/api/note/server/helpers';
|
||||
import addNote from '/imports/api/note/server/modifiers/addNote';
|
||||
import axios from 'axios';
|
||||
@ -14,14 +16,14 @@ import axios from 'axios';
|
||||
export default function createNote(meetingId, instanceId) {
|
||||
// Avoid note creation if this feature is disabled
|
||||
if (!isEnabled()) {
|
||||
Logger.warn(`Notes are disabled for ${meetingId}`);
|
||||
Logger.warn(`Shared notes are disabled`);
|
||||
return;
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(instanceId, Number);
|
||||
|
||||
const noteId = withInstaceId(instanceId, generateNoteId(meetingId));
|
||||
const noteId = withInstaceId(instanceId, generatePadId(meetingId));
|
||||
|
||||
const createURL = createPadURL(noteId);
|
||||
|
||||
|
@ -118,7 +118,10 @@ const getCaptionsSettings = () => {
|
||||
return settings;
|
||||
};
|
||||
|
||||
const isCaptionsEnabled = () => CAPTIONS_CONFIG.enabled;
|
||||
const isCaptionsEnabled = () => {
|
||||
const captions = Captions.findOne({ meetingId: Auth.meetingID });
|
||||
return CAPTIONS_CONFIG.enabled && captions;
|
||||
};
|
||||
|
||||
const isCaptionsAvailable = () => {
|
||||
if (isCaptionsEnabled) {
|
||||
|
Loading…
Reference in New Issue
Block a user