Skip to content

Commit 3c54574

Browse files
[mirotalk] - feat(client): replace leave-room action with exit dropdown menu
1 parent 343061c commit 3c54574

9 files changed

Lines changed: 140 additions & 16 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk P2P v.1.8.53 - Environment Configuration
2+
# MiroTalk P2P v.1.8.54 - Environment Configuration
33
# ====================================================
44

55
# App environment

app/src/config.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* ==============================================
5-
* MiroTalk P2P v.1.8.53 - Configuration File
5+
* MiroTalk P2P v.1.8.54 - Configuration File
66
* ==============================================
77
*
88
* This file is the central configuration source.

app/src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies: {
4545
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
4646
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
4747
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
48-
* @version 1.8.53
48+
* @version 1.8.54
4949
*
5050
*/
5151

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalk",
3-
"version": "1.8.53",
3+
"version": "1.8.54",
44
"description": "A free WebRTC browser-based video call",
55
"main": "server.js",
66
"scripts": {
@@ -64,7 +64,7 @@
6464
"js-yaml": "^4.1.1",
6565
"jsdom": "^29.1.1",
6666
"jsonwebtoken": "^9.0.3",
67-
"nodemailer": "^8.0.7",
67+
"nodemailer": "^8.0.8",
6868
"openai": "^6.39.0",
6969
"qs": "^6.15.2",
7070
"socket.io": "^4.8.3",

public/css/client.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,61 @@ body {
466466
border-radius: 10px;
467467
}
468468

469+
/* Exit dropdown menu (Leave room / End room for all) */
470+
#bottomButtons #exitDropdown {
471+
position: relative;
472+
display: inline-flex;
473+
}
474+
475+
#bottomButtons #exitMenu {
476+
position: absolute;
477+
bottom: calc(100% + 8px);
478+
right: 0;
479+
min-width: 220px;
480+
z-index: 9999;
481+
background: var(--body-bg);
482+
border: var(--border);
483+
border-radius: 10px;
484+
box-shadow: var(--box-shadow);
485+
padding: 6px 0;
486+
text-align: left;
487+
}
488+
489+
#bottomButtons #exitMenu button {
490+
display: flex;
491+
width: 100%;
492+
height: auto;
493+
align-items: center;
494+
justify-content: flex-start;
495+
text-align: left;
496+
padding: 10px 16px;
497+
font-size: 0.9rem;
498+
border-radius: 0;
499+
background: transparent;
500+
color: #fff;
501+
transition:
502+
padding-left 0.2s ease,
503+
background 0.2s ease;
504+
}
505+
506+
#bottomButtons #exitMenu button:hover {
507+
background: rgba(255, 255, 255, 0.08);
508+
padding-left: 22px;
509+
transform: none;
510+
}
511+
512+
#bottomButtons #exitMenu button i {
513+
width: 20px;
514+
min-width: 20px;
515+
text-align: center;
516+
margin-right: 10px;
517+
font-size: 1.1em;
518+
}
519+
520+
#bottomButtons #exitMenu .red {
521+
color: #dc3545 !important;
522+
}
523+
469524
/* Let the dropdown menu anchor to the whole split button (not only the arrow). */
470525
#bottomButtons #audioDropdown,
471526
#bottomButtons #videoDropdown,

public/js/brand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let brand = {
109109
},
110110
about: {
111111
imageUrl: '../images/mirotalk-logo.gif',
112-
title: 'WebRTC P2P v1.8.53',
112+
title: 'WebRTC P2P v1.8.54',
113113
html: `
114114
<button
115115
id="support-button"

public/js/client.js

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18-
* @version 1.8.53
18+
* @version 1.8.54
1919
*
2020
*/
2121

@@ -222,6 +222,11 @@ const settingsExtraToggle = getId('settingsExtraToggle');
222222
const settingsExtraMenu = getId('settingsExtraMenu');
223223
const leaveRoomBtn = getId('leaveRoomBtn');
224224

225+
const exitDropdown = getId('exitDropdown');
226+
const exitMenu = getId('exitMenu');
227+
const exitLeaveBtn = getId('exitLeaveBtn');
228+
const exitLeaveAllBtn = getId('exitLeaveAllBtn');
229+
225230
// Room Emoji Picker
226231
const closeEmojiPickerContainer = getId('closeEmojiPickerContainer');
227232
const emojiPickerContainer = getId('emojiPickerContainer');
@@ -7520,8 +7525,64 @@ function setAboutBtn() {
75207525
*/
75217526
function setLeaveRoomBtn() {
75227527
leaveRoomBtn.addEventListener('click', (e) => {
7523-
leaveRoom();
7528+
if (e && e.shiftKey) return leaveRoom();
7529+
toggleExitMenu();
75247530
});
7531+
if (exitLeaveBtn) exitLeaveBtn.onclick = handleExitLeave;
7532+
if (exitLeaveAllBtn) exitLeaveAllBtn.onclick = handleExitLeaveForAll;
7533+
document.addEventListener('click', handleExitMenuOutsideClick);
7534+
}
7535+
7536+
/**
7537+
* Toggle the exit dropdown menu. The "End room for all" entry is
7538+
* only available to the presenter.
7539+
*/
7540+
function toggleExitMenu() {
7541+
if (!exitMenu) return leaveRoom();
7542+
if (exitLeaveAllBtn) {
7543+
isPresenter ? exitLeaveAllBtn.classList.remove('hidden') : exitLeaveAllBtn.classList.add('hidden');
7544+
}
7545+
exitMenu.classList.toggle('hidden');
7546+
}
7547+
7548+
function handleExitLeave() {
7549+
if (exitMenu) exitMenu.classList.add('hidden');
7550+
leaveRoom();
7551+
}
7552+
7553+
function handleExitLeaveForAll() {
7554+
if (exitMenu) exitMenu.classList.add('hidden');
7555+
leaveRoomForAll();
7556+
}
7557+
7558+
function handleExitMenuOutsideClick(e) {
7559+
if (!exitDropdown || !exitMenu) return;
7560+
if (exitMenu.classList.contains('hidden')) return;
7561+
if (!exitDropdown.contains(e.target)) exitMenu.classList.add('hidden');
7562+
}
7563+
7564+
/**
7565+
* Presenter: kick out all other peers, then leave the room.
7566+
*/
7567+
function leaveRoomForAll() {
7568+
if (!isPresenter) return leaveRoom();
7569+
try {
7570+
if (allPeers && typeof allPeers === 'object') {
7571+
for (const peer_id in allPeers) {
7572+
if (!allPeers[peer_id]) continue;
7573+
if (peer_id === myPeerId) continue;
7574+
sendToServer('kickOut', {
7575+
room_id: roomId,
7576+
peer_id: peer_id,
7577+
peer_uuid: myPeerUUID,
7578+
peer_name: myPeerName,
7579+
});
7580+
}
7581+
}
7582+
} catch (err) {
7583+
console.warn('[leaveRoomForAll] failed to kick all peers', err);
7584+
}
7585+
leaveRoom();
75257586
}
75267587

75277588
/**
@@ -15894,7 +15955,7 @@ function showAbout() {
1589415955
Swal.fire({
1589515956
background: swBg,
1589615957
position: 'center',
15897-
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.53',
15958+
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.54',
1589815959
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1589915960
customClass: { image: 'img-about' },
1590015961
html: renderRoomTemplate('tpl-about-modal', {

public/views/client.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,15 @@ <h1>Loading</h1>
317317
</div>
318318
</div>
319319

320-
<button id="leaveRoomBtn" class="fa-solid fa-phone-slash"></button>
320+
<div id="exitDropdown">
321+
<button id="leaveRoomBtn" class="fa-solid fa-phone-slash"></button>
322+
<div id="exitMenu" class="hidden" aria-labelledby="leaveRoomBtn">
323+
<button id="exitLeaveBtn"><i class="fas fa-sign-out-alt"></i> Leave room</button>
324+
<button id="exitLeaveAllBtn" class="hidden">
325+
<i class="fas fa-power-off red"></i> <span class="red">End room for all</span>
326+
</button>
327+
</div>
328+
</div>
321329
</div>
322330

323331
<!-- End bottom buttons -->

0 commit comments

Comments
 (0)