From c3e459e999db03f9a1b260ccaef4a4201847f50b Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Fri, 27 Oct 2023 14:20:53 +0200 Subject: [PATCH] [mirotalksfu] - add redirect on leave room, update dep. --- app/src/Room.js | 2 ++ app/src/Server.js | 2 +- app/src/config.template.js | 9 +++++++++ package.json | 14 +++++++------- public/js/Room.js | 11 ++++++++--- public/js/RoomClient.js | 4 +++- public/sfu/MediasoupClient.js | 15 +++++---------- 7 files changed, 35 insertions(+), 22 deletions(-) diff --git a/app/src/Room.js b/app/src/Room.js index 234f3c2e..10e3123a 100644 --- a/app/src/Room.js +++ b/app/src/Room.js @@ -17,6 +17,7 @@ module.exports = class Room { this._roomPassword = null; this._hostOnlyRecording = false; this.survey = config.survey; + this.redirect = config.redirect; this.peers = new Map(); this.router = null; this.createTheRouter(); @@ -110,6 +111,7 @@ module.exports = class Room { hostOnlyRecording: this._hostOnlyRecording, }, survey: this.survey, + redirect: this.redirect, peers: JSON.stringify([...this.peers]), }; } diff --git a/app/src/Server.js b/app/src/Server.js index df33b69a..9597fdf6 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -40,7 +40,7 @@ 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.1.3 + * @version 1.1.4 * */ diff --git a/app/src/config.template.js b/app/src/config.template.js index 4fa36067..7cb9a78f 100644 --- a/app/src/config.template.js +++ b/app/src/config.template.js @@ -119,6 +119,15 @@ module.exports = { enabled: false, url: '', }, + redirect: { + /* + Redirect URL on leave room + Upon leaving the room, users who either opt out of providing feedback or if the survey is disabled + will be redirected to a specified URL. If enabled false the default '/newroom' URL will be used. + */ + enabled: false, + url: '', + }, stats: { /* Umami: https://github.com/umami-software/umami diff --git a/package.json b/package.json index 48dd6261..8b536273 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.1.3", + "version": "1.1.4", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { @@ -34,20 +34,20 @@ "author": "Miroslav Pejic", "license": "AGPL-3.0", "dependencies": { - "@sentry/integrations": "7.74.1", - "@sentry/node": "7.74.1", - "axios": "^1.5.1", + "@sentry/integrations": "7.75.1", + "@sentry/node": "7.75.1", + "axios": "^1.6.0", "body-parser": "1.20.2", "colors": "1.4.0", "compression": "1.7.4", "cors": "2.8.5", - "crypto-js": "4.1.1", + "crypto-js": "4.2.0", "express": "4.18.2", "httpolyglot": "0.1.2", "mediasoup": "3.12.16", - "mediasoup-client": "3.6.102", + "mediasoup-client": "3.6.103", "ngrok": "^4.3.3", - "openai": "^4.12.4", + "openai": "^4.14.0", "qs": "6.11.2", "socket.io": "4.7.2", "swagger-ui-express": "5.0.0", diff --git a/public/js/Room.js b/public/js/Room.js index 9da05da4..a7ac9127 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -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.1.3 + * @version 1.1.4 * */ @@ -28,6 +28,11 @@ let survey = { url: 'https://www.questionpro.com/t/AUs7VZq02P', }; +let redirect = { + enabled: true, + url: '/newroom', +}; + const _PEER = { audioOn: '', audioOff: '', @@ -2135,10 +2140,10 @@ function handleRoomClientEvents() { console.log('Room event: Client save recording before to exit'); rc.stopRecording(); } - if (survey.enabled) { + if (survey && survey.enabled) { leaveFeedback(); } else { - openURL('/newroom'); + redirect && redirect.enabled ? openURL(redirect.url) : openURL('/newroom'); } }); } diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index ede67f5a..cc0da007 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -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.1.3 + * @version 1.1.4 * */ @@ -344,6 +344,8 @@ class RoomClient { async handleRoomInfo(room) { console.log('07.0 ----> Room Survey', room.survey); survey = room.survey; + console.log('07.0 ----> Room Leave Redirect', room.redirect); + redirect = room.redirect; let peers = new Map(JSON.parse(room.peers)); participantsCount = peers.size; for (let peer of Array.from(peers.keys()).filter((id) => id == this.peer_id)) { diff --git a/public/sfu/MediasoupClient.js b/public/sfu/MediasoupClient.js index 2bb8b2da..b02c3212 100644 --- a/public/sfu/MediasoupClient.js +++ b/public/sfu/MediasoupClient.js @@ -35,14 +35,9 @@ 1: [ function (require, module, exports) { 'use strict'; - var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, '__esModule', { value: true }); exports.Logger = void 0; - const debug_1 = __importDefault(require('debug')); + const debug_1 = require('debug'); const LIB_NAME = 'awaitqueue'; class Logger { constructor(prefix) { @@ -88,7 +83,7 @@ */ class AwaitQueueStoppedError extends Error { constructor(message) { - super(message !== null && message !== void 0 ? message : 'AwaitQueue stopped'); + super(message ?? 'AwaitQueue stopped'); this.name = 'AwaitQueueStoppedError'; // @ts-ignore if (typeof Error.captureStackTrace === 'function') { @@ -104,7 +99,7 @@ */ class AwaitQueueRemovedTaskError extends Error { constructor(message) { - super(message !== null && message !== void 0 ? message : 'AwaitQueue task removed'); + super(message ?? 'AwaitQueue task removed'); this.name = 'AwaitQueueRemovedTaskError'; // @ts-ignore if (typeof Error.captureStackTrace === 'function') { @@ -127,7 +122,7 @@ return this.pendingTasks.size; } async push(task, name) { - name = name !== null && name !== void 0 ? name : task.name; + name = name ?? task.name; logger.debug(`push() [name:${name}]`); if (typeof task !== 'function') { throw new TypeError('given task is not a function'); @@ -12794,7 +12789,7 @@ /** * Expose mediasoup-client version. */ - exports.version = '3.6.102'; + exports.version = '3.6.103'; /** * Expose parseScalabilityMode() function. */