[mirotalksfu] - refactoring
هذا الالتزام موجود في:
@@ -23,7 +23,7 @@ Powered by `WebRTC` with [SFU](https://mediasoup.org) integrated server.
|
|||||||
|
|
||||||
## DigitalOcean
|
## DigitalOcean
|
||||||
|
|
||||||
This application has been tested and `works perfectly` on [DigitalOcean](https://m.do.co/c/1070207afbb1) `droplet Ubuntu 20.04 (LTS) x64`, with [Ngnix](https://www.nginx.com/) and [Let's encrypt](https://letsencrypt.org/).
|
This application has been tested on [DigitalOcean](https://m.do.co/c/1070207afbb1) `droplet Ubuntu 20.04 (LTS) x64`, with [Ngnix](https://www.nginx.com/) and [Let's Encrypt](https://letsencrypt.org/).
|
||||||
|
|
||||||
[](https://www.digitalocean.com/?refcode=1070207afbb1&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
|
[](https://www.digitalocean.com/?refcode=1070207afbb1&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<script src="https://kit.fontawesome.com/d2f1016e6f.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/d2f1016e6f.js" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.rawgit.com/muaz-khan/DetectRTC/master/DetectRTC.js"></script>
|
<script src="https://cdn.rawgit.com/muaz-khan/DetectRTC/master/DetectRTC.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.1.2"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.1.4"></script>
|
||||||
<script src="https://unpkg.com/emoji-picker-element@1" type="module"></script>
|
<script src="https://unpkg.com/emoji-picker-element@1" type="module"></script>
|
||||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||||
<script src="https://unpkg.com/tippy.js@6"></script>
|
<script src="https://unpkg.com/tippy.js@6"></script>
|
||||||
|
|||||||
@@ -539,12 +539,8 @@ button:hover {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#roomParticipants ul {
|
|
||||||
text-align: justify;
|
|
||||||
list-style: inside;
|
|
||||||
}
|
|
||||||
|
|
||||||
#roomParticipants button {
|
#roomParticipants button {
|
||||||
|
background: transparent;
|
||||||
color: red;
|
color: red;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
@@ -553,6 +549,25 @@ button:hover {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#roomParticipants table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#roomParticipants td,
|
||||||
|
#roomParticipants th {
|
||||||
|
/* border: 1px solid #444444; */
|
||||||
|
color: white;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
#roomParticipants tr:nth-child(even) {
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*--------------------------------------------------------------
|
/*--------------------------------------------------------------
|
||||||
# Pulse class effect
|
# Pulse class effect
|
||||||
--------------------------------------------------------------*/
|
--------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ function appenChild(device, el) {
|
|||||||
function getPeerInfo() {
|
function getPeerInfo() {
|
||||||
peer_info = {
|
peer_info = {
|
||||||
detect_rtc_version: DetectRTC.version,
|
detect_rtc_version: DetectRTC.version,
|
||||||
is_webrtc_Supported: DetectRTC.isWebRTCSupported,
|
is_webrtc_supported: DetectRTC.isWebRTCSupported,
|
||||||
is_mobile_device: DetectRTC.isMobileDevice,
|
is_mobile_device: DetectRTC.isMobileDevice,
|
||||||
os_name: DetectRTC.osName,
|
os_name: DetectRTC.osName,
|
||||||
os_version: DetectRTC.osVersion,
|
os_version: DetectRTC.osVersion,
|
||||||
@@ -736,17 +736,20 @@ async function sound(name) {
|
|||||||
async function getRoomParticipants() {
|
async function getRoomParticipants() {
|
||||||
let room_info = await rc.getRoomInfo();
|
let room_info = await rc.getRoomInfo();
|
||||||
let peers = new Map(JSON.parse(room_info.peers));
|
let peers = new Map(JSON.parse(room_info.peers));
|
||||||
let lists = `<div id="roomParticipants"><ul>`;
|
let table = `<div id="roomParticipants"><table>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>`;
|
||||||
for (let peer of Array.from(peers.keys())) {
|
for (let peer of Array.from(peers.keys())) {
|
||||||
let peer_info = peers.get(peer).peer_info;
|
let peer_info = peers.get(peer).peer_info;
|
||||||
let peer_name = peer_info.peer_name;
|
let peer_name = peer_info.peer_name;
|
||||||
let peer_id = peer_info.peer_id;
|
let peer_id = peer_info.peer_id;
|
||||||
rc.peer_id === peer_id
|
rc.peer_id === peer_id
|
||||||
? (lists += `<li>👤 ${peer_name} (me)</li>`)
|
? (table += `<tr><td>👤 ${peer_name} (me)</td><td></td></tr>`)
|
||||||
: (lists += `<li id='${peer_id}'>👤 ${peer_name} <button id='${peer_id}' onclick="rc.peerAction('me',this.id,'eject')">eject</button></li>`);
|
: (table += `<tr id='${peer_id}'><td>👤 ${peer_name}</td><td><button id='${peer_id}' onclick="rc.peerAction('me',this.id,'eject')">eject</button></td></tr>`);
|
||||||
}
|
}
|
||||||
lists += `</ul></div>`;
|
table += `</table></div>`;
|
||||||
|
|
||||||
sound('open');
|
sound('open');
|
||||||
|
|
||||||
@@ -754,7 +757,7 @@ async function getRoomParticipants() {
|
|||||||
background: swalBackground,
|
background: swalBackground,
|
||||||
position: 'center',
|
position: 'center',
|
||||||
title: `Participants ${peers.size}`,
|
title: `Participants ${peers.size}`,
|
||||||
html: lists,
|
html: table,
|
||||||
showClass: {
|
showClass: {
|
||||||
popup: 'animate__animated animate__fadeInDown',
|
popup: 'animate__animated animate__fadeInDown',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<!-- Title and Icon -->
|
<!-- Title and Icon -->
|
||||||
|
|
||||||
<title>MiroTalk SFU a Free Video Calls and Screen Sharing.</title>
|
<title>MiroTalk SFU - Free Video Calls, Messaging and Screen Sharing.</title>
|
||||||
<link rel="shortcut icon" href="images/logo.svg" />
|
<link rel="shortcut icon" href="images/logo.svg" />
|
||||||
<link rel="apple-touch-icon" href="images/logo.svg" />
|
<link rel="apple-touch-icon" href="images/logo.svg" />
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,21 @@
|
|||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
const app = express();
|
|
||||||
const compression = require('compression');
|
const compression = require('compression');
|
||||||
const https = require('httpolyglot');
|
const https = require('httpolyglot');
|
||||||
const fs = require('fs');
|
|
||||||
const mediasoup = require('mediasoup');
|
const mediasoup = require('mediasoup');
|
||||||
const config = require('./config');
|
const config = require('./config');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const ngrok = require('ngrok');
|
const ngrok = require('ngrok');
|
||||||
|
const fs = require('fs');
|
||||||
const Room = require('./Room');
|
const Room = require('./Room');
|
||||||
const Peer = require('./Peer');
|
const Peer = require('./Peer');
|
||||||
const ServerApi = require('./ServerApi');
|
const ServerApi = require('./ServerApi');
|
||||||
const Logger = require('./Logger');
|
const Logger = require('./Logger');
|
||||||
const log = new Logger('Server');
|
const log = new Logger('Server');
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
key: fs.readFileSync(path.join(__dirname, config.sslKey), 'utf-8'),
|
key: fs.readFileSync(path.join(__dirname, config.sslKey), 'utf-8'),
|
||||||
cert: fs.readFileSync(path.join(__dirname, config.sslCrt), 'utf-8'),
|
cert: fs.readFileSync(path.join(__dirname, config.sslCrt), 'utf-8'),
|
||||||
@@ -23,7 +24,7 @@ const options = {
|
|||||||
|
|
||||||
const httpsServer = https.createServer(options, app);
|
const httpsServer = https.createServer(options, app);
|
||||||
const io = require('socket.io')(httpsServer);
|
const io = require('socket.io')(httpsServer);
|
||||||
const localHost = 'https://' + 'localhost' + ':' + config.listenPort; // config.listenIp
|
const host = 'https://' + 'localhost' + ':' + config.listenPort; // config.listenIp
|
||||||
|
|
||||||
// all mediasoup workers
|
// all mediasoup workers
|
||||||
let workers = [];
|
let workers = [];
|
||||||
@@ -130,8 +131,8 @@ async function ngrokStart() {
|
|||||||
let pu1 = data.tunnels[1].public_url;
|
let pu1 = data.tunnels[1].public_url;
|
||||||
let tunnel = pu0.startsWith('https') ? pu0 : pu1;
|
let tunnel = pu0.startsWith('https') ? pu0 : pu1;
|
||||||
log.debug('Listening on', {
|
log.debug('Listening on', {
|
||||||
https: localHost,
|
server: host,
|
||||||
ngrok: tunnel,
|
tunnel: tunnel,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Ngrok Start error: ', err);
|
console.error('Ngrok Start error: ', err);
|
||||||
@@ -149,7 +150,7 @@ httpsServer.listen(config.listenPort, () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.debug('Listening on', {
|
log.debug('Listening on', {
|
||||||
https: localHost,
|
server: host,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم