Skip to content

Commit

Permalink
[wip] fixup! feat: add admin toggle for e2ee calls
Browse files Browse the repository at this point in the history
[skip ci]

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Jan 13, 2025
1 parent 7e8b4de commit 3d10280
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/components/AdminSettings/GeneralSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<NcNoteCard v-if="!canEnableE2EE"
type="warning"
:text="t('spreed', 'End-to-end encryption is only possible with a High-performance backend.')" />
:text="t('spreed', 'End-to-end encryption is only possible with a High-performance backend or feature is missing.')" />
<NcNoteCard v-else
type="warning"
:text="t('spreed', 'Mobile clients do not support end-to-end encrypted calls at the moment.')" />
Expand Down Expand Up @@ -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,
}
},
Expand All @@ -108,6 +109,9 @@ export default {
isConversationsFilesPublicSharesChecked() {
return this.conversationsFilesPublicShares
},
canEnableE2EE() {
return this.hasE2EEFeature && this.hasSignalingServers
},
},

mounted() {
Expand All @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions src/components/AdminSettings/SignalingServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 3d10280

Please sign in to comment.