-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c1dad2
commit b5d4a42
Showing
11 changed files
with
95 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ dev dependencies: { | |
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon | ||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.6.74 | ||
* @version 1.6.75 | ||
* | ||
*/ | ||
|
||
|
@@ -513,12 +513,11 @@ function startServer() { | |
|
||
log.debug('Direct Join', req.query); | ||
|
||
// http://localhost:3010/join?room=test&roomPassword=0&name=mirotalksfu&audio=1&video=1&screen=0&hide=0¬ify=1 | ||
// http://localhost:3010/join?room=test&roomPassword=0&name=mirotalksfu&audio=1&video=1&screen=0&hide=0¬ify=1&duration=00:00:20 | ||
// http://localhost:3010/join?room=test&roomPassword=0&name=mirotalksfu&audio=1&video=1&screen=0&hide=0¬ify=0&token=token | ||
|
||
const { room, roomPassword, name, audio, video, screen, hide, notify, token, isPresenter } = checkXSS( | ||
req.query, | ||
); | ||
const { room, roomPassword, name, audio, video, screen, hide, notify, duration, token, isPresenter } = | ||
checkXSS(req.query); | ||
|
||
if (!room) { | ||
log.warn('/join/params room empty', room); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] or purchase directly via CodeCanyon | ||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.6.74 | ||
* @version 1.6.75 | ||
* | ||
*/ | ||
|
||
|
@@ -191,6 +191,7 @@ let chatMessagesId = 0; | |
|
||
let room_id = getRoomId(); | ||
let room_password = getRoomPassword(); | ||
let room_duration = getRoomDuration(); | ||
let peer_name = getPeerName(); | ||
let peer_uuid = getPeerUUID(); | ||
let peer_token = getPeerToken(); | ||
|
@@ -440,13 +441,21 @@ function setTippy(elem, content, placement, allowHTML = false) { | |
} | ||
} | ||
|
||
// #################################################### | ||
// HELPERS | ||
// #################################################### | ||
|
||
function getQueryParam(param) { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
return filterXSS(urlParams.get(param)); | ||
} | ||
|
||
// #################################################### | ||
// GET ROOM ID | ||
// #################################################### | ||
|
||
function getRoomId() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let queryRoomId = filterXSS(qs.get('room')); | ||
let queryRoomId = getQueryParam('room'); | ||
let roomId = queryRoomId ? queryRoomId : location.pathname.substring(6); | ||
if (roomId == '') { | ||
roomId = makeId(12); | ||
|
@@ -732,12 +741,11 @@ function hasVideoTrack(mediaStream) { | |
} | ||
|
||
// #################################################### | ||
// API CHECK | ||
// QUERY PARAMS CHECK | ||
// #################################################### | ||
|
||
function getScreen() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let screen = filterXSS(qs.get('screen')); | ||
let screen = getQueryParam('screen'); | ||
if (screen) { | ||
screen = screen.toLowerCase(); | ||
let queryScreen = screen === '1' || screen === 'true'; | ||
|
@@ -751,8 +759,7 @@ function getScreen() { | |
} | ||
|
||
function getNotify() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let notify = filterXSS(qs.get('notify')); | ||
let notify = getQueryParam('notify'); | ||
if (notify) { | ||
notify = notify.toLowerCase(); | ||
let queryNotify = notify === '1' || notify === 'true'; | ||
|
@@ -767,8 +774,7 @@ function getNotify() { | |
} | ||
|
||
function getHideMeActive() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let hide = filterXSS(qs.get('hide')); | ||
let hide = getQueryParam('hide'); | ||
let queryHideMe = false; | ||
if (hide) { | ||
hide = hide.toLowerCase(); | ||
|
@@ -779,8 +785,7 @@ function getHideMeActive() { | |
} | ||
|
||
function isPeerPresenter() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let presenter = filterXSS(qs.get('isPresenter')); | ||
let presenter = getQueryParam('isPresenter'); | ||
if (presenter) { | ||
presenter = presenter.toLowerCase(); | ||
let queryPresenter = presenter === '1' || presenter === 'true'; | ||
|
@@ -794,8 +799,7 @@ function isPeerPresenter() { | |
} | ||
|
||
function getPeerName() { | ||
const qs = new URLSearchParams(window.location.search); | ||
const name = filterXSS(qs.get('name')); | ||
const name = getQueryParam('name'); | ||
if (isHtml(name)) { | ||
console.log('Direct join', { name: 'Invalid name' }); | ||
return 'Invalid name'; | ||
|
@@ -815,8 +819,7 @@ function getPeerUUID() { | |
|
||
function getPeerToken() { | ||
if (window.sessionStorage.peer_token) return window.sessionStorage.peer_token; | ||
let qs = new URLSearchParams(window.location.search); | ||
let token = filterXSS(qs.get('token')); | ||
let token = getQueryParam('token'); | ||
let queryToken = false; | ||
if (token) { | ||
queryToken = token; | ||
|
@@ -826,8 +829,7 @@ function getPeerToken() { | |
} | ||
|
||
function getRoomPassword() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let roomPassword = filterXSS(qs.get('roomPassword')); | ||
let roomPassword = getQueryParam('roomPassword'); | ||
if (roomPassword) { | ||
let queryNoRoomPassword = roomPassword === '0' || roomPassword === 'false'; | ||
if (queryNoRoomPassword) { | ||
|
@@ -839,6 +841,58 @@ function getRoomPassword() { | |
return false; | ||
} | ||
|
||
function getRoomDuration() { | ||
const roomDuration = getQueryParam('duration'); | ||
|
||
if (isValidDuration(roomDuration)) { | ||
if (roomDuration === 'unlimited') { | ||
console.log('The room has no time limit'); | ||
return roomDuration; | ||
} | ||
const timeLimit = timeToMilliseconds(roomDuration); | ||
setTimeout(() => { | ||
Swal.fire({ | ||
title: 'Time Limit Reached', | ||
text: 'The room has reached its time limit and will close shortly', | ||
icon: 'warning', | ||
timer: 6000, // 6 seconds | ||
timerProgressBar: true, | ||
showConfirmButton: false, | ||
allowOutsideClick: false, | ||
didOpen: () => { | ||
Swal.showLoading(); | ||
}, | ||
willClose: () => { | ||
openURL('/'); | ||
}, | ||
}); | ||
}, timeLimit); | ||
|
||
console.log('Direct join', { duration: roomDuration, timeLimit: timeLimit }); | ||
return roomDuration; | ||
} | ||
} | ||
|
||
function timeToMilliseconds(timeString) { | ||
const [hours, minutes, seconds] = timeString.split(':').map(Number); | ||
return (hours * 3600 + minutes * 60 + seconds) * 1000; | ||
} | ||
|
||
function isValidDuration(duration) { | ||
if (duration === 'unlimited') return true; | ||
|
||
// Check if the format is HH:MM:SS | ||
const regex = /^(\d{2}):(\d{2}):(\d{2})$/; | ||
const match = duration.match(regex); | ||
if (!match) return false; | ||
const [hours, minutes, seconds] = match.slice(1).map(Number); | ||
// Validate ranges: hours, minutes, and seconds | ||
if (hours < 0 || minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
// #################################################### | ||
// INIT CONFIG | ||
// #################################################### | ||
|
@@ -1155,9 +1209,8 @@ function initVideoContainerShow(show = true) { | |
} | ||
|
||
function checkMedia() { | ||
let qs = new URLSearchParams(window.location.search); | ||
let audio = filterXSS(qs.get('audio')); | ||
let video = filterXSS(qs.get('video')); | ||
let audio = getQueryParam('audio'); | ||
let video = getQueryParam('video'); | ||
if (audio) { | ||
audio = audio.toLowerCase(); | ||
let queryPeerAudio = audio === '1' || audio === 'true'; | ||
|
@@ -4619,7 +4672,7 @@ function showAbout() { | |
imageUrl: image.about, | ||
customClass: { image: 'img-about' }, | ||
position: 'center', | ||
title: 'WebRTC SFU v1.6.74', | ||
title: 'WebRTC SFU v1.6.75', | ||
html: ` | ||
<br /> | ||
<div id="about"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon | ||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.6.74 | ||
* @version 1.6.75 | ||
* | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters