[mirotalksfu] - #125 improvements
هذا الالتزام موجود في:
@@ -279,6 +279,9 @@ function startServer() {
|
||||
return res.sendFile(views.room);
|
||||
}
|
||||
}
|
||||
if (hostCfg.protected) {
|
||||
return res.sendFile(views.login);
|
||||
}
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
@@ -287,6 +290,9 @@ function startServer() {
|
||||
if (hostCfg.authenticated) {
|
||||
res.sendFile(views.room);
|
||||
} else {
|
||||
if (hostCfg.protected) {
|
||||
return res.sendFile(views.login);
|
||||
}
|
||||
res.redirect('/');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -515,6 +515,7 @@ function getRoomPassword() {
|
||||
console.log('Direct join', { password: roomPassword });
|
||||
return roomPassword;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
|
||||
@@ -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¬ify=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) {
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم