Skip to content

Commit

Permalink
[mirotalksfu] - logic improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Oct 19, 2024
1 parent b25d80f commit c1d9680
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
17 changes: 8 additions & 9 deletions app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev 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.5.91
* @version 1.5.92
*
*/

Expand Down Expand Up @@ -570,25 +570,24 @@ function startServer() {
const allowRoomAccess = isAllowedRoomAccess('/join/:roomId', req, hostCfg, roomList, roomId);

if (allowRoomAccess) {
// Protect unauthorized room access check from db...
// 1. Protect room access with database check
if (!OIDC.enabled && hostCfg.protected && hostCfg.users_from_db) {
const roomExists = await roomExistsForUser(roomId);
log.debug('/join/:roomId exists from api endpoint', roomExists);
log.debug('/join/:roomId exists from API endpoint', roomExists);
return roomExists ? res.sendFile(views.room) : res.redirect('/login');
}
// Protect unauthorized room access check from config file...
// 2. Protect room access with configuration check
if (!OIDC.enabled && hostCfg.protected && !hostCfg.users_from_db) {
const roomExists = hostCfg.users.some((user) => user.allowed_rooms.includes(roomId));
const roomExists = hostCfg.users.some(user =>
user.allowed_rooms && user.allowed_rooms.includes(roomId)
);
log.debug('/join/:roomId exists from config allowed rooms', roomExists);
return roomExists ? res.sendFile(views.room) : res.redirect('/whoAreYou/' + roomId);
}
res.sendFile(views.room);
} else {
// Who are you?
if (!OIDC.enabled && hostCfg.protected && hostCfg.users_from_db) {
return res.redirect('/whoAreYou/' + roomId);
}
!OIDC.enabled && hostCfg.protected ? res.redirect('/login') : res.redirect('/');
!OIDC.enabled && hostCfg.protected ? res.redirect('/whoAreYou/' + roomId) : res.redirect('/');
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.5.91",
"version": "1.5.92",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.91
* @version 1.5.92
*
*/

Expand Down Expand Up @@ -4500,7 +4500,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.91',
title: 'WebRTC SFU v1.5.92',
html: `
<br />
<div id="about">
Expand Down
2 changes: 1 addition & 1 deletion public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.91
* @version 1.5.92
*
*/

Expand Down

0 comments on commit c1d9680

Please sign in to comment.