diff --git a/src/components/AdminSettings/GeneralSettings.vue b/src/components/AdminSettings/GeneralSettings.vue index 2adf27c30bc..a68d1406e01 100644 --- a/src/components/AdminSettings/GeneralSettings.vue +++ b/src/components/AdminSettings/GeneralSettings.vue @@ -53,7 +53,7 @@ + :text="t('spreed', 'End-to-end encryption is only possible with a High-performance backend or feature is missing.')" /> @@ -96,7 +96,8 @@ export default { conversationsFiles: parseInt(loadState('spreed', 'conversations_files')) === 1, conversationsFilesPublicShares: parseInt(loadState('spreed', 'conversations_files_public_shares')) === 1, - canEnableE2EE: false, + hasE2EEFeature: false, + hasSignalingServers: false, isE2EECallsEnabled: false, } }, @@ -108,6 +109,9 @@ export default { isConversationsFilesPublicSharesChecked() { return this.conversationsFilesPublicShares }, + canEnableE2EE() { + return this.hasE2EEFeature && this.hasSignalingServers + }, }, mounted() { @@ -118,22 +122,32 @@ export default { const signaling = loadState('spreed', 'signaling_servers') this.updateSignalingServers(signaling.servers) EventBus.on('signaling-servers-updated', this.updateSignalingServers) + EventBus.on('signaling-server-connected', this.updateSignalingDetails) }, beforeDestroy() { EventBus.off('signaling-servers-updated', this.updateSignalingServers) + EventBus.off('signaling-server-connected', this.updateSignalingDetails) }, methods: { t, updateSignalingServers(servers) { - this.canEnableE2EE = servers.length > 0 + this.hasSignalingServers = servers.length > 0 + }, + + updateSignalingDetails(signaling) { + this.hasE2EEFeature = signaling.hasFeature('join-features') }, updateE2EECallsEnabled(value) { - // TODO: add API handling - console.log(value) + this.loading = true + OCP.AppConfig.setValue('spreed', 'call_end_to_end_encryption', value ? '1' : '0', { + success: () => { + this.loading = false + }, + }) }, saveDefaultGroupNotification() { diff --git a/src/components/AdminSettings/SignalingServer.vue b/src/components/AdminSettings/SignalingServer.vue index e356b471e69..6a2f8c4bf2a 100644 --- a/src/components/AdminSettings/SignalingServer.vue +++ b/src/components/AdminSettings/SignalingServer.vue @@ -77,6 +77,7 @@ import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadi import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js' +import { EventBus } from '../../services/EventBus.ts' import { fetchSignalingSettings, getWelcomeMessage } from '../../services/signalingService.js' import { createConnection } from '../../utils/SignalingStandaloneTest.js' @@ -237,6 +238,7 @@ export default { { caption: t('spreed', 'WebSocket URL'), description: signalingTest.url }, { caption: t('spreed', 'Available features'), description: signalingTest.features.join(', ') }, ] + EventBus.emit('signaling-server-connected', signalingTest) } catch (exception) { console.error(exception) this.errorMessage = t('spreed', 'Error: Websocket connection failed. Check browser console')