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