Skip to content

Commit

Permalink
[mirotalksfu] - replace alert with sweetalert
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jan 12, 2025
1 parent 1056322 commit 4215cca
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev 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.6.98
* @version 1.6.99
*
*/

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.6.98",
"version": "1.6.99",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions public/js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ function joinRoom() {
const roomValid = isValidRoomName(roomName);

if (!roomName) {
alert('Room name empty!\nPlease pick a room name.');
popup('warning', 'Room name empty!\nPlease pick a room name.');
return;
}
if (!roomValid) {
alert('Invalid Room name!\nPath traversal pattern detected!');
popup('warning', 'Invalid Room name!\nPath traversal pattern detected!');
return;
}

Expand Down
8 changes: 4 additions & 4 deletions public/js/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ function login() {
})
.catch(function (error) {
console.error(error);
alert('Unauthorized');
popup('warning', 'Invalid credentials. Please try again.');
});
return;
}
if (!username && !password) {
alert('Username and Password required');
popup('warning', 'Username and Password required');
return;
}
if (!username) {
alert('Username required');
popup('warning', 'Username required');
return;
}
if (!password) {
alert('Password required');
popup('warning', 'Password required');
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.98
* @version 1.6.99
*
*/

Expand Down Expand Up @@ -4904,7 +4904,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.6.98',
title: 'WebRTC SFU v1.6.99',
html: `
<br />
<div id="about">
Expand Down
2 changes: 1 addition & 1 deletion public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.98
* @version 1.6.99
*
*/

Expand Down
15 changes: 15 additions & 0 deletions public/js/Utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

function popup(icon, text, position = 'center') {
Swal.fire({
background: '#1D2026',
position: position,
icon: icon,
text: text,
color: '#FFFFFF',
confirmButtonColor: '#1A84F5',
showClass: { popup: 'animate__animated animate__fadeInDown' },
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
});
}
//...
5 changes: 4 additions & 1 deletion public/views/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

<!-- StyleSheet -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,600" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<link rel="stylesheet" type="text/css" href="../css/landing.css" />
Expand All @@ -52,6 +53,7 @@
<script defer src="../js/Brand.js"></script>
<script async src="../js/Umami.js"></script>

<script defer src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.8"></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>
<script src="https://cdn.jsdelivr.net/npm/xss/dist/xss.min.js"></script>
Expand Down Expand Up @@ -628,8 +630,9 @@ <h3 class="tac">Our advertisers</h3>
</footer>
</div>

<script defer src="../js/Landing.js"></script>
<script defer src="../js/Utils.js"></script>
<script defer src="../js/Common.js"></script>
<script defer src="../js/Landing.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>
10 changes: 8 additions & 2 deletions public/views/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
crossorigin="anonymous"
></script>

<!-- https://animate.style 4 using for swal fadeIn-Out -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />

<!-- Js scripts -->

<script defer src="../js/Brand.js"></script>
Expand All @@ -65,12 +69,13 @@
<script src="https://unpkg.com/scrollreveal@4.0.0/dist/scrollreveal.min.js"></script>

<!-- xss -->

<script src="https://cdn.jsdelivr.net/npm/xss/dist/xss.min.js"></script>

<!-- axios -->

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

<!-- sweetalert -->
<script defer src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.8"></script>
</head>
<body class="is-boxed has-animations">
<div class="body-wrap">
Expand Down Expand Up @@ -250,6 +255,7 @@ <h1 class="hero-title mt-0">
</footer>
</div>

<script defer src="../js/Utils.js"></script>
<script defer src="../js/Login.js"></script>
<script defer src="../js/Landing.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
Expand Down
4 changes: 3 additions & 1 deletion public/views/newroom.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<meta id="ogUrl" property="og:url" content="https://sfu.mirotalk.com" />

<!-- StyleSheet -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,600" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<link rel="stylesheet" type="text/css" href="../css/landing.css" />
Expand All @@ -48,6 +48,7 @@
<script defer src="../js/Brand.js"></script>
<script async src="../js/Umami.js"></script>

<script defer src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.8"></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>
<script src="https://cdn.jsdelivr.net/npm/xss/dist/xss.min.js"></script>
Expand Down Expand Up @@ -244,6 +245,7 @@ <h3 class="section-title mt-0">
</footer>
</div>

<script defer src="../js/Utils.js"></script>
<script defer src="../js/Landing.js"></script>
<script defer src="../js/Common.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
Expand Down

0 comments on commit 4215cca

Please sign in to comment.