From ffbaa6dd2d99e6c4ee3c879eb4b45b490fe7c5fa Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Tue, 10 Jun 2025 17:54:36 +0200 Subject: [PATCH] [mirotalk] - add geoLocation, update dep --- app/src/config.template.js | 1 + app/src/server.js | 38 +++- package.json | 6 +- public/images/geolocation.png | Bin 0 -> 1959 bytes public/js/brand.js | 2 +- public/js/buttons.js | 1 + public/js/client.js | 76 ++++++- public/js/geoLocation.js | 360 ++++++++++++++++++++++++++++++++++ public/sounds/notify.mp3 | Bin 0 -> 47178 bytes public/views/client.html | 1 + 10 files changed, 478 insertions(+), 7 deletions(-) create mode 100644 public/images/geolocation.png create mode 100644 public/js/geoLocation.js create mode 100644 public/sounds/notify.mp3 diff --git a/app/src/config.template.js b/app/src/config.template.js index e0dd224d..80af10fb 100644 --- a/app/src/config.template.js +++ b/app/src/config.template.js @@ -142,6 +142,7 @@ module.exports = { showSnapShotBtn: true, showFileShareBtn: true, showShareVideoAudioBtn: true, + showGeoLocationBtn: true, showPrivateMessageBtn: true, showZoomInOutBtn: false, showVideoFocusBtn: true, diff --git a/app/src/server.js b/app/src/server.js index c4e55af8..31ef6d8d 100755 --- a/app/src/server.js +++ b/app/src/server.js @@ -45,7 +45,7 @@ dependencies: { * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.5.18 + * @version 1.5.19 * */ @@ -1512,6 +1512,42 @@ io.sockets.on('connect', async (socket) => { await sendToRoom(data.room_id, socket.id, 'message', data); }); + /** + * Relay commands to peers or specific peer in the same room + * @param {Object} cfg - The configuration object containing command details. + * @param {string} cfg.action - The action to be performed (e.g., 'geoLocation'). + * @param {boolean} cfg.send_to_all - Whether to send the command to all peers in the room. + * @param {Object} cfg.data - The data associated with the command. + */ + socket.on('cmd', async (cfg) => { + const config = checkXSS(cfg); + + const { action, send_to_all, data } = config; + + const { room_id, peer_id, peer_name, peer_uuid, to_peer_id } = data; + + log.info('cmd', config); + + // Only the presenter can do this actions + const presenterActions = ['geoLocation']; + if (presenterActions.some((v) => action === v)) { + // Check if peer is presenter + const isPresenter = isPeerPresenter(room_id, peer_id, peer_name, peer_uuid); + // if not presenter do nothing + if (!isPresenter) return; + } + + if (send_to_all) { + log.debug('[' + socket.id + '] emit cmd to [room_id: ' + room_id + ']', config); + + await sendToRoom(room_id, socket.id, 'cmd', config); + } else { + log.debug('[' + socket.id + '] emit cmd to [' + to_peer_id + '] from room_id [' + room_id + ']'); + + await sendToPeer(to_peer_id, sockets, 'cmd', config); + } + }); + /** * Relay Audio Video Hand ... Status to peers */ diff --git a/package.json b/package.json index 1da31a0a..d8d46c12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalk", - "version": "1.5.18", + "version": "1.5.19", "description": "A free WebRTC browser-based video call", "main": "server.js", "scripts": { @@ -61,14 +61,14 @@ "jsonwebtoken": "^9.0.2", "js-yaml": "^4.1.0", "nodemailer": "^7.0.3", - "openai": "^5.1.1", + "openai": "^5.2.0", "qs": "^6.14.0", "socket.io": "^4.8.1", "swagger-ui-express": "^5.0.1", "uuid": "11.1.0" }, "devDependencies": { - "mocha": "^11.5.0", + "mocha": "^11.6.0", "node-fetch": "^3.3.2", "nodemon": "^3.1.10", "prettier": "3.5.3", diff --git a/public/images/geolocation.png b/public/images/geolocation.png new file mode 100644 index 0000000000000000000000000000000000000000..fe4984b9c4d6d236bdee1199f93404ab492ee159 GIT binary patch literal 1959 zcmZWqdpHw%A9u@TiriwBrd&djP;=@mm$4b%+%`Ot7GpRRCUPHbjF>aj(zMXJOqxqB zg(#sUA+_YTwUtqH=1j{aIeTBvbDo~({XWm{bNPNgfBb%b{qnt!Bentb0WvZ&+mLQ9 zzEURq_bAItafwG=ky5p{C(2dI)BhVTmn#qmcs!oeaX1{Q{dc6BfAyyLb+f6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gKhI{$-xei_o5Q;6q<@(V()G9t+ZmJd4?Usmj{pDw literal 0 HcmV?d00001 diff --git a/public/js/brand.js b/public/js/brand.js index 800a480c..974cd902 100644 --- a/public/js/brand.js +++ b/public/js/brand.js @@ -73,7 +73,7 @@ let brand = { }, about: { imageUrl: '../images/mirotalk-logo.gif', - title: 'WebRTC P2P v1.5.18', + title: 'WebRTC P2P v1.5.19', html: `