[mirotalksfu] - improvements

هذا الالتزام موجود في:
Miroslav Pejic
2024-04-16 18:47:56 +02:00
الأصل c336a0884d
التزام f66acb7b34
2 ملفات معدلة مع 26 إضافات و18 حذوفات

عرض الملف

@@ -899,6 +899,9 @@ function startServer() {
const room = roomList.get(socket.room_id); const room = roomList.get(socket.room_id);
const { peer_name, peer_id, peer_uuid, os_name, os_version, browser_name, browser_version } =
data.peer_info;
// User Auth required, we check if peer valid // User Auth required, we check if peer valid
if (hostCfg.user_auth) { if (hostCfg.user_auth) {
// Check JWT // Check JWT
@@ -935,9 +938,7 @@ function startServer() {
} }
// check if banned... // check if banned...
const peerUUID = data.peer_info.peer_uuid; if (room.isBanned(peer_uuid)) {
if (room.isBanned(peerUUID)) {
const { peer_name, peer_uuid, os_name, os_version, browser_name, browser_version } = data.peer_info;
log.info('[Join] - peer is banned!', { log.info('[Join] - peer is banned!', {
room_id: data.room_id, room_id: data.room_id,
peer: { peer: {
@@ -960,14 +961,6 @@ function startServer() {
if (!(socket.room_id in presenters)) presenters[socket.room_id] = {}; if (!(socket.room_id in presenters)) presenters[socket.room_id] = {};
const peerInfo = room.getPeers()?.get(socket.id)?.peer_info || {};
const peer_id = peerInfo?.peer_id || '';
const peer_name = peerInfo?.peer_name || '';
const peer_uuid = peerInfo?.peer_uuid || '';
// Set the presenters // Set the presenters
const presenter = { const presenter = {
peer_ip: peer_ip, peer_ip: peer_ip,
@@ -1020,7 +1013,12 @@ function startServer() {
// SCENARIO: Notify when the first user join room and is awaiting assistance... // SCENARIO: Notify when the first user join room and is awaiting assistance...
if (room.getPeersCount() === 1) { if (room.getPeersCount() === 1) {
nodemailer.sendEmailAlert('join', { peer_name: peer_name, room_id: room.id }); // config.email.alert: true nodemailer.sendEmailAlert('join', {
room_id: room.id,
peer_name: peer_name,
os: os_name ? `${os_name} ${os_version}` : '',
browser: browser_name ? `${browser_name} ${browser_version}` : '',
}); // config.email.alert: true
} }
cb(room.toJson()); cb(room.toJson());

عرض الملف

@@ -53,9 +53,8 @@ function sendEmailAlert(event, data) {
switch (event) { switch (event) {
case 'join': case 'join':
const { peer_name, room_id } = data; subject = getJoinRoomSubject(data);
subject = getJoinRoomSubject(room_id); body = getJoinRoomBody(data);
body = getJoinRoomBody(peer_name, room_id);
break; break;
// ... // ...
default: default:
@@ -80,11 +79,14 @@ function sendEmail(subject, body) {
// EMAIL TEMPLATES // EMAIL TEMPLATES
// #################################################### // ####################################################
function getJoinRoomSubject(room_id) { function getJoinRoomSubject(data) {
const { room_id } = data;
return `MiroTalk SFU - New user Join to Room ${room_id}`; return `MiroTalk SFU - New user Join to Room ${room_id}`;
} }
function getJoinRoomBody(peer_name, room_id) { function getJoinRoomBody(data) {
const { peer_name, room_id, os, browser } = data;
const currentDataTime = getCurrentDataTime(); const currentDataTime = getCurrentDataTime();
return ` return `
<h1>New user join</h1> <h1>New user join</h1>
<style> <style>
@@ -107,12 +109,20 @@ function getJoinRoomBody(peer_name, room_id) {
<td>User</td> <td>User</td>
<td>${peer_name}</td> <td>${peer_name}</td>
</tr> </tr>
<tr>
<td>Os</td>
<td>${os}</td>
</tr>
<tr>
<td>Browser</td>
<td>${browser}</td>
</tr>
<tr> <tr>
<td>Room</td> <td>Room</td>
<td>${ROOM_URL}${room_id}</td> <td>${ROOM_URL}${room_id}</td>
</tr> </tr>
<tr> <tr>
<td>Time</td> <td>Date, Time</td>
<td>${currentDataTime}</td> <td>${currentDataTime}</td>
</tr> </tr>
</table> </table>