[mirotalksfu] - extend api room password
هذا الالتزام موجود في:
19
README.md
19
README.md
@@ -181,16 +181,17 @@ $ curl -X POST "https://sfu.mirotalk.com/api/v1/join" -H "authorization: mirotal
|
||||
<br/>
|
||||
|
||||
- You can `join` directly to `room` by going to
|
||||
- https://sfu.mirotalk.com/join?room=test&name=mirotalksfu&audio=0&video=0&screen=0¬ify=0
|
||||
- https://sfu.mirotalk.com/join?room=test&password=0&name=mirotalksfu&audio=0&video=0&screen=0¬ify=0
|
||||
|
||||
| Params | Type | Description |
|
||||
| ------ | ------- | --------------- |
|
||||
| room | string | room Id |
|
||||
| name | string | user name |
|
||||
| audio | boolean | audio stream |
|
||||
| video | boolean | video stream |
|
||||
| screen | boolean | screen stream |
|
||||
| notify | boolean | welcome message |
|
||||
| Params | Type | Description |
|
||||
| -------- | -------------- | --------------- |
|
||||
| room | string | room Id |
|
||||
| password | string/boolean | room password |
|
||||
| name | string | user name |
|
||||
| audio | boolean | audio stream |
|
||||
| video | boolean | video stream |
|
||||
| screen | boolean | screen stream |
|
||||
| notify | boolean | welcome message |
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ const fetch = require('node-fetch');
|
||||
|
||||
const API_KEY = 'mirotalksfu_default_secret';
|
||||
const MIROTALK_URL = 'https://sfu.mirotalk.com/api/v1/join';
|
||||
// const MIROTALK_URL = 'http://localhost:3010/api/v1/join';
|
||||
|
||||
function getResponse() {
|
||||
return fetch(MIROTALK_URL, {
|
||||
@@ -14,6 +15,7 @@ function getResponse() {
|
||||
},
|
||||
body: JSON.stringify({
|
||||
room: 'test',
|
||||
password: false,
|
||||
name: 'mirotalksfu',
|
||||
audio: true,
|
||||
video: true,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
$API_KEY = "mirotalksfu_default_secret";
|
||||
$MIROTALK_URL = "https://sfu.mirotalk.com/api/v1/join";
|
||||
// $MIROTALK_URL = "http://localhost:3010/api/v1/join";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $MIROTALK_URL);
|
||||
@@ -16,12 +17,13 @@ $headers = [
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$data = array(
|
||||
"room" => "test",
|
||||
"name" => "mirotalksfu",
|
||||
"audio" => true,
|
||||
"video" => true,
|
||||
"screen" => true,
|
||||
"notify" => true,
|
||||
"room" => "test",
|
||||
"password" => false,
|
||||
"name" => "mirotalksfu",
|
||||
"audio" => true,
|
||||
"video" => true,
|
||||
"screen" => true,
|
||||
"notify" => true,
|
||||
);
|
||||
$data_string = json_encode($data);
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# pip3 install requests
|
||||
import requests
|
||||
import json
|
||||
|
||||
API_KEY = "mirotalksfu_default_secret"
|
||||
MIROTALK_URL = "https://sfu.mirotalk.com/api/v1/join"
|
||||
# MIROTALK_URL = "http://localhost:3010/api/v1/join"
|
||||
|
||||
headers = {
|
||||
"authorization": API_KEY,
|
||||
@@ -11,6 +13,7 @@ headers = {
|
||||
|
||||
data = {
|
||||
"room": "test",
|
||||
"password": "false",
|
||||
"name": "mirotalksfu",
|
||||
"audio": "true",
|
||||
"video": "true",
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
API_KEY="mirotalksfu_default_secret"
|
||||
MIROTALK_URL="https://sfu.mirotalk.com/api/v1/join"
|
||||
# MIROTALK_URL="http://localhost:3010/api/v1/join"
|
||||
|
||||
curl $MIROTALK_URL \
|
||||
--header "authorization: $API_KEY" \
|
||||
--header "Content-Type: application/json" \
|
||||
--data '{"room":"test","name":"mirotalksfu","audio":"1","video":"1","screen":"1","notify":"1"}' \
|
||||
--data '{"room":"test","password":"0","name":"mirotalksfu","audio":"1","video":"1","screen":"1","notify":"1"}' \
|
||||
--request POST
|
||||
@@ -4,6 +4,7 @@ const fetch = require('node-fetch');
|
||||
|
||||
const API_KEY = 'mirotalksfu_default_secret';
|
||||
const MIROTALK_URL = 'https://sfu.mirotalk.com/api/v1/meeting';
|
||||
// const MIROTALK_URL = 'http://localhost:3010/api/v1/join';
|
||||
|
||||
function getResponse() {
|
||||
return fetch(MIROTALK_URL, {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
$API_KEY = "mirotalksfu_default_secret";
|
||||
$MIROTALK_URL = "https://sfu.mirotalk.com/api/v1/meeting";
|
||||
// $MIROTALK_URL = "http://localhost:3010/api/v1/join";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $MIROTALK_URL);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
# pip3 install requests
|
||||
# pip3 install requests
|
||||
import requests
|
||||
import json
|
||||
|
||||
API_KEY = "mirotalksfu_default_secret"
|
||||
MIROTALK_URL = "https://sfu.mirotalk.com/api/v1/meeting"
|
||||
# MIROTALK_URL = "http://localhost:3010/api/v1/join"
|
||||
|
||||
headers = {
|
||||
"authorization": API_KEY,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
API_KEY="mirotalksfu_default_secret"
|
||||
MIROTALK_URL="https://sfu.mirotalk.com/api/v1/meeting"
|
||||
# MIROTALK_URL="http://localhost:3010/api/v1/join"
|
||||
|
||||
curl $MIROTALK_URL \
|
||||
--header "authorization: $API_KEY" \
|
||||
|
||||
@@ -180,9 +180,9 @@ app.get(['/newroom'], (req, res) => {
|
||||
app.get('/join/', (req, res) => {
|
||||
if (hostCfg.authenticated && Object.keys(req.query).length > 0) {
|
||||
log.debug('Direct Join', req.query);
|
||||
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=1&video=1&screen=1¬ify=1
|
||||
const { room, name, audio, video, screen, notify } = req.query;
|
||||
if (room && name && audio && video && screen && notify) {
|
||||
// http://localhost:3010/join?room=test&password=0&name=mirotalksfu&audio=1&video=1&screen=1¬ify=1
|
||||
const { room, password, name, audio, video, screen, notify } = req.query;
|
||||
if (room && password && name && audio && video && screen && notify) {
|
||||
return res.sendFile(views.room);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ module.exports = class ServerApi {
|
||||
this._host +
|
||||
'/join?room=' +
|
||||
data.room +
|
||||
'&password=' +
|
||||
data.password +
|
||||
'&name=' +
|
||||
data.name +
|
||||
'&audio=' +
|
||||
|
||||
@@ -33,6 +33,7 @@ let rc = null;
|
||||
let producer = null;
|
||||
|
||||
let room_id = getRoomId();
|
||||
let room_password = getRoomPassword();
|
||||
let peer_name = getPeerName();
|
||||
let notify = getNotify();
|
||||
|
||||
@@ -282,6 +283,18 @@ function getPeerName() {
|
||||
return qs.get('name');
|
||||
}
|
||||
|
||||
function getRoomPassword() {
|
||||
let qs = new URLSearchParams(window.location.search);
|
||||
let roomPassword = qs.get('password');
|
||||
if (roomPassword) {
|
||||
let queryNoRoomPassword = roomPassword === '0' || roomPassword === 'false';
|
||||
if (queryNoRoomPassword != null) {
|
||||
return false;
|
||||
}
|
||||
return roomPassword;
|
||||
}
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
// SOME PEER INFO
|
||||
// ####################################################
|
||||
@@ -593,6 +606,9 @@ function roomIsReady() {
|
||||
document.body.addEventListener('mousemove', (e) => {
|
||||
showButtons();
|
||||
});
|
||||
if (room_password) {
|
||||
lockRoomButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
function hide(elem) {
|
||||
|
||||
@@ -2522,33 +2522,39 @@ class RoomClient {
|
||||
if (emit) {
|
||||
switch (action) {
|
||||
case 'lock':
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showDenyButton: true,
|
||||
background: swalBackground,
|
||||
imageUrl: image.locked,
|
||||
input: 'text',
|
||||
inputPlaceholder: 'Set Room password',
|
||||
confirmButtonText: `OK`,
|
||||
denyButtonText: `Cancel`,
|
||||
showClass: {
|
||||
popup: 'animate__animated animate__fadeInDown',
|
||||
},
|
||||
hideClass: {
|
||||
popup: 'animate__animated animate__fadeOutUp',
|
||||
},
|
||||
inputValidator: (pwd) => {
|
||||
if (!pwd) return 'Please enter the Room password';
|
||||
this.RoomPassword = pwd;
|
||||
},
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
data.password = this.RoomPassword;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
}
|
||||
});
|
||||
if (room_password) {
|
||||
data.password = room_password;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
} else {
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showDenyButton: true,
|
||||
background: swalBackground,
|
||||
imageUrl: image.locked,
|
||||
input: 'text',
|
||||
inputPlaceholder: 'Set Room password',
|
||||
confirmButtonText: `OK`,
|
||||
denyButtonText: `Cancel`,
|
||||
showClass: {
|
||||
popup: 'animate__animated animate__fadeInDown',
|
||||
},
|
||||
hideClass: {
|
||||
popup: 'animate__animated animate__fadeOutUp',
|
||||
},
|
||||
inputValidator: (pwd) => {
|
||||
if (!pwd) return 'Please enter the Room password';
|
||||
this.RoomPassword = pwd;
|
||||
},
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
data.password = this.RoomPassword;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'unlock':
|
||||
this.socket.emit('roomAction', data);
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم