diff --git a/README.md b/README.md index fe98fd35..4ce08dc0 100644 --- a/README.md +++ b/README.md @@ -107,13 +107,14 @@
- You can `directly join a room` by using links like: -- https://p2p.mirotalk.com/join?room=test&name=mirotalk&audio=0&video=0&screen=0&hide=0¬ify=0 -- https://mirotalk.up.railway.app/join?room=test&name=mirotalk&audio=0&video=0&screen=0&hide=0¬ify=0 +- https://p2p.mirotalk.com/join?room=test&name=mirotalk&avatar=0&audio=0&video=0&screen=0&hide=0¬ify=0 +- https://mirotalk.up.railway.app/join?room=test&name=mirotalk&avatar=0&audio=0&video=0&screen=0&hide=0¬ify=0 | Params | Type | Description | | ------ | ------- | --------------- | | room | string | Room Id | | name | string | User name | + | avatar | Mixed | User avatar | | audio | boolean | Audio stream | | video | boolean | Video stream | | screen | boolean | Screen stream | @@ -233,33 +234,56 @@ To embed a meeting within `your service or app` using an iframe, you can use the - `Rest API:` The [API documentation](https://docs.mirotalk.com/mirotalk-p2p/api/) uses [swagger](https://swagger.io/) at http://localhost:3000/api/v1/docs. Or check it out on [live](https://p2p.mirotalk.com/api/v1/docs). +### 1. Stats Endpoint (Get server statistics) + ```bash -# The response will give you the total of rooms and peers. -$ curl -X GET "http://localhost:3000/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X GET "https://p2p.mirotalk.com/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X GET "https://mirotalk.up.railway.app/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -# The response will give you the active meetings (default disabled). -$ curl -X GET "http://localhost:3000/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X GET "https://p2p.mirotalk.com/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X GET "mirotalk.up.railway.app/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -# The response will give you a entrypoint / Room URL for your meeting. -$ curl -X POST "http://localhost:3000/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X POST "https://p2p.mirotalk.com/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -$ curl -X POST "https://mirotalk.up.railway.app/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" -# The response will give you a entrypoint / URL for the direct join to the meeting. -$ curl -X POST "http://localhost:3000/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true"}' -$ curl -X POST "https://p2p.mirotalk.com/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true"}' -$ curl -X POST "https://mirotalk.up.railway.app/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true"}' -# The response will give you an entry point/URL for direct joining to the meeting with a token. -$ curl -X POST "http://localhost:3000/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true","token":{"username":"username","password":"password","presenter":"true", "expire":"1h"}}' -$ curl -X POST "https://p2p.mirotalk.com/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true","token":{"username":"username","password":"password","presenter":"true", "expire":"1h"}}' -$ curl -X POST "https://mirotalk.up.railway.app/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true","token":{"username":"username","password":"password","presenter":"true", "expire":"1h"}}' -# The response will give you a valid token for a meeting. -$ curl -X POST "http://localhost:3000/api/v1/token" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":"true", "expire":"1h"}' -$ curl -X POST "https://p2p.mirotalk.com/api/v1/token" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":"true", "expire":"1h"}' -$ curl -X POST "https://mirotalk.up.railway.app/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":"true", "expire":"1h"}' +curl -X GET "http://localhost:3000/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X GET "https://p2p.mirotalk.com/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X GET "https://mirotalk.up.railway.app/api/v1/stats" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" ``` +### 2. Meetings Endpoint (Get active meetings) + +```bash +curl -X GET "http://localhost:3000/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X GET "https://p2p.mirotalk.com/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X GET "https://mirotalk.up.railway.app/api/v1/meetings" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +``` + +### 3. Create Meeting + +```bash +curl -X POST "http://localhost:3000/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X POST "https://p2p.mirotalk.com/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +curl -X POST "https://mirotalk.up.railway.app/api/v1/meeting" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" +``` + +### 4. Join Meeting (Basic) + +```bash +curl -X POST "http://localhost:3000/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","avatar":false,"audio":true,"video":true,"screen":false,"hide":false,"notify":true}' +curl -X POST "https://p2p.mirotalk.com/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","avatar":false,"audio":true,"video":true,"screen":false,"hide":false,"notify":true}' +curl -X POST "https://mirotalk.up.railway.app/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","avatar":false,"audio":true,"video":true,"screen":false,"hide":false,"notify":true}' +``` + +### 5. Join Meeting with Token + +```bash +curl -X POST "http://localhost:3000/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":true,"video":true,"screen":false,"hide":false,"notify":true,"token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}' +curl -X POST "https://p2p.mirotalk.com/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":true,"video":true,"screen":false,"hide":false,"notify":true,"token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}' +curl -X POST "https://mirotalk.up.railway.app/api/v1/join" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalk","audio":true,"video":true,"screen":false,"hide":false,"notify":true,"token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}' +``` + +### 6. Generate Token + +```bash +curl -X POST "http://localhost:3000/api/v1/token" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":true,"expire":"1h"}' +curl -X POST "https://p2p.mirotalk.com/api/v1/token" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":true,"expire":"1h"}' +curl -X POST "https://mirotalk.up.railway.app/api/v1/token" -H "authorization: mirotalkp2p_default_secret" -H "Content-Type: application/json" --data '{"username":"username","password":"password","presenter":true,"expire":"1h"}' +``` + +These commands should now work correctly with the MiroTalk P2P +
diff --git a/app/api/join/join.js b/app/api/join/join.js index 1e4179ac..2783780a 100644 --- a/app/api/join/join.js +++ b/app/api/join/join.js @@ -21,8 +21,9 @@ async function getJoin() { body: JSON.stringify({ room: 'test', name: 'mirotalk', - audio: true, - video: true, + avatar: false, + audio: false, + video: false, screen: false, hide: false, notify: true, diff --git a/app/api/join/join.php b/app/api/join/join.php index 4dbca02c..6851b340 100644 --- a/app/api/join/join.php +++ b/app/api/join/join.php @@ -20,8 +20,9 @@ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $data = array( "room" => "test", "name" => "mirotalk", - "audio" => true, - "video" => true, + "avatar" => false, + "audio" => false, + "video" => false, "screen" => false, "hide" => false, "notify" => true, diff --git a/app/api/join/join.py b/app/api/join/join.py index e6af1df9..858e5a9e 100644 --- a/app/api/join/join.py +++ b/app/api/join/join.py @@ -15,8 +15,9 @@ headers = { data = { "room": "test", "name": "mirotalk", - "audio": "true", - "video": "true", + "avatar": "false", + "audio": "false", + "video": "false", "screen": "false", "hide": "false", "notify": "true", diff --git a/app/api/join/join.sh b/app/api/join/join.sh index 09656044..a7b22e6d 100755 --- a/app/api/join/join.sh +++ b/app/api/join/join.sh @@ -1,12 +1,32 @@ #!/bin/bash +# Configuration API_KEY_SECRET="mirotalkp2p_default_secret" MIROTALK_URL="https://p2p.mirotalk.com/api/v1/join" +# Alternative URLs: # MIROTALK_URL="http://localhost:3000/api/v1/join" -# MIROTALK_URL = "https://mirotalk.up.railway.app/api/v1/join" +# MIROTALK_URL="https://mirotalk.up.railway.app/api/v1/join" -curl $MIROTALK_URL \ - --header "authorization: $API_KEY_SECRET" \ - --header "Content-Type: application/json" \ - --data '{"room":"test","name":"mirotalk","audio":"true","video":"true","screen":"false","hide":"false","notify":"true","token":{"username":"username","password":"password","presenter":"true", "expire":"1h"}}' \ - --request POST \ No newline at end of file +# Join request data +REQUEST_DATA='{ + "room": "test", + "name": "mirotalk", + "avatar": false, + "audio": false, + "video": false, + "screen": false, + "hide": false, + "notify": true, + "token": { + "username": "username", + "password": "password", + "presenter": true, + "expire": "1h" + } +}' + +# Make the API request +curl -X POST "$MIROTALK_URL" \ + -H "authorization: $API_KEY_SECRET" \ + -H "Content-Type: application/json" \ + -d "$REQUEST_DATA" \ No newline at end of file diff --git a/app/api/swagger.yaml b/app/api/swagger.yaml index 9c5dfb66..5eb7bc9b 100644 --- a/app/api/swagger.yaml +++ b/app/api/swagger.yaml @@ -84,6 +84,9 @@ paths: name: type: string default: 'mirotalk' + avatar: + type: string + default: '' audio: type: boolean default: false @@ -222,6 +225,8 @@ definitions: properties: peer_name: type: string + peer_avatar: + type: string peer_presenter: type: boolean peer_video: diff --git a/app/src/api.js b/app/src/api.js index f4298b24..0a594618 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -53,10 +53,11 @@ module.exports = class ServerApi { getJoinURL(data) { // Get data - const { room, name, audio, video, screen, notify, hide, token } = data; + const { room, name, avatar, audio, video, screen, notify, hide, token } = data; const roomValue = room || uuidV4(); const nameValue = name || 'User-' + this.getRandomNumber(); + const avatarValue = avatar || false; const audioValue = audio || false; const videoValue = video || false; const screenValue = screen || false; @@ -70,6 +71,7 @@ module.exports = class ServerApi { '/join?' + `room=${roomValue}` + `&name=${encodeURIComponent(nameValue)}` + + `&avatar=${encodeURIComponent(avatarValue)}` + `&audio=${audioValue}` + `&video=${videoValue}` + `&screen=${screenValue}` + diff --git a/app/src/server.js b/app/src/server.js index 6b5b46c9..5a2bb6ea 100755 --- a/app/src/server.js +++ b/app/src/server.js @@ -45,7 +45,7 @@ dependencies: { * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.4.99 + * @version 1.5.00 * */ @@ -1204,6 +1204,7 @@ io.sockets.on('connect', async (socket) => { channel_password, peer_uuid, peer_name, + peer_avatar, peer_token, peer_video, peer_audio, @@ -1310,6 +1311,7 @@ io.sockets.on('connect', async (socket) => { // collect peers info grp by channels peers[channel][socket.id] = { peer_name: peer_name, + peer_avatar: peer_avatar, peer_presenter: isPresenter, peer_video: peer_video, peer_audio: peer_audio, @@ -1458,7 +1460,7 @@ io.sockets.on('connect', async (socket) => { // Prevent XSS injection const config = checkXSS(cfg); // log.debug('Peer name', config); - const { room_id, peer_name_old, peer_name_new } = config; + const { room_id, peer_name_old, peer_name_new, peer_avatar } = config; let peer_id_to_update = null; @@ -1481,6 +1483,7 @@ io.sockets.on('connect', async (socket) => { const data = { peer_id: peer_id_to_update, peer_name: peer_name_new, + peer_avatar: peer_avatar, }; log.debug('[' + socket.id + '] emit peerName to [room_id: ' + room_id + ']', data); @@ -1556,7 +1559,8 @@ io.sockets.on('connect', async (socket) => { // Prevent XSS injection const config = checkXSS(cfg); // log.debug('Peer action', config); - const { room_id, peer_id, peer_uuid, peer_name, peer_use_video, peer_action, send_to_all } = config; + const { room_id, peer_id, peer_uuid, peer_name, peer_avatar, peer_use_video, peer_action, send_to_all } = + config; // Only the presenter can do this actions const presenterActions = ['muteAudio', 'hideVideo', 'ejectAll']; @@ -1570,6 +1574,7 @@ io.sockets.on('connect', async (socket) => { const data = { peer_id: peer_id, peer_name: peer_name, + peer_avatar: peer_avatar, peer_action: peer_action, peer_use_video: peer_use_video, }; @@ -1622,7 +1627,7 @@ io.sockets.on('connect', async (socket) => { // Prevent XSS injection const config = checkXSS(cfg); // log.debug('File info', config); - const { room_id, peer_id, peer_name, broadcast, file } = config; + const { room_id, peer_id, peer_name, peer_avatar, broadcast, file } = config; // check if valid fileName if (!isValidFileName(file.fileName)) { @@ -1639,6 +1644,7 @@ io.sockets.on('connect', async (socket) => { log.debug('[' + socket.id + '] Peer [' + peer_name + '] send file to room_id [' + room_id + ']', { peerName: peer_name, + peerAvatar: peer_avatar, fileName: file.fileName, fileSize: bytesToSize(file.fileSize), fileType: file.fileType, diff --git a/package.json b/package.json index 377d33e5..5f511fa3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalk", - "version": "1.4.99", + "version": "1.5.00", "description": "A free WebRTC browser-based video call", "main": "server.js", "scripts": { @@ -61,7 +61,7 @@ "jsonwebtoken": "^9.0.2", "js-yaml": "^4.1.0", "nodemailer": "^6.10.0", - "openai": "^4.91.1", + "openai": "^4.92.1", "qs": "^6.14.0", "socket.io": "^4.8.1", "swagger-ui-express": "^5.0.1", diff --git a/public/images/admin.png b/public/images/admin.png new file mode 100644 index 00000000..07856acd Binary files /dev/null and b/public/images/admin.png differ diff --git a/public/js/brand.js b/public/js/brand.js index 4e591125..a317c187 100644 --- a/public/js/brand.js +++ b/public/js/brand.js @@ -73,7 +73,7 @@ let brand = { }, about: { imageUrl: '../images/mirotalk-logo.gif', - title: 'WebRTC P2P v1.4.99', + title: 'WebRTC P2P v1.5.00', html: `