[mirotalksfu] - #125 improvements

هذا الالتزام موجود في:
Miroslav Pejic
2023-09-06 15:52:57 +02:00
الأصل 31bb7edd0d
التزام 9a9e43a650
3 ملفات معدلة مع 26 إضافات و5 حذوفات

عرض الملف

@@ -105,13 +105,12 @@
</div>
</div>
<script>
console.log(window.location);
const usernameInput = document.getElementById('username');
const passwordInput = document.getElementById('password');
const loginBtn = document.getElementById('loginButton');
const qs = new URLSearchParams(window.location.search);
const room = filterXSS(qs.get('room'));
usernameInput.onkeyup = (e) => {
if (e.keyCode === 13) {
e.preventDefault();
@@ -133,6 +132,15 @@
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&password=0&name=mirotalksfu&audio=0&video=0&screen=0&notify=0
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', {
@@ -141,10 +149,16 @@
})
.then(function (response) {
console.log(response);
// http://localhost:3010/?room=test
if (room) {
return (window.location.href = '/join/' + room);
return (window.location.href =
'/join/' + window.location.search);
}
if (roomPath) {
return (window.location.href = '/join/' + roomPath);
}
return (window.location.href = '/logged');
})
.catch(function (error) {