[mirotalksfu] - improve/update REST API
هذا الالتزام موجود في:
@@ -43,15 +43,6 @@ paths:
|
||||
description: Custom Join URL.
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- room
|
||||
- roomPassword
|
||||
- name
|
||||
- audio
|
||||
- video
|
||||
- screen
|
||||
- hide
|
||||
- notify
|
||||
properties:
|
||||
room:
|
||||
type: string
|
||||
@@ -64,10 +55,10 @@ paths:
|
||||
default: 'mirotalksfu'
|
||||
audio:
|
||||
type: boolean
|
||||
default: true
|
||||
default: false
|
||||
video:
|
||||
type: boolean
|
||||
default: true
|
||||
default: false
|
||||
screen:
|
||||
type: boolean
|
||||
default: false
|
||||
@@ -76,7 +67,25 @@ paths:
|
||||
default: false
|
||||
notify:
|
||||
type: boolean
|
||||
default: true
|
||||
default: false
|
||||
token:
|
||||
type: object
|
||||
description: |
|
||||
Object containing authentication token details.
|
||||
This token is required when host.protected or host.user_auth is enabled in the app/src/config.js file.
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
default: 'username'
|
||||
password:
|
||||
type: string
|
||||
default: 'password'
|
||||
presenter:
|
||||
type: boolean
|
||||
default: true
|
||||
expire:
|
||||
type: string
|
||||
default: '1h'
|
||||
consumes:
|
||||
- 'application/json'
|
||||
produces:
|
||||
|
||||
@@ -24,36 +24,51 @@ module.exports = class ServerApi {
|
||||
}
|
||||
|
||||
getJoinURL(data) {
|
||||
// Get data...
|
||||
// Get data
|
||||
const { room, roomPassword, name, audio, video, screen, notify, token } = data;
|
||||
|
||||
const roomValue = room || uuidV4();
|
||||
const roomPasswordValue = roomPassword || false;
|
||||
const nameValue = name || uuidV4();
|
||||
const audioValue = audio || false;
|
||||
const videoValue = video || false;
|
||||
const screenValue = screen || false;
|
||||
const notifyValue = notify || false;
|
||||
|
||||
let jwtToken = '';
|
||||
|
||||
if (token) {
|
||||
// JWT.io
|
||||
const { username, password, presenter, expire } = token;
|
||||
|
||||
const usernameValue = username || 'username';
|
||||
const passwordValue = password || 'password';
|
||||
const presenterValue = String(presenter);
|
||||
const expireValue = expire || JWT_EXP;
|
||||
|
||||
jwtToken =
|
||||
'&token=' +
|
||||
jwt.sign({ username: username, password: password, presenter: presenter }, JWT_KEY, {
|
||||
expiresIn: expire ? expire : JWT_EXP,
|
||||
jwt.sign({ username: usernameValue, password: passwordValue, presenter: presenterValue }, JWT_KEY, {
|
||||
expiresIn: expireValue,
|
||||
});
|
||||
}
|
||||
return (
|
||||
'https://' +
|
||||
this._host +
|
||||
'/join?room=' +
|
||||
room +
|
||||
roomValue +
|
||||
'&roomPassword=' +
|
||||
roomPassword +
|
||||
roomPasswordValue +
|
||||
'&name=' +
|
||||
name +
|
||||
nameValue +
|
||||
'&audio=' +
|
||||
audio +
|
||||
audioValue +
|
||||
'&video=' +
|
||||
video +
|
||||
videoValue +
|
||||
'&screen=' +
|
||||
screen +
|
||||
screenValue +
|
||||
'¬ify=' +
|
||||
notify +
|
||||
notifyValue +
|
||||
jwtToken
|
||||
);
|
||||
}
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم