[mirotalksfu] - improve/update REST API

هذا الالتزام موجود في:
Miroslav Pejic
2024-02-12 13:21:49 +01:00
الأصل eb237d107b
التزام cc3f1e080e
2 ملفات معدلة مع 46 إضافات و22 حذوفات

عرض الملف

@@ -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 +
'&notify=' + '&notify=' +
notify + notifyValue +
jwtToken jwtToken
); );
} }