Skip to content

Commit

Permalink
Jitsi room name hash or plain
Browse files Browse the repository at this point in the history
  • Loading branch information
jbguerraz authored and Jean-Baptiste Guerraz committed Jun 30, 2020
1 parent 1157075 commit e51b4cc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
9 changes: 7 additions & 2 deletions app/livechat/server/api/v1/videoCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ API.v1.addRoute('livechat/video.call/:token', {
Messages.createWithTypeRoomIdMessageAndUser('livechat_video_call', room._id, '', guest, {
actionLinks: config.theme.actionLinks,
});

let rname;
if (rcSettings.get('Jitsi_URL_Room_Hash')) {
rname = rcSettings.get('uniqueID') + rid;
} else {
rname = encodeURIComponent(room.t === 'd' ? room.usernames.join(' x ') : room.name);
}
const videoCall = {
rid,
domain: rcSettings.get('Jitsi_Domain'),
provider: 'jitsi',
room: rcSettings.get('Jitsi_URL_Room_Prefix') + rcSettings.get('uniqueID') + rid + rcSettings.get('Jitsi_URL_Room_Suffix'),
room: rcSettings.get('Jitsi_URL_Room_Prefix') + rname + rcSettings.get('Jitsi_URL_Room_Suffix'),
timeout: new Date(Date.now() + 3600 * 1000),
};

Expand Down
8 changes: 7 additions & 1 deletion app/livechat/server/methods/startVideoCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ Meteor.methods({
],
});

let rname;
if (settings.get('Jitsi_URL_Room_Hash')) {
rname = settings.get('uniqueID') + roomId;
} else {
rname = encodeURIComponent(room.t === 'd' ? room.usernames.join(' x ') : room.name);
}
return {
roomId: room._id,
domain: settings.get('Jitsi_Domain'),
jitsiRoom: settings.get('Jitsi_URL_Room_Prefix') + settings.get('uniqueID') + roomId + settings.get('Jitsi_URL_Room_Suffix'),
jitsiRoom: settings.get('Jitsi_URL_Room_Prefix') + rname + settings.get('Jitsi_URL_Room_Suffix'),
};
},
});
9 changes: 8 additions & 1 deletion app/videobridge/client/views/videoFlexTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ Template.videoFlexTab.onRendered(function() {
}

const domain = settings.get('Jitsi_Domain');
const jitsiRoom = settings.get('Jitsi_URL_Room_Prefix') + settings.get('uniqueID') + rid + settings.get('Jitsi_URL_Room_Suffix');
let rname;
if (settings.get('Jitsi_URL_Room_Hash')) {
rname = settings.get('uniqueID') + rid;
} else {
const room = Rooms.findOne({ _id: rid });
rname = encodeURIComponent(room.t === 'd' ? room.usernames.join(' x ') : room.name);
}
const jitsiRoom = settings.get('Jitsi_URL_Room_Prefix') + rname + settings.get('Jitsi_URL_Room_Suffix');
const noSsl = !settings.get('Jitsi_SSL');
const isEnabledTokenAuth = settings.get('Jitsi_Enabled_TokenAuth');

Expand Down
9 changes: 7 additions & 2 deletions app/videobridge/server/methods/jitsiGenerateToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ Meteor.methods({
throw new Meteor.Error('error-not-allowed', 'not allowed', { method: 'jitsi:generateToken' });
}

const jitsiRoom = settings.get('Jitsi_URL_Room_Prefix') + settings.get('uniqueID') + rid + settings.get('Jitsi_URL_Room_Suffix');

let rname;
if (settings.get('Jitsi_URL_Room_Hash')) {
rname = settings.get('uniqueID') + rid;
} else {
rname = encodeURIComponent(room.t === 'd' ? room.usernames.join(' x ') : room.name);
}
const jitsiRoom = settings.get('Jitsi_URL_Room_Prefix') + rname + settings.get('Jitsi_URL_Room_Suffix');
const jitsiDomain = settings.get('Jitsi_Domain');
const jitsiApplicationId = settings.get('Jitsi_Application_ID');
const jitsiApplicationSecret = settings.get('Jitsi_Application_Secret');
Expand Down
11 changes: 11 additions & 0 deletions app/videobridge/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ Meteor.startup(function() {
public: true,
});

this.add('Jitsi_URL_Room_Hash', true, {
type: 'boolean',
enableQuery: {
_id: 'Jitsi_Enabled',
value: true,
},
i18nLabel: 'URL_room_hash',
i18nDescription: 'URL_room_hash_description',
public: true,
});

this.add('Jitsi_SSL', true, {
type: 'boolean',
enableQuery: {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3644,6 +3644,8 @@
"URL": "URL",
"URL_room_prefix": "URL room prefix",
"URL_room_suffix": "URL room suffix",
"URL_room_hash": "Enable room name hash",
"URL_room_hash_description": "Recommended to enable if the Jitsi instance doesn't use any authentication mechanism.",
"Use_Server_configuration": "Use server configuration",
"Use_Room_configuration": "Overwrites the server configuration and use room config",
"Use_account_preference": "Use account preference",
Expand Down

0 comments on commit e51b4cc

Please sign in to comment.