c0a7f9cd92
When managing Etherpad's pads, Meteor makes API calls to initiate the closed captions and shared notes modules. The pad id was being mapped to a shorter id than the meeting id because of a Etherpad lenght limitation. Changed to something less guessable.
32 lines
930 B
JavaScript
32 lines
930 B
JavaScript
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 { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
export default function appendText(text, locale) {
|
|
const { meetingId } = extractCredentials(this.userId);
|
|
check(meetingId, String);
|
|
check(text, String);
|
|
check(locale, String);
|
|
|
|
const padId = generatePadId(meetingId, locale);
|
|
|
|
axios({
|
|
method: 'get',
|
|
url: appendTextURL(padId, text),
|
|
responseType: 'json',
|
|
}).then((response) => {
|
|
const { status } = response;
|
|
if (status !== 200) {
|
|
Logger.error(`Could not append captions for padId=${padId}`);
|
|
return;
|
|
}
|
|
}).catch(error => Logger.error(`Could not append captions for padId=${padId}: ${error}`));
|
|
}
|