[mirotalk] - fix host protection mode

This commit is contained in:
Miroslav Pejic
2025-08-17 23:24:00 +02:00
parent 6c7334712b
commit 2b4e36348f
8 changed files with 96 additions and 28 deletions
+5 -17
View File
@@ -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.62
* @version 1.5.63
*
*/
@@ -547,14 +547,8 @@ app.get('/logout', (req, res) => {
// main page
app.get('/', OIDCAuth, (req, res) => {
if (!OIDC.enabled && hostCfg.protected) {
const ip = getIP(req);
if (allowedIP(ip)) {
htmlInjector.injectHtml(views.landing, res);
hostCfg.authenticated = true;
} else {
hostCfg.authenticated = false;
res.redirect('/login');
}
hostCfg.authenticated = false;
res.redirect('/login');
} else {
return htmlInjector.injectHtml(views.landing, res);
}
@@ -563,14 +557,8 @@ app.get('/', OIDCAuth, (req, res) => {
// set new room name and join
app.get('/newcall', OIDCAuth, (req, res) => {
if (!OIDC.enabled && hostCfg.protected) {
const ip = getIP(req);
if (allowedIP(ip)) {
res.redirect('/');
hostCfg.authenticated = true;
} else {
hostCfg.authenticated = false;
res.redirect('/login');
}
hostCfg.authenticated = false;
res.redirect('/login');
} else {
htmlInjector.injectHtml(views.newCall, res);
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mirotalk",
"version": "1.5.61",
"version": "1.5.63",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalk",
"version": "1.5.61",
"version": "1.5.63",
"license": "AGPL-3.0",
"dependencies": {
"@mattermost/client": "10.9.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mirotalk",
"version": "1.5.62",
"version": "1.5.63",
"description": "A free WebRTC browser-based video call",
"main": "server.js",
"scripts": {
+5
View File
@@ -21,6 +21,11 @@ body {
background: #000000;
}
/* Hidden by default; shown after successful login without a target room */
#joinRoomForm {
display: none;
}
article,
aside,
footer,
+1 -1
View File
@@ -103,7 +103,7 @@ let brand = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: 'WebRTC P2P v1.5.62',
title: 'WebRTC P2P v1.5.63',
html: `
<button
id="support-button"
+2 -2
View File
@@ -15,7 +15,7 @@
* @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.62
* @version 1.5.63
*
*/
@@ -11350,7 +11350,7 @@ function showAbout() {
Swal.fire({
background: swBg,
position: 'center',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.62',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.63',
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
customClass: { image: 'img-about' },
html: `
+51 -5
View File
@@ -5,6 +5,9 @@ console.log(window.location);
const usernameInput = document.getElementById('username');
const passwordInput = document.getElementById('password');
const loginBtn = document.getElementById('loginButton');
const joinRoomForm = document.getElementById('joinRoomForm');
const roomNameInput = document.getElementById('roomName');
const joinSelectRoomButton = document.getElementById('joinSelectRoomButton');
usernameInput.onkeyup = (e) => {
if (e.keyCode === 13) {
@@ -50,15 +53,22 @@ function login() {
window.sessionStorage.peer_token = token;
if (room) {
return (window.location.href = '/join/' + window.location.search);
// return (window.location.href = '/join/?room=' + room + '&token=' + token);
window.location.href = '/join/' + window.location.search;
return;
}
if (roomPath && roomPath !== 'login') {
return (window.location.href = '/join/' + roomPath);
// return (window.location.href = '/join/?room=' + roomPath + '&token=' + token);
window.location.href = '/join/' + roomPath;
return;
}
if (token) {
// Show Join Room form when logged in and no room specified
showJoinRoomForm();
return;
}
return (window.location.href = '/logged');
// Fallback
window.location.href = '/logged';
return;
})
.catch(function (error) {
console.error(error);
@@ -79,3 +89,39 @@ function login() {
return;
}
}
function showJoinRoomForm() {
const loginForm = document.getElementById('loginForm');
if (loginForm) loginForm.style.display = 'none';
if (joinRoomForm) joinRoomForm.style.display = 'block';
const doJoin = () => {
const room = roomNameInput ? filterXSS(roomNameInput.value.trim()) : '';
const name = filterXSS(document.getElementById('username').value).trim();
if (!room) {
popup('warning', 'Room Name required');
return;
}
window.location.href =
'/join/?room=' +
encodeURIComponent(room) +
'&name=' +
encodeURIComponent(username);
};
if (roomNameInput) {
roomNameInput.focus();
roomNameInput.onkeyup = (e) => {
if (e.key === 'Enter' || e.keyCode === 13) {
e.preventDefault();
doJoin();
}
};
}
if (joinSelectRoomButton) {
joinSelectRoomButton.onclick = (e) => {
e.preventDefault();
doJoin();
};
}
}
+29
View File
@@ -108,6 +108,35 @@
</button>
</div>
</div>
<!-- Join Room Section hidden -->
<div id="joinRoomForm" class="mb-12">
<div class="hero-copy reveal-from-bottom">
<h1 class="hero-title mt-0">
Pick name. <br />
Share URL. <br />
Start conference.
</h1>
</div>
<br />
<div class="mb-12">
<input
id="roomName"
class="form-input"
type="text"
placeholder="Room Name"
maxlength="64"
required
/>
</div>
<div class="mt-24 mb-32">
<button
id="joinSelectRoomButton"
class="button button-primary button-block"
>
JOIN ROOM
</button>
</div>
</div>
</div>
</div>
</div>