[mirotalksfu] - refactoring, update dep

هذا الالتزام موجود في:
Miroslav Pejic
2024-05-03 13:46:55 +02:00
الأصل 48e7e37138
التزام 5d5afe812e
20 ملفات معدلة مع 365 إضافات و394 حذوفات

عرض الملف

@@ -44,8 +44,8 @@
<!-- Js scripts -->
<script defer src="../js/Brand.js"></script>
<script async src="../js/Umami.js"></script>
<script defer src="../js/scripts/Brand.js"></script>
<script async src="../js/scripts/Umami.js"></script>
<script src="https://unpkg.com/animejs@3.0.1/lib/anime.min.js"></script>
<script src="https://unpkg.com/scrollreveal@4.0.0/dist/scrollreveal.min.js"></script>
@@ -121,94 +121,6 @@
</button>
</div>
</div>
<script>
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&notify=0
// http://localhost:3010/join/?room=test&roomPassword=0&name=mirotalksfu&audio=0&video=0&screen=0&notify=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;
}
}
</script>
</div>
<div class="hero-figure anime-element">
<svg class="placeholder" width="528" height="396" viewBox="0 0 528 396">
@@ -325,7 +237,8 @@
</footer>
</div>
<script defer src="../js/landing.js"></script>
<script defer src="../js/scripts/Login.js"></script>
<script defer src="../js/scripts/Landing.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>