diff --git a/src/components/AdminSettings/GeneralSettings.vue b/src/components/AdminSettings/GeneralSettings.vue index 05244a4b5fc..1cbd37e28fa 100644 --- a/src/components/AdminSettings/GeneralSettings.vue +++ b/src/components/AdminSettings/GeneralSettings.vue @@ -27,15 +27,38 @@ {{ t('spreed', 'Allow conversations on files') }} {{ t('spreed', 'Allow conversations on public shares for files') }} + + @@ -44,8 +67,11 @@ import { loadState } from '@nextcloud/initial-state' import { t } from '@nextcloud/l10n' import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' +import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' +import { EventBus } from '../../services/EventBus.ts' + const defaultGroupNotificationOptions = [ { value: 1, label: t('spreed', 'All messages') }, { value: 2, label: t('spreed', '@-mentions only') }, @@ -55,6 +81,7 @@ export default { name: 'GeneralSettings', components: { + NcNoteCard, NcCheckboxRadioSwitch, NcSelect, }, @@ -70,6 +97,11 @@ export default { conversationsFiles: parseInt(loadState('spreed', 'conversations_files')) === 1, conversationsFilesPublicShares: parseInt(loadState('spreed', 'conversations_files_public_shares')) === 1, + + hasFeatureJoinFeatures: false, + hasSignalingServers: false, + isE2EECallsEnabled: false, + hasSIPBridge: !!loadState('spreed', 'sip_bridge_shared_secret'), } }, @@ -80,16 +112,53 @@ export default { isConversationsFilesPublicSharesChecked() { return this.conversationsFilesPublicShares }, + canEnableE2EECalls() { + return this.hasFeatureJoinFeatures || !this.hasSIPBridge + }, }, mounted() { this.loading = true this.defaultGroupNotification = defaultGroupNotificationOptions[parseInt(loadState('spreed', 'default_group_notification')) - 1] this.loading = false + + const signaling = loadState('spreed', 'signaling_servers') + this.updateSignalingServers(signaling.servers) + EventBus.on('signaling-servers-updated', this.updateSignalingServers) + EventBus.on('signaling-server-connected', this.updateSignalingDetails) + EventBus.on('sip-settings-updated', this.updateSipDetails) + }, + + beforeDestroy() { + EventBus.off('signaling-servers-updated', this.updateSignalingServers) + EventBus.off('signaling-server-connected', this.updateSignalingDetails) + EventBus.off('sip-settings-updated', this.updateSipDetails) }, methods: { t, + + updateSignalingServers(servers) { + this.hasSignalingServers = servers.length > 0 + }, + + updateSignalingDetails(signaling) { + this.hasFeatureJoinFeatures = signaling.hasFeature('join-features') + }, + + updateSipDetails(settings) { + this.hasSIPBridge = !!settings.sharedSecret + }, + + updateE2EECallsEnabled(value) { + this.loading = true + OCP.AppConfig.setValue('spreed', 'call_end_to_end_encryption', value ? '1' : '0', { + success: () => { + this.loading = false + }, + }) + }, + saveDefaultGroupNotification() { this.loadingDefaultGroupNotification = true @@ -139,6 +208,13 @@ h3 { font-weight: 600; } +small { + color: var(--color-warning); + border: 1px solid var(--color-warning); + border-radius: 16px; + padding: 0 9px; +} + .default-group-notification { min-width: 300px !important; } diff --git a/src/components/AdminSettings/SIPBridge.vue b/src/components/AdminSettings/SIPBridge.vue index 70c7be5460f..39f4455cf82 100644 --- a/src/components/AdminSettings/SIPBridge.vue +++ b/src/components/AdminSettings/SIPBridge.vue @@ -188,6 +188,7 @@ export default { dialOutEnabled: this.dialOutEnabled, sipGroups: this.sipGroups.map(group => group.id).join('_') } + EventBus.emit('sip-settings-updated', this.currentSetup) }, async saveSIPSettings() { 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')