[mirotalksfu] - add notifications section in settings
هذا الالتزام موجود في:
@@ -1044,6 +1044,26 @@ body {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Settings Notifications
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
#notificationsModeDiv input[type='text'] {
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border: var(--border);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#notifyEmailCleanBtn {
|
||||
height: 45px;
|
||||
padding: 10px;
|
||||
margin: 10px 0 10px 5px; /* top | right | bottom | left */
|
||||
border: var(--border);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
# Transcription Room
|
||||
--------------------------------------------------------------*/
|
||||
|
||||
@@ -78,7 +78,7 @@ let BRAND = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: '<strong>WebRTC SFU v1.9.83</strong>',
|
||||
title: '<strong>WebRTC SFU v1.9.84</strong>',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
@@ -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.9.83
|
||||
* @version 1.9.84
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1709,6 +1709,7 @@ function roomIsReady() {
|
||||
BUTTONS.settings.lobbyButton && show(lobbyButton);
|
||||
BUTTONS.settings.sendEmailInvitation && show(sendEmailInvitation);
|
||||
!BUTTONS.settings.customNoiseSuppression && hide(noiseSuppressionButton);
|
||||
BUTTONS.settings.tabNotificationsBtn && show(tabNotificationsBtn);
|
||||
if (rc.recording.recSyncServerRecording) show(roomRecordingServer);
|
||||
BUTTONS.main.aboutButton && show(aboutButton);
|
||||
if (!isMobileDevice) show(pinUnpinGridDiv);
|
||||
@@ -1936,6 +1937,9 @@ function handleButtons() {
|
||||
tabAspectBtn.onclick = (e) => {
|
||||
rc.openTab(e, 'tabAspect');
|
||||
};
|
||||
tabNotificationsBtn.onclick = (e) => {
|
||||
rc.openTab(e, 'tabNotifications');
|
||||
};
|
||||
tabModeratorBtn.onclick = (e) => {
|
||||
rc.openTab(e, 'tabModerator');
|
||||
};
|
||||
@@ -1951,6 +1955,12 @@ function handleButtons() {
|
||||
tabLanguagesBtn.onclick = (e) => {
|
||||
rc.openTab(e, 'tabLanguages');
|
||||
};
|
||||
notifyEmailCleanBtn.onclick = () => {
|
||||
rc.cleanNotifications();
|
||||
};
|
||||
saveNotificationsBtn.onclick = () => {
|
||||
rc.saveNotifications();
|
||||
};
|
||||
tabVideoAIBtn.onclick = (e) => {
|
||||
rc.openTab(e, 'tabVideoAI');
|
||||
rc.getAvatarList();
|
||||
@@ -5700,7 +5710,7 @@ function showAbout() {
|
||||
position: 'center',
|
||||
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
|
||||
customClass: { image: 'img-about' },
|
||||
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.83',
|
||||
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.84',
|
||||
html: `
|
||||
<br />
|
||||
<div id="about">
|
||||
|
||||
@@ -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.9.83
|
||||
* @version 1.9.84
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -7925,6 +7925,9 @@ class RoomClient {
|
||||
case 'customThemeKeep':
|
||||
this.userLog('info', `${icons.theme} Custom theme keep ${status}`, 'top-end');
|
||||
break;
|
||||
case 'save_room_notifications':
|
||||
this.userLog('success', 'Room notifications saved successfully', 'top-end');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -10660,6 +10663,78 @@ class RoomClient {
|
||||
}
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
// ROOM NOTIFICATIONS
|
||||
// ####################################################
|
||||
|
||||
cleanNotifications() {
|
||||
getId('notifyEmailInput').value = '';
|
||||
getId('switchNotifyUserJoin').checked = false;
|
||||
this.saveNotifications(false);
|
||||
}
|
||||
|
||||
saveNotifications(validate = true) {
|
||||
if (validate && !this.isValidNotifications()) return;
|
||||
|
||||
const data = this.getNotificationsData();
|
||||
|
||||
if (!data) return;
|
||||
|
||||
this.setNotificationsData(data);
|
||||
}
|
||||
|
||||
setNotificationsData(data) {
|
||||
this.socket.emit('updateRoomNotifications', data, (response) => {
|
||||
if (response.error) {
|
||||
this.cleanNotifications();
|
||||
this.userLog('warning', response.error, 'top-end', 6000);
|
||||
} else {
|
||||
this.roomMessage('save_room_notifications', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isValidNotifications() {
|
||||
const notifyEmailInput = getId('notifyEmailInput');
|
||||
if (!this.isValidEmail(notifyEmailInput.value)) {
|
||||
notifyEmailInput.value = '';
|
||||
this.userLog('warning', 'Email not valid', 'top-end', 6000);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
getNotificationsData() {
|
||||
const notifyEmailInput = getId('notifyEmailInput');
|
||||
const switchNotifyUserJoin = getId('switchNotifyUserJoin');
|
||||
|
||||
return {
|
||||
peer_name: this.peer_name,
|
||||
peer_uuid: this.peer_uuid,
|
||||
notifications: {
|
||||
mode: {
|
||||
email: notifyEmailInput.value,
|
||||
//slack...
|
||||
},
|
||||
events: {
|
||||
join: switchNotifyUserJoin.checked,
|
||||
// leave...
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
// HELPERS
|
||||
// ####################################################
|
||||
|
||||
isValidEmail(email) {
|
||||
if (!email || typeof email !== 'string') return false;
|
||||
const e = email.trim();
|
||||
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/;
|
||||
return re.test(e);
|
||||
}
|
||||
|
||||
toggleVideoMirror() {
|
||||
const peerVideo = this.getName(this.peer_id);
|
||||
if (peerVideo) peerVideo.classList.toggle('mirror');
|
||||
|
||||
@@ -50,6 +50,7 @@ let BUTTONS = {
|
||||
sendEmailInvitation: true, // presenter
|
||||
micOptionsButton: true,
|
||||
tabRTMPStreamingBtn: true, // presenter
|
||||
tabNotificationsBtn: true, // presenter
|
||||
tabModerator: true, // presenter
|
||||
tabRecording: true,
|
||||
host_only_recording: true, // presenter
|
||||
@@ -138,6 +139,7 @@ function handleRules(isPresenter) {
|
||||
BUTTONS.settings.sendEmailInvitation = false;
|
||||
BUTTONS.settings.tabRTMPStreamingBtn = false;
|
||||
BUTTONS.settings.tabModerator = false;
|
||||
BUTTONS.settings.tabNotificationsBtn = false;
|
||||
BUTTONS.videoOff.muteAudioButton = false;
|
||||
BUTTONS.videoOff.geolocationButton = false;
|
||||
BUTTONS.videoOff.banButton = false;
|
||||
@@ -224,6 +226,7 @@ function handleRules(isPresenter) {
|
||||
BUTTONS.settings.lobbyButton ? show(lobbyButton) : hide(lobbyButton);
|
||||
BUTTONS.settings.sendEmailInvitation ? show(sendEmailInvitation) : hide(sendEmailInvitation);
|
||||
!BUTTONS.settings.micOptionsButton && hide(micOptionsButton);
|
||||
!BUTTONS.settings.tabNotificationsBtn && hide(tabNotificationsBtn);
|
||||
!BUTTONS.settings.tabModerator && hide(tabModeratorBtn);
|
||||
if (BUTTONS.settings.host_only_recording) {
|
||||
show(recordingImage);
|
||||
@@ -260,6 +263,7 @@ function handleRulesBroadcasting() {
|
||||
BUTTONS.settings.unlockRoomButton = false;
|
||||
BUTTONS.settings.lobbyButton = false;
|
||||
BUTTONS.settings.tabRTMPStreamingBtn = false;
|
||||
BUTTONS.settings.tabNotificationsBtn = false;
|
||||
BUTTONS.videoOff.muteAudioButton = false;
|
||||
BUTTONS.videoOff.geolocationButton = false;
|
||||
BUTTONS.videoOff.banButton = false;
|
||||
@@ -296,5 +300,6 @@ function handleRulesBroadcasting() {
|
||||
elemDisplay('lobbyButton', false);
|
||||
elemDisplay('settingsButton', false);
|
||||
elemDisplay('tabRTMPStreamingBtn', false);
|
||||
elemDisplay('tabNotificationsBtn', false);
|
||||
//...
|
||||
}
|
||||
|
||||
@@ -254,6 +254,9 @@ access to use this app.
|
||||
<button id="tabAudioDevicesBtn" class="fas fa-microphone tablinks">
|
||||
<p class="tabButtonText">Audio</p>
|
||||
</button>
|
||||
<button id="tabNotificationsBtn" class="fas fa-bell tablinks hidden">
|
||||
<p class="tabButtonText">Notifications</p>
|
||||
</button>
|
||||
<button id="tabModeratorBtn" class="fas fa-user-shield tablinks">
|
||||
<p class="tabButtonText">Moderator</p>
|
||||
</button>
|
||||
@@ -605,6 +608,49 @@ access to use this app.
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div id="tabNotifications" class="tabcontent">
|
||||
<span class="mod-title">Notifications mode</span>
|
||||
<hr />
|
||||
<div id="notificationsModeDiv">
|
||||
<div class="title">
|
||||
<i class="fas fa-envelope"></i>
|
||||
<p>Email</p>
|
||||
</div>
|
||||
<div class="input-container">
|
||||
<input
|
||||
type="text"
|
||||
id="notifyEmailInput"
|
||||
class="form-control"
|
||||
placeholder="Enter email"
|
||||
/>
|
||||
<button id="notifyEmailCleanBtn"><i class="fas fa-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="title">
|
||||
<i class="fas fa-bell"></i>
|
||||
<p>Events:</p>
|
||||
</div>
|
||||
<table class="settingsTable">
|
||||
<tr id="notifyUserJoinBtn">
|
||||
<td>
|
||||
<div class="title">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
<p>First User Join</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-check form-switch form-switch-md title">
|
||||
<input id="switchNotifyUserJoin" class="form-check-input" type="checkbox" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button id="saveNotificationsBtn" class="btn-custom">
|
||||
<i class="fas fa-save"></i> Save Notifications
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="tabModerator" class="tabcontent">
|
||||
<span class="mod-title">Moderator options for Everyone</span>
|
||||
<hr />
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم