From 8ba07cfa3ed9b9da1de40bf8f4277d5c5720c0ea Mon Sep 17 00:00:00 2001 From: Dmitry Lenshin Date: Wed, 24 Sep 2025 13:17:34 +0300 Subject: [PATCH] Configuration to disable custom denoise --- .env.template | 3 +++ app/src/config.template.js | 1 + public/js/Room.js | 18 ++++++++++++++---- public/js/RoomClient.js | 2 +- public/js/Rules.js | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.env.template b/.env.template index f1afea0e..6d078bb7 100644 --- a/.env.template +++ b/.env.template @@ -412,6 +412,9 @@ STATS_ENABLED=true # Enable usage statistics (tru STATS_SRC=https://stats.mirotalk.com/script.js # Stats script URL STATS_ID=41d26670-f275-45bb-af82-3ce91fe57756 # Stats tracking ID +# Custom noise supression +CUSTOM_NOISE_SUPPRESSION_ENABLED=true # Enable custom noise supression, default one will still work if this is disabled (true|false) + # ----------------------------------------------------- # 11. Global Moderation Configuration # ----------------------------------------------------- diff --git a/app/src/config.template.js b/app/src/config.template.js index 99b498bd..d42962f9 100644 --- a/app/src/config.template.js +++ b/app/src/config.template.js @@ -1211,6 +1211,7 @@ module.exports = { pushToTalk: process.env.ENABLE_PUSH_TO_TALK !== 'false', keyboardShortcuts: process.env.SHOW_KEYBOARD_SHORTCUTS !== 'false', virtualBackground: process.env.SHOW_VIRTUAL_BACKGROUND !== 'false', + customNoiseSuppression: process.env.CUSTOM_NOISE_SUPPRESSION_ENABLED !== 'false', }, // Video controls for producer (local user) diff --git a/public/js/Room.js b/public/js/Room.js index d9acbb08..66892656 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -1124,10 +1124,8 @@ async function whoAreYou() { const serverButtons = response.data.message; if (serverButtons) { // Merge serverButtons into BUTTONS, keeping the existing keys in BUTTONS if they are not present in serverButtons - BUTTONS = { - ...BUTTONS, // Spread current BUTTONS first to keep existing keys - ...serverButtons, // Overwrite or add new keys from serverButtons - }; + BUTTONS = mergeConfig(BUTTONS, serverButtons); + console.log('04 ----> AXIOS ROOM BUTTONS SETTINGS', { serverButtons: serverButtons, clientButtons: BUTTONS, @@ -1289,6 +1287,17 @@ async function whoAreYou() { } } +function mergeConfig(current, updated) { + for (const key of Object.keys(updated)) { + if (!current.hasOwnProperty(key) || typeof updated[key] !== 'object') { + current[key] = updated[key]; + } else { + mergeConfig(current[key], updated[key]); + } + } + return current; +} + function handleAudio() { isAudioAllowed = isAudioAllowed ? false : true; initAudioButton.className = 'fas fa-microphone' + (isAudioAllowed ? '' : '-slash'); @@ -1698,6 +1707,7 @@ function roomIsReady() { BUTTONS.settings.broadcastingButton && show(broadcastingButton); BUTTONS.settings.lobbyButton && show(lobbyButton); BUTTONS.settings.sendEmailInvitation && show(sendEmailInvitation); + !BUTTONS.settings.customNoiseSuppression && hide(noiseSuppressionButton); if (rc.recording.recSyncServerRecording) show(roomRecordingServer); BUTTONS.main.aboutButton && show(aboutButton); if (!isMobileDevice) show(pinUnpinGridDiv); diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index fed33a8c..3818d7d6 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -1773,7 +1773,7 @@ class RoomClient { } } - if (audio) { + if (audio && BUTTONS.settings.customNoiseSuppression) { /* * Initialize RNNoise Suppression if enabled and supported * This will only apply to audio tracks diff --git a/public/js/Rules.js b/public/js/Rules.js index 72358368..b0344aeb 100644 --- a/public/js/Rules.js +++ b/public/js/Rules.js @@ -56,6 +56,7 @@ let BUTTONS = { pushToTalk: true, keyboardShortcuts: true, virtualBackground: true, + customNoiseSuppression: true, }, producerVideo: { videoPictureInPicture: true,