[mirotalksfu] - improvements
هذا الالتزام موجود في:
@@ -136,7 +136,8 @@ app.get(['/login'], (req, res) => {
|
|||||||
if (hostCfg.protected == true) {
|
if (hostCfg.protected == true) {
|
||||||
let ip = getIP(req);
|
let ip = getIP(req);
|
||||||
log.debug(`Request login to host from: ${ip}`, req.query);
|
log.debug(`Request login to host from: ${ip}`, req.query);
|
||||||
if (req.query.username == hostCfg.username && req.query.password == hostCfg.password) {
|
const { username, password } = req.query;
|
||||||
|
if (username == hostCfg.username && password == hostCfg.password) {
|
||||||
hostCfg.authenticated = true;
|
hostCfg.authenticated = true;
|
||||||
authHost = new Host(ip, true);
|
authHost = new Host(ip, true);
|
||||||
log.debug('LOGIN OK', { ip: ip, authorized: authHost.isAuthorized(ip) });
|
log.debug('LOGIN OK', { ip: ip, authorized: authHost.isAuthorized(ip) });
|
||||||
@@ -171,12 +172,8 @@ app.get('/join/', (req, res) => {
|
|||||||
if (hostCfg.authenticated && Object.keys(req.query).length > 0) {
|
if (hostCfg.authenticated && Object.keys(req.query).length > 0) {
|
||||||
log.debug('Direct Join', req.query);
|
log.debug('Direct Join', req.query);
|
||||||
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=1&video=1¬ify=1
|
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=1&video=1¬ify=1
|
||||||
let roomName = req.query.room;
|
const { room, name, audio, video, notify } = req.query;
|
||||||
let peerName = req.query.name;
|
if (room && name && audio && video && notify) {
|
||||||
let peerAudio = req.query.audio;
|
|
||||||
let peerVideo = req.query.video;
|
|
||||||
let notify = req.query.notify;
|
|
||||||
if (roomName && peerName && peerAudio && peerVideo && notify) {
|
|
||||||
return res.sendFile(view.room);
|
return res.sendFile(view.room);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,17 +101,48 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
let usernameInput = document.getElementById('username');
|
||||||
|
let passwordInput = document.getElementById('password');
|
||||||
let loginBtn = document.getElementById('loginButton');
|
let 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) => {
|
loginBtn.onclick = (e) => {
|
||||||
|
login();
|
||||||
|
};
|
||||||
|
|
||||||
|
function login() {
|
||||||
let username = document.getElementById('username').value;
|
let username = document.getElementById('username').value;
|
||||||
let password = document.getElementById('password').value;
|
let password = document.getElementById('password').value;
|
||||||
|
|
||||||
if (username && password) {
|
if (username && password) {
|
||||||
window.location.href = `/login?username=${username}&password=${password}`;
|
window.location.href = `/login?username=${username}&password=${password}`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alert('Username and Password required');
|
if (!username && !password) {
|
||||||
};
|
alert('Username and Password required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!username) {
|
||||||
|
alert('Username required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!password) {
|
||||||
|
alert('Password required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div class="hero-figure anime-element">
|
<div class="hero-figure anime-element">
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم