[mirotalksfu] - add chat to query params, update widget

هذا الالتزام موجود في:
Miroslav Pejic
2025-08-10 11:28:52 +02:00
الأصل 1fb81472b3
التزام 9a4ec57cc5
15 ملفات معدلة مع 71 إضافات و16 حذوفات

عرض الملف

@@ -108,7 +108,7 @@
<br/>
- You can `directly join a room` by using link like:
- https://sfu.mirotalk.com/join?room=test&roomPassword=0&name=mirotalksfu&avatar=0&audio=0&video=0&screen=0&notify=0&duration=unlimited
- https://sfu.mirotalk.com/join?room=test&roomPassword=0&name=mirotalksfu&avatar=0&audio=0&video=0&screen=0&chat=0&notify=0&duration=unlimited
| Params | Type | Description |
| ------------ | -------------- | ------------------------- |
@@ -119,6 +119,7 @@
| audio | boolean | Audio stream |
| video | boolean | Video stream |
| screen | boolean | Screen stream |
| chat | boolean | Chat |
| notify | boolean | Welcome message |
| hide | boolean | Hide myself |
| duration | string | Meeting duration HH:MM:SS |
@@ -344,12 +345,12 @@ curl -X POST "https://sfu.mirotalk.com/api/v1/join" \
curl -X POST "http://localhost:3010/api/v1/join" \
-H "authorization: mirotalksfu_default_secret" \
-H "Content-Type: application/json" \
--data '{"room":"test","roomPassword":false,"name":"mirotalksfu","audio":false,"video":false,"screen":false,"notify":false,"duration":"unlimited","token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}'
--data '{"room":"test","roomPassword":false,"name":"mirotalksfu","audio":false,"video":false,"screen":false,"chat":false,"notify":false,"duration":"unlimited","token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}'
curl -X POST "https://sfu.mirotalk.com/api/v1/join" \
-H "authorization: mirotalksfu_default_secret" \
-H "Content-Type: application/json" \
--data '{"room":"test","roomPassword":false,"name":"mirotalksfu","audio":false,"video":false,"screen":false,"notify":false,"duration":"unlimited","token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}'
--data '{"room":"test","roomPassword":false,"name":"mirotalksfu","audio":false,"video":false,"screen":false,"chat":false,"notify":false,"duration":"unlimited","token":{"username":"username","password":"password","presenter":true,"expire":"1h"}}'
```
### 6. Generate Token

عرض الملف

@@ -23,6 +23,7 @@ async function getJoin() {
audio: false,
video: false,
screen: false,
chat: false,
hide: false,
notify: true,
duration: 'unlimited',

عرض الملف

@@ -24,6 +24,7 @@ $data = array(
"audio" => false,
"video" => false,
"screen" => false,
"chat" => false,
"hide" => false,
"notify" => true,
"duration" => "unlimited",

عرض الملف

@@ -19,6 +19,7 @@ data = {
"audio": "false",
"video": "false",
"screen": "false",
"chat": "false",
"hide": "false",
"notify": "true",
"duration": "unlimited",

عرض الملف

@@ -15,6 +15,7 @@ REQUEST_DATA='{
"audio": false,
"video": false,
"screen": false,
"chat": false,
"hide": false,
"notify": true,
"duration": "unlimited",

عرض الملف

@@ -174,6 +174,9 @@ definitions:
screen:
type: boolean
default: false
chat:
type: boolean
default: false
hide:
type: boolean
default: false

عرض الملف

@@ -64,7 +64,7 @@ dev dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.9.27
* @version 1.9.28
*
*/
@@ -674,10 +674,11 @@ function startServer() {
log.debug('Direct Join', req.query);
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=0&video=0&screen=0&notify=0&chat=1
// http://localhost:3010/join?room=test&roomPassword=0&name=mirotalksfu&audio=1&video=1&screen=0&hide=0&notify=1&duration=00:00:30
// http://localhost:3010/join?room=test&roomPassword=0&name=mirotalksfu&audio=1&video=1&screen=0&hide=0&notify=0&token=token
const { room, roomPassword, name, audio, video, screen, hide, notify, duration, token, isPresenter } =
const { room, roomPassword, name, audio, video, screen, hide, notify, chat, duration, token, isPresenter } =
checkXSS(req.query);
if (!room) {

عرض الملف

@@ -76,7 +76,7 @@ module.exports = class ServerApi {
getJoinURL(data) {
// Get data
const { room, roomPassword, name, avatar, audio, video, screen, hide, notify, duration, token } = data;
const { room, roomPassword, name, avatar, audio, video, screen, chat, hide, notify, duration, token } = data;
const roomValue = room || uuidV4();
const roomPasswordValue = roomPassword || false;
@@ -85,6 +85,7 @@ module.exports = class ServerApi {
const audioValue = audio || false;
const videoValue = video || false;
const screenValue = screen || false;
const chatValue = chat || false;
const hideValue = hide || false;
const notifyValue = notify || false;
const durationValue = duration || 'unlimited';
@@ -101,6 +102,7 @@ module.exports = class ServerApi {
`&audio=${audioValue}` +
`&video=${videoValue}` +
`&screen=${screenValue}` +
`&chat=${chatValue}` +
`&hide=${hideValue}` +
`&notify=${notifyValue}` +
`&duration=${durationValue}` +

4
package-lock.json مولّد
عرض الملف

@@ -1,12 +1,12 @@
{
"name": "mirotalksfu",
"version": "1.9.27",
"version": "1.9.28",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalksfu",
"version": "1.9.27",
"version": "1.9.28",
"license": "AGPL-3.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.864.0",

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.9.27",
"version": "1.9.28",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -99,7 +99,7 @@ let BRAND = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: '<strong>WebRTC SFU v1.9.27</strong>',
title: '<strong>WebRTC SFU v1.9.28</strong>',
html: `
<button
id="support-button"

عرض الملف

@@ -6,6 +6,7 @@ class IframeApi {
audio: false,
video: false,
screen: false,
chat: false,
hide: false,
notify: false,
duration: 'unlimited',
@@ -50,6 +51,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,
duration: this.options.duration,

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.9.27
* @version 1.9.28
*
*/
@@ -245,6 +245,7 @@ let peer_token = getPeerToken();
let isScreenAllowed = getScreen();
let isHideMeActive = getHideMeActive();
let notify = getNotify();
let chat = getChat();
isPresenter = isPeerPresenter();
let peer_info = null;
@@ -880,6 +881,20 @@ function getNotify() {
return notify;
}
function getChat() {
let chat = getQueryParam('chat');
if (chat) {
chat = chat.toLowerCase();
let queryChat = chat === '1' || chat === 'true';
if (queryChat != null) {
console.log('Direct join', { chat: queryChat });
return queryChat;
}
}
console.log('Direct join', { chat: chat });
return chat;
}
function getHideMeActive() {
let hide = getQueryParam('hide');
let queryHideMe = false;
@@ -5530,7 +5545,7 @@ function showAbout() {
position: 'center',
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
customClass: { image: 'img-about' },
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.27',
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.28',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.9.27
* @version 1.9.28
*
*/
@@ -709,6 +709,14 @@ class RoomClient {
if (!this.dominantSpeaker) {
elemDisplay('dominantSpeakerFocusDiv', false);
}
// Open Chat on Join
if (chat) {
const chatButton = getId('chatButton');
if (chatButton) {
chatButton.click();
}
}
}
// PARTICIPANTS

عرض الملف

@@ -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(),
};