Skip to content

Commit

Permalink
Merge pull request #12771 from nextcloud/fix/10486/require-hpb-for-re…
Browse files Browse the repository at this point in the history
…cording-configuration

fix(AdminSettings): Require HPB for recording server configuration
  • Loading branch information
Antreesy authored Jul 26, 2024
2 parents 02eb9c2 + 2e818fb commit b935e30
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 58 deletions.
14 changes: 12 additions & 2 deletions src/components/AdminSettings/HostedSignalingServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
import { EventBus } from '../../services/EventBus.js'
export default {
name: 'HostedSignalingServer',
Expand Down Expand Up @@ -209,8 +211,12 @@ export default {
this.hostedHPBCountry = this.countries.find(country => country.code === state.country) ?? this.countries[0]
const signaling = loadState('spreed', 'signaling_servers')
this.showForm = this.trialAccount.length !== 0
|| signaling.servers.length === 0
this.updateSignalingServers(signaling.servers)
EventBus.on('signaling-servers-updated', this.updateSignalingServers)
},
beforeDestroy() {
EventBus.off('signaling-servers-updated', this.updateSignalingServers)
},
methods: {
Expand Down Expand Up @@ -250,6 +256,10 @@ export default {
this.loading = false
}
},
updateSignalingServers(servers) {
this.showForm = this.trialAccount.length !== 0 || servers.length === 0
},
},
}
</script>
Expand Down
128 changes: 73 additions & 55 deletions src/components/AdminSettings/RecordingServers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,63 +10,69 @@
{{ t('spreed', 'Recording backend') }}
</h2>

<NcNoteCard v-if="showUploadLimitWarning" type="warning">
{{ uploadLimitWarning }}
<NcNoteCard v-if="!showForm" type="warning">
{{ t('spreed', 'Recording backend configuration is only possible with a high-performance backend.') }}
</NcNoteCard>

<TransitionWrapper v-if="servers.length"
name="fade"
tag="ul"
group>
<RecordingServer v-for="(server, index) in servers"
:key="`server${index}`"
:server.sync="servers[index].server"
:verify.sync="servers[index].verify"
:index="index"
:loading="loading"
@remove-server="removeServer"
@update:server="debounceUpdateServers"
@update:verify="debounceUpdateServers" />
</TransitionWrapper>

<NcButton v-else
class="additional-top-margin"
:disabled="loading"
@click="newServer">
<template #icon>
<span v-if="loading" class="icon icon-loading-small" />
<Plus v-else :size="20" />
</template>
{{ t('spreed', 'Add a new recording backend server') }}
</NcButton>

<NcPasswordField class="form__textfield additional-top-margin"
:value="secret"
name="recording_secret"
autocomplete="new-password"
:disabled="loading"
:placeholder="t('spreed', 'Shared secret')"
:label="t('spreed', 'Shared secret')"
label-visible
@update:value="updateSecret" />

<template v-if="servers.length && recordingConsentCapability">
<h3>{{ t('spreed', 'Recording consent') }}</h3>

<template v-for="level in recordingConsentOptions">
<NcCheckboxRadioSwitch :key="level.value + '_radio'"
:value="level.value.toString()"
:checked.sync="recordingConsentSelected"
name="recording-consent"
type="radio"
:disabled="loading"
@update:checked="setRecordingConsent">
{{ level.label }}
</NcCheckboxRadioSwitch>

<p :key="level.value + '_description'" class="consent-description">
{{ getRecordingConsentDescription(level.value) }}
</p>
<template v-else>
<NcNoteCard v-if="showUploadLimitWarning" type="warning">
{{ uploadLimitWarning }}
</NcNoteCard>

<TransitionWrapper v-if="servers.length"
name="fade"
tag="ul"
group>
<RecordingServer v-for="(server, index) in servers"
:key="`server${index}`"
:server.sync="servers[index].server"
:verify.sync="servers[index].verify"
:index="index"
:loading="loading"
@remove-server="removeServer"
@update:server="debounceUpdateServers"
@update:verify="debounceUpdateServers" />
</TransitionWrapper>

<NcButton v-else
class="additional-top-margin"
:disabled="loading"
@click="newServer">
<template #icon>
<span v-if="loading" class="icon icon-loading-small" />
<Plus v-else :size="20" />
</template>
{{ t('spreed', 'Add a new recording backend server') }}
</NcButton>

<NcPasswordField class="form__textfield additional-top-margin"
:value="secret"
name="recording_secret"
autocomplete="new-password"
:disabled="loading"
:placeholder="t('spreed', 'Shared secret')"
:label="t('spreed', 'Shared secret')"
label-visible
@update:value="updateSecret" />

<template v-if="servers.length && recordingConsentCapability">
<h3>{{ t('spreed', 'Recording consent') }}</h3>

<template v-for="level in recordingConsentOptions">
<NcCheckboxRadioSwitch :key="level.value + '_radio'"
:value="level.value.toString()"
:checked.sync="recordingConsentSelected"
name="recording-consent"
type="radio"
:disabled="loading"
@update:checked="setRecordingConsent">
{{ level.label }}
</NcCheckboxRadioSwitch>

<p :key="level.value + '_description'" class="consent-description">
{{ getRecordingConsentDescription(level.value) }}
</p>
</template>
</template>
</template>
</section>
Expand All @@ -92,6 +98,7 @@ import TransitionWrapper from '../UIShared/TransitionWrapper.vue'
import { CALL } from '../../constants.js'
import { hasTalkFeature } from '../../services/CapabilitiesManager.ts'
import { EventBus } from '../../services/EventBus.js'
const recordingConsentCapability = hasTalkFeature('local', 'recording-consent')
const recordingConsentOptions = [
Expand Down Expand Up @@ -127,6 +134,7 @@ export default {
uploadLimit: 0,
loading: false,
saved: false,
showForm: true,
recordingConsentSelected: loadState('spreed', 'recording_consent').toString(),
debounceUpdateServers: () => {},
}
Expand All @@ -145,14 +153,20 @@ export default {
beforeMount() {
this.debounceUpdateServers = debounce(this.updateServers, 1000)
const state = loadState('spreed', 'recording_servers')
this.servers = state.servers
this.secret = state.secret
this.uploadLimit = parseInt(state.uploadLimit, 10)
const signaling = loadState('spreed', 'signaling_servers')
this.updateSignalingServers(signaling.servers)
EventBus.on('signaling-servers-updated', this.updateSignalingServers)
},
beforeDestroy() {
this.debounceUpdateServers.clear?.()
EventBus.off('signaling-servers-updated', this.updateSignalingServers)
},
methods: {
Expand Down Expand Up @@ -218,6 +232,10 @@ export default {
this.saved = false
}, 3000)
},
updateSignalingServers(servers) {
this.showForm = servers.length > 0
},
},
}
</script>
Expand Down
11 changes: 10 additions & 1 deletion src/components/AdminSettings/SIPBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import NcTextArea from '@nextcloud/vue/dist/Components/NcTextArea.js'
import { EventBus } from '../../services/EventBus.js'
import { setSIPSettings } from '../../services/settingsService.js'
import { getWelcomeMessage } from '../../services/signalingService.js'
Expand Down Expand Up @@ -147,13 +148,17 @@ export default {
this.debounceSearchGroup('')
this.loading = false
this.saveCurrentSetup()
const signaling = loadState('spreed', 'signaling_servers')
this.showForm = signaling.servers.length > 0
this.updateSignalingServers(signaling.servers)
EventBus.on('signaling-servers-updated', this.updateSignalingServers)
this.isDialoutSupported()
},
beforeDestroy() {
this.debounceSearchGroup.clear?.()
EventBus.off('signaling-servers-updated', this.updateSignalingServers)
},
methods: {
Expand Down Expand Up @@ -219,6 +224,10 @@ export default {
}
}
},
updateSignalingServers(servers) {
this.showForm = servers.length > 0
},
},
}
</script>
Expand Down
2 changes: 2 additions & 0 deletions src/components/AdminSettings/SignalingServers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import SignalingServer from '../../components/AdminSettings/SignalingServer.vue'
import TransitionWrapper from '../UIShared/TransitionWrapper.vue'
import { SIGNALING } from '../../constants.js'
import { EventBus } from '../../services/EventBus.js'
export default {
name: 'SignalingServers',
Expand Down Expand Up @@ -165,6 +166,7 @@ export default {
}), {
success: () => {
showSuccess(t('spreed', 'High-performance backend settings saved'))
EventBus.emit('signaling-servers-updated', this.servers)
this.loading = false
this.toggleSave()
},
Expand Down

0 comments on commit b935e30

Please sign in to comment.