diff --git a/app/src/Server.js b/app/src/Server.js index 0a5e27f4..93ff0a79 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -42,7 +42,7 @@ 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.4.28 + * @version 1.4.29 * */ diff --git a/package.json b/package.json index 21ffd5fb..1458c528 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.4.28", + "version": "1.4.29", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { @@ -53,11 +53,11 @@ "express-openid-connect": "^2.17.1", "httpolyglot": "0.1.2", "jsonwebtoken": "^9.0.2", - "mediasoup": "3.14.4", + "mediasoup": "3.14.5", "mediasoup-client": "3.7.7", "ngrok": "^5.0.0-beta.2", "nodemailer": "^6.9.13", - "openai": "^4.40.0", + "openai": "^4.40.1", "qs": "6.12.1", "socket.io": "4.7.5", "swagger-ui-express": "5.0.0", diff --git a/public/js/Room.js b/public/js/Room.js index 0fe6d615..9aec2042 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -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.4.28 + * @version 1.4.29 * */ diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index 84035782..2b9f1c41 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -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.4.28 + * @version 1.4.29 * */ diff --git a/public/js/newRoom.js b/public/js/newRoom.js deleted file mode 100644 index 3c6c693a..00000000 --- a/public/js/newRoom.js +++ /dev/null @@ -1,155 +0,0 @@ -'use strict'; - -const adjectives = [ - 'small', - 'big', - 'large', - 'smelly', - 'new', - 'happy', - 'shiny', - 'old', - 'clean', - 'nice', - 'bad', - 'cool', - 'hot', - 'cold', - 'warm', - 'hungry', - 'slow', - 'fast', - 'red', - 'white', - 'black', - 'blue', - 'green', - 'basic', - 'strong', - 'cute', - 'poor', - 'nice', - 'huge', - 'rare', - 'lucky', - 'weak', - 'tall', - 'short', - 'tiny', - 'great', - 'long', - 'single', - 'rich', - 'young', - 'dirty', - 'fresh', - 'brown', - 'dark', - 'crazy', - 'sad', - 'loud', - 'brave', - 'calm', - 'silly', - 'smart', -]; - -const nouns = [ - 'dog', - 'bat', - 'wrench', - 'apple', - 'pear', - 'ghost', - 'cat', - 'wolf', - 'squid', - 'goat', - 'snail', - 'hat', - 'sock', - 'plum', - 'bear', - 'snake', - 'turtle', - 'horse', - 'spoon', - 'fork', - 'spider', - 'tree', - 'chair', - 'table', - 'couch', - 'towel', - 'panda', - 'bread', - 'grape', - 'cake', - 'brick', - 'rat', - 'mouse', - 'bird', - 'oven', - 'phone', - 'photo', - 'frog', - 'bear', - 'camel', - 'sheep', - 'shark', - 'tiger', - 'zebra', - 'duck', - 'eagle', - 'fish', - 'kitten', - 'lobster', - 'monkey', - 'owl', - 'puppy', - 'pig', - 'rabbit', - 'fox', - 'whale', - 'beaver', - 'gorilla', - 'lizard', - 'parrot', - 'sloth', - 'swan', -]; - -function getRandomNumber(length) { - let result = ''; - let characters = '0123456789'; - let charactersLength = characters.length; - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; -} - -let adjective = adjectives[Math.floor(Math.random() * adjectives.length)]; -let noun = nouns[Math.floor(Math.random() * nouns.length)]; -let num = getRandomNumber(5); -noun = noun.charAt(0).toUpperCase() + noun.substring(1); -adjective = adjective.charAt(0).toUpperCase() + adjective.substring(1); -document.getElementById('roomName').value = ''; - -// #################################################### -// TYPING EFFECT -// #################################################### - -let i = 0; -let txt = num + adjective + noun; -let speed = 100; - -function typeWriter() { - if (i < txt.length) { - document.getElementById('roomName').value += txt.charAt(i); - i++; - setTimeout(typeWriter, speed); - } -} - -typeWriter(); diff --git a/public/js/Brand.js b/public/js/scripts/Brand.js similarity index 100% rename from public/js/Brand.js rename to public/js/scripts/Brand.js diff --git a/public/js/scripts/Common.js b/public/js/scripts/Common.js new file mode 100644 index 00000000..207d518a --- /dev/null +++ b/public/js/scripts/Common.js @@ -0,0 +1,239 @@ +'use strict'; + +// #################################################################### +// NEW ROOM +// #################################################################### + +const adjectives = [ + 'small', + 'big', + 'large', + 'smelly', + 'new', + 'happy', + 'shiny', + 'old', + 'clean', + 'nice', + 'bad', + 'cool', + 'hot', + 'cold', + 'warm', + 'hungry', + 'slow', + 'fast', + 'red', + 'white', + 'black', + 'blue', + 'green', + 'basic', + 'strong', + 'cute', + 'poor', + 'nice', + 'huge', + 'rare', + 'lucky', + 'weak', + 'tall', + 'short', + 'tiny', + 'great', + 'long', + 'single', + 'rich', + 'young', + 'dirty', + 'fresh', + 'brown', + 'dark', + 'crazy', + 'sad', + 'loud', + 'brave', + 'calm', + 'silly', + 'smart', +]; + +const nouns = [ + 'dog', + 'bat', + 'wrench', + 'apple', + 'pear', + 'ghost', + 'cat', + 'wolf', + 'squid', + 'goat', + 'snail', + 'hat', + 'sock', + 'plum', + 'bear', + 'snake', + 'turtle', + 'horse', + 'spoon', + 'fork', + 'spider', + 'tree', + 'chair', + 'table', + 'couch', + 'towel', + 'panda', + 'bread', + 'grape', + 'cake', + 'brick', + 'rat', + 'mouse', + 'bird', + 'oven', + 'phone', + 'photo', + 'frog', + 'bear', + 'camel', + 'sheep', + 'shark', + 'tiger', + 'zebra', + 'duck', + 'eagle', + 'fish', + 'kitten', + 'lobster', + 'monkey', + 'owl', + 'puppy', + 'pig', + 'rabbit', + 'fox', + 'whale', + 'beaver', + 'gorilla', + 'lizard', + 'parrot', + 'sloth', + 'swan', +]; + +function getRandomNumber(length) { + let result = ''; + let characters = '0123456789'; + let charactersLength = characters.length; + for (let i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +} + +let adjective = adjectives[Math.floor(Math.random() * adjectives.length)]; +let noun = nouns[Math.floor(Math.random() * nouns.length)]; +let num = getRandomNumber(5); +noun = noun.charAt(0).toUpperCase() + noun.substring(1); +adjective = adjective.charAt(0).toUpperCase() + adjective.substring(1); +document.getElementById('roomName').value = ''; + +// #################################################################### +// TYPING EFFECT +// #################################################################### + +let i = 0; +let txt = num + adjective + noun; +let speed = 100; + +function typeWriter() { + if (i < txt.length) { + document.getElementById('roomName').value += txt.charAt(i); + i++; + setTimeout(typeWriter, speed); + } +} + +typeWriter(); + +// #################################################################### +// LANDING | NEW ROOM +// #################################################################### + +const lastRoomContainer = document.getElementById('lastRoomContainer'); +const lastRoom = document.getElementById('lastRoom'); +const lastRoomName = window.localStorage.lastRoom ? window.localStorage.lastRoom : ''; +if (lastRoomContainer && lastRoom && lastRoomName) { + lastRoomContainer.style.display = 'inline-flex'; + lastRoom.setAttribute('href', '/join/' + lastRoomName); + lastRoom.innerText = lastRoomName; +} + +const genRoomButton = document.getElementById('genRoomButton'); +const joinRoomButton = document.getElementById('joinRoomButton'); +const adultCnt = document.getElementById('adultCnt'); + +genRoomButton.onclick = (e) => { + genRoom(); +}; + +joinRoomButton.onclick = (e) => { + joinRoom(); +}; + +adultCnt.onclick = (e) => { + adultContent(); +}; + +document.getElementById('roomName').onkeyup = (e) => { + if (e.keyCode === 13) { + e.preventDefault(); + joinRoom(); + } +}; + +function genRoom() { + document.getElementById('roomName').value = getUUID4(); +} + +function getUUID4() { + return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => + (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16), + ); +} + +function joinRoom() { + const roomName = filterXSS(document.getElementById('roomName').value); + if (roomName) { + window.location.href = '/join/' + roomName; + window.localStorage.lastRoom = roomName; + } else { + alert('Room name empty!\nPlease pick a room name.'); + } +} + +function adultContent() { + if ( + confirm( + '18+ WARNING! ADULTS ONLY!\n\nExplicit material for viewing by adults 18 years of age or older. You must be at least 18 years old to access to this site!\n\nProceeding you are agree and confirm to have 18+ year.', + ) + ) { + window.open('https://luvlounge.ca', '_blank'); + } +} + +// ######################################################### +// PERMISSIONS +// ######################################################### + +const qs = new URLSearchParams(window.location.search); +const room_id = filterXSS(qs.get('room_id')); +const message = filterXSS(qs.get('message')); +const showMessage = document.getElementById('message'); +console.log('Allow Camera or Audio', { + room_id: room_id, + message: message, +}); +if (showMessage) showMessage.innerHTML = message; diff --git a/public/js/landing.js b/public/js/scripts/Landing.js similarity index 100% rename from public/js/landing.js rename to public/js/scripts/Landing.js diff --git a/public/js/scripts/Login.js b/public/js/scripts/Login.js new file mode 100644 index 00000000..e6e0d1f6 --- /dev/null +++ b/public/js/scripts/Login.js @@ -0,0 +1,83 @@ +'use strict'; + +console.log(window.location); + +const usernameInput = document.getElementById('username'); +const passwordInput = document.getElementById('password'); +const loginBtn = document.getElementById('loginButton'); + +usernameInput.onkeyup = (e) => { + if (e.keyCode === 13) { + e.preventDefault(); + login(); + } +}; +passwordInput.onkeyup = (e) => { + if (e.keyCode === 13) { + e.preventDefault(); + login(); + } +}; + +loginBtn.onclick = (e) => { + login(); +}; + +function login() { + const username = filterXSS(document.getElementById('username').value); + const password = filterXSS(document.getElementById('password').value); + + // http://localhost:3010/join/?room=test + // http://localhost:3010/join/?room=test&roomPassword=0&name=mirotalksfu&audio=0&video=0&screen=0¬ify=0 + // http://localhost:3010/join/?room=test&roomPassword=0&name=mirotalksfu&audio=0&video=0&screen=0¬ify=0&username=username&password=password + + const qs = new URLSearchParams(window.location.search); + const room = filterXSS(qs.get('room')); + + // http://localhost:3010/join/test + const pathParts = window.location.pathname.split('/'); + const roomPath = pathParts[pathParts.length - 1]; + + if (username && password) { + axios + .post('/login', { + username: username, + password: password, + }) + .then(function (response) { + console.log(response); + + // Store in session + const token = response.data.message; + window.sessionStorage.peer_token = token; + + if (room) { + return (window.location.href = '/join/' + window.location.search); + // return (window.location.href = '/join/?room=' + room + '&token=' + token); + } + if (roomPath) { + return (window.location.href = '/join/' + roomPath); + // return (window.location.href ='/join/?room=' + roomPath + '&token=' + token); + } + + return (window.location.href = '/logged'); + }) + .catch(function (error) { + console.error(error); + alert('Unauthorized'); + }); + return; + } + if (!username && !password) { + alert('Username and Password required'); + return; + } + if (!username) { + alert('Username required'); + return; + } + if (!password) { + alert('Password required'); + return; + } +} diff --git a/public/js/Snow.js b/public/js/scripts/Snow.js similarity index 100% rename from public/js/Snow.js rename to public/js/scripts/Snow.js diff --git a/public/js/Umami.js b/public/js/scripts/Umami.js similarity index 100% rename from public/js/Umami.js rename to public/js/scripts/Umami.js diff --git a/public/views/404.html b/public/views/404.html index 3917646b..ee961cdb 100755 --- a/public/views/404.html +++ b/public/views/404.html @@ -44,8 +44,8 @@ - - + + @@ -209,7 +209,7 @@ - + diff --git a/public/views/50X.html b/public/views/50X.html index 127e7248..902ec89f 100755 --- a/public/views/50X.html +++ b/public/views/50X.html @@ -44,8 +44,8 @@ - - + + @@ -201,7 +201,7 @@ - + diff --git a/public/views/Room.html b/public/views/Room.html index 84954329..2e86f806 100644 --- a/public/views/Room.html +++ b/public/views/Room.html @@ -65,7 +65,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/public/views/about.html b/public/views/about.html index 9c7137f5..ce0473b4 100644 --- a/public/views/about.html +++ b/public/views/about.html @@ -44,8 +44,8 @@ - - + + @@ -178,7 +178,7 @@ - + diff --git a/public/views/landing.html b/public/views/landing.html index b4fb37e6..15c9c914 100644 --- a/public/views/landing.html +++ b/public/views/landing.html @@ -42,14 +42,16 @@ - + + + + + + - - - - @@ -137,61 +139,16 @@ - -
Your recent room:
- @@ -442,7 +399,7 @@
  • -
  • - - + + diff --git a/public/views/login.html b/public/views/login.html index 9aa8673e..417169ad 100644 --- a/public/views/login.html +++ b/public/views/login.html @@ -44,8 +44,8 @@ - - + + @@ -121,94 +121,6 @@ -
    @@ -325,7 +237,8 @@
    - + + diff --git a/public/views/newroom.html b/public/views/newroom.html index 6679dbd5..e2a72e43 100755 --- a/public/views/newroom.html +++ b/public/views/newroom.html @@ -45,8 +45,8 @@ - - + + @@ -137,61 +137,16 @@ - -
    Your recent room:
    - @@ -293,8 +248,8 @@ - - + + diff --git a/public/views/permission.html b/public/views/permission.html index 89b92a4a..f97a53c5 100755 --- a/public/views/permission.html +++ b/public/views/permission.html @@ -44,8 +44,8 @@ - - + + @@ -91,16 +91,6 @@ This app will not work without camera or microphone access. Please try again and allow it.

    -
    - + diff --git a/public/views/privacy.html b/public/views/privacy.html index cc98d84e..d346b946 100755 --- a/public/views/privacy.html +++ b/public/views/privacy.html @@ -44,8 +44,8 @@ - - + + @@ -217,7 +217,7 @@ - +