bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/captions/pad/service.js

40 lines
1018 B
JavaScript
Raw Normal View History

import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import Settings from '/imports/ui/services/settings';
const NOTE_CONFIG = Meteor.settings.public.note;
const getLang = () => {
const { locale } = Settings.application;
return locale ? locale.toLowerCase() : '';
};
const getPadParams = () => {
2021-03-07 22:29:10 +08:00
const config = {};
config.lang = getLang();
config.rtl = document.documentElement.getAttribute('dir') === 'rtl';
const params = [];
2019-05-29 22:31:27 +08:00
Object.keys(config).forEach((k) => {
params.push(`${k}=${encodeURIComponent(config[k])}`);
});
return params.join('&');
};
const getPadURL = (padId, readOnlyPadId, ownerId) => {
const userId = Auth.userID;
const params = getPadParams();
let url;
if (!ownerId || (ownerId && userId === ownerId)) {
2019-05-29 22:31:27 +08:00
url = Auth.authenticateURL(`${NOTE_CONFIG.url}/p/${padId}?${params}`);
} else {
url = Auth.authenticateURL(`${NOTE_CONFIG.url}/p/${readOnlyPadId}?${params}`);
}
return url;
};
export default {
getPadURL,
};