[mirotalk] - add chat in query params, update widget
This commit is contained in:
@@ -107,8 +107,8 @@
|
||||
<br/>
|
||||
|
||||
- You can `directly join a room` by using links like:
|
||||
- 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
|
||||
- https://p2p.mirotalk.com/join?room=test&name=mirotalk&avatar=0&audio=0&video=0&screen=0&chat=0&hide=0¬ify=0
|
||||
- https://mirotalk.up.railway.app/join?room=test&name=mirotalk&avatar=0&audio=0&video=0&screen=0&chat=0&hide=0¬ify=0
|
||||
|
||||
| Params | Type | Description |
|
||||
| ------ | ------- | --------------- |
|
||||
@@ -118,6 +118,7 @@
|
||||
| audio | boolean | Audio stream |
|
||||
| video | boolean | Video stream |
|
||||
| screen | boolean | Screen stream |
|
||||
| chat. | boolean | Chat |
|
||||
| hide | boolean | Hide myself |
|
||||
| notify | boolean | Welcome message |
|
||||
| token | string | jwt token |
|
||||
@@ -261,17 +262,17 @@ curl -X POST "https://mirotalk.up.railway.app/api/v1/meeting" -H "authorization:
|
||||
### 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}'
|
||||
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,"chat":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,"chat":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,"chat":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"}}'
|
||||
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,"chat":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,"chat":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,"chat":false,"hide":false,"notify":true,"token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}'
|
||||
```
|
||||
|
||||
### 6. Generate Token
|
||||
|
||||
@@ -25,6 +25,7 @@ async function getJoin() {
|
||||
audio: false,
|
||||
video: false,
|
||||
screen: false,
|
||||
chat: false,
|
||||
hide: false,
|
||||
notify: true,
|
||||
token: {
|
||||
|
||||
@@ -24,6 +24,7 @@ $data = array(
|
||||
"audio" => false,
|
||||
"video" => false,
|
||||
"screen" => false,
|
||||
"chat" => false,
|
||||
"hide" => false,
|
||||
"notify" => true,
|
||||
"token" => array(
|
||||
|
||||
@@ -19,6 +19,7 @@ data = {
|
||||
"audio": "false",
|
||||
"video": "false",
|
||||
"screen": "false",
|
||||
"chat": "false",
|
||||
"hide": "false",
|
||||
"notify": "true",
|
||||
"token": {
|
||||
|
||||
@@ -15,6 +15,7 @@ REQUEST_DATA='{
|
||||
"audio": false,
|
||||
"video": false,
|
||||
"screen": false,
|
||||
"chat": false,
|
||||
"hide": false,
|
||||
"notify": true,
|
||||
"token": {
|
||||
|
||||
@@ -96,6 +96,9 @@ paths:
|
||||
screen:
|
||||
type: boolean
|
||||
default: false
|
||||
chat:
|
||||
type: boolean
|
||||
default: false
|
||||
hide:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
+5
-5
@@ -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.5.54
|
||||
* @version 1.5.55
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -612,11 +612,11 @@ app.get('/join/', async (req, res) => {
|
||||
if (Object.keys(req.query).length > 0) {
|
||||
log.debug('Request Query', req.query);
|
||||
/*
|
||||
http://localhost:3000/join?room=test&name=mirotalk&audio=1&video=1&screen=0¬ify=0&hide=0
|
||||
https://p2p.mirotalk.com/join?room=test&name=mirotalk&audio=1&video=1&screen=0¬ify=0&hide=0
|
||||
https://mirotalk.up.railway.app/join?room=test&name=mirotalk&audio=1&video=1&screen=0¬ify=0&hide=0
|
||||
http://localhost:3000/join?room=test&name=mirotalk&audio=1&video=1&screen=0&chat=1¬ify=0&hide=0
|
||||
https://p2p.mirotalk.com/join?room=test&name=mirotalk&audio=1&video=1&screen=0&chat=1¬ify=0&hide=0
|
||||
https://mirotalk.up.railway.app/join?room=test&name=mirotalk&audio=1&video=1&screen=0&chat=1¬ify=0&hide=0
|
||||
*/
|
||||
const { room, name, audio, video, screen, notify, hide, token } = checkXSS(req.query);
|
||||
const { room, name, audio, video, screen, chat, notify, hide, token } = checkXSS(req.query);
|
||||
|
||||
if (!room) {
|
||||
log.warn('/join/params room empty', room);
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.54",
|
||||
"version": "1.5.55",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.54",
|
||||
"version": "1.5.55",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@mattermost/client": "10.9.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.5.54",
|
||||
"version": "1.5.55",
|
||||
"description": "A free WebRTC browser-based video call",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -56,7 +56,7 @@ pre {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
a {
|
||||
a {#020202
|
||||
background-color: transparent;
|
||||
-webkit-text-decoration-skip: objects;
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ let brand = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: 'WebRTC P2P v1.5.54',
|
||||
title: 'WebRTC P2P v1.5.55',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
+33
-2
@@ -15,7 +15,7 @@
|
||||
* @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.5.54
|
||||
* @version 1.5.55
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -534,6 +534,7 @@ let myVideoStatusBefore = false;
|
||||
let myScreenStatus = false;
|
||||
let isScreenEnabled = getScreenEnabled();
|
||||
let notify = getNotify(); // popup room sharing on join
|
||||
let chat = getChat(); // popup chat on join
|
||||
let notifyBySound = true; // turn on - off sound notifications
|
||||
let isPeerReconnected = false;
|
||||
|
||||
@@ -1025,6 +1026,25 @@ function getNotify() {
|
||||
return notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if chat is set
|
||||
* @returns {boolean} true/false
|
||||
*/
|
||||
function getChat() {
|
||||
let qs = new URLSearchParams(window.location.search);
|
||||
let chat = filterXSS(qs.get('chat'));
|
||||
if (chat) {
|
||||
let queryChat = chat === '1' || chat === 'true';
|
||||
if (queryChat != null) {
|
||||
console.log('Direct join', { chat: queryChat });
|
||||
notify = false; // From widget disable notify on join...
|
||||
return queryChat;
|
||||
}
|
||||
}
|
||||
console.log('Direct join', { chat: chat });
|
||||
return chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Peer JWT
|
||||
* @returns {mixed} boolean false or token string
|
||||
@@ -1298,6 +1318,8 @@ function handleServerInfo(config) {
|
||||
} else {
|
||||
checkShareScreen();
|
||||
}
|
||||
|
||||
checkChatOnJoin();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3390,6 +3412,15 @@ function checkShareScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open chat on Join
|
||||
*/
|
||||
function checkChatOnJoin() {
|
||||
if (chat) {
|
||||
chatRoomBtn.click();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Remote Media Stream obj
|
||||
* @param {MediaStream} stream media stream audio - video
|
||||
@@ -11242,7 +11273,7 @@ function showAbout() {
|
||||
Swal.fire({
|
||||
background: swBg,
|
||||
position: 'center',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.54',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.55',
|
||||
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
|
||||
customClass: { image: 'img-about' },
|
||||
html: `
|
||||
|
||||
@@ -6,6 +6,7 @@ class IframeApi {
|
||||
audio: false,
|
||||
video: false,
|
||||
screen: false,
|
||||
chat: false,
|
||||
hide: false,
|
||||
notify: false,
|
||||
width: '100vw',
|
||||
@@ -49,6 +50,7 @@ class IframeApi {
|
||||
audio: this.options.audio ? 1 : 0,
|
||||
video: this.options.video ? 1 : 0,
|
||||
screen: this.options.screen ? 1 : 0,
|
||||
chat: this.options.chat ? 1 : 0,
|
||||
hide: this.options.hide ? 1 : 0,
|
||||
notify: this.options.notify ? 1 : 0,
|
||||
});
|
||||
|
||||
+23
-4
@@ -155,7 +155,7 @@ class MiroTalkWidget {
|
||||
|
||||
async loadSupportWidgetAssets() {
|
||||
await this.injectExternalCSS(
|
||||
`${this.protocol}://${this.domain}/css/widgets/support.css`,
|
||||
`${this.protocol}://${this.domain}/css/widgets/Support.css`,
|
||||
'mirotalk-support-css'
|
||||
);
|
||||
}
|
||||
@@ -233,6 +233,9 @@ class MiroTalkWidget {
|
||||
buttons.push({ action: 'startScreenShare', icon: this.getScreenIcon(), text: 'Start Screen Share' });
|
||||
}
|
||||
|
||||
// Add chat button
|
||||
buttons.push({ action: 'startChat', icon: this.getChatIcon(), text: 'Start Chat' });
|
||||
|
||||
// Insert "Start Screen Share" before "Join Room" if present
|
||||
buttons.push({ action: 'joinRoom', icon: this.getJoinIcon(), text: 'Join Room' });
|
||||
|
||||
@@ -430,7 +433,7 @@ class MiroTalkWidget {
|
||||
startAudioCall() {
|
||||
if (this.isOnline) {
|
||||
console.log('Starting audio call...');
|
||||
this.openMeetingWindow({ audio: 1, video: 0, screen: 0 });
|
||||
this.openMeetingWindow({ audio: 1, video: 0, screen: 0, chat: 0 });
|
||||
} else {
|
||||
this.supportOffline();
|
||||
}
|
||||
@@ -439,7 +442,16 @@ class MiroTalkWidget {
|
||||
startVideoCall() {
|
||||
if (this.isOnline) {
|
||||
console.log('Starting video call...');
|
||||
this.openMeetingWindow({ audio: 0, video: 1, screen: 0 });
|
||||
this.openMeetingWindow({ audio: 0, video: 1, screen: 0, chat: 0 });
|
||||
} else {
|
||||
this.supportOffline();
|
||||
}
|
||||
}
|
||||
|
||||
startChat() {
|
||||
if (this.isOnline) {
|
||||
console.log('Starting chat...');
|
||||
this.openMeetingWindow({ audio: 0, video: 0, screen: 0, chat: 1 });
|
||||
} else {
|
||||
this.supportOffline();
|
||||
}
|
||||
@@ -448,7 +460,7 @@ class MiroTalkWidget {
|
||||
startScreenShare() {
|
||||
if (this.isOnline) {
|
||||
console.log('Starting screen share...');
|
||||
this.openMeetingWindow({ audio: 0, video: 0, screen: 1 });
|
||||
this.openMeetingWindow({ audio: 0, video: 0, screen: 1, chat: 0 });
|
||||
} else {
|
||||
this.supportOffline();
|
||||
}
|
||||
@@ -575,6 +587,12 @@ class MiroTalkWidget {
|
||||
</svg>`;
|
||||
}
|
||||
|
||||
getChatIcon() {
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" fill="white" width="16" height="16" viewBox="0 0 24 24">
|
||||
<path d="M21 6.5a2.5 2.5 0 0 0-2.5-2.5h-13A2.5 2.5 0 0 0 3 6.5v11A2.5 2.5 0 0 0 5.5 20H6v2l3-2h9.5A2.5 2.5 0 0 0 21 17.5v-11zm-2.5-.5a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H8.17L7 19.17V18H5.5a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5h13z"/>
|
||||
</svg>`;
|
||||
}
|
||||
|
||||
getJoinIcon() {
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" fill="white" width="16" height="16" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
||||
@@ -666,6 +684,7 @@ window.miroTalkWidgetAction = function (action, element) {
|
||||
reopen: () => widget.reopenWidget(),
|
||||
startAudioCall: () => widget.startAudioCall(),
|
||||
startVideoCall: () => widget.startVideoCall(),
|
||||
startChat: () => widget.startChat(),
|
||||
startScreenShare: () => widget.startScreenShare(),
|
||||
joinRoom: () => widget.joinRoom(),
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
audio: 0,
|
||||
video: 0,
|
||||
screen: 0,
|
||||
chat: 0,
|
||||
hide: 0,
|
||||
notify: 0,
|
||||
token: null,
|
||||
|
||||
Reference in New Issue
Block a user