Skip to content

Commit 8d37e88

Browse files
committed
feat: split default camera and microphone settings into separate toggles, Assisted-by: GPT-5.6 Luna
Signed-off-by: Maximilian Martin <maximilian_martin@gmx.de>
1 parent 4f11599 commit 8d37e88

34 files changed

Lines changed: 237 additions & 99 deletions

docs/capabilities.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@
163163
* `chat-summary-api` (local) - Whether the endpoint to get summarized chat messages in a conversation is available
164164
* `email-csv-import` - Whether the endpoint to import a CSV email list as participants exists
165165
* `config => chat => summary-threshold` (local) - Number of unread messages that should exist to show a "Generate summary" option
166-
* `config => call => start-without-media` (local) - Boolean, whether media should be disabled when starting or joining a conversation
166+
* `config => call => start-without-audio` (local) - Boolean, whether audio should be disabled when starting or joining a conversation
167+
* `config => call => start-without-video` (local) - Boolean, whether video should be disabled when starting or joining a conversation
167168
* `config => call => max-duration` - Integer, maximum call duration in seconds. Please note that this should only be used with system cron and with a reasonable high value, due to the expended duration until the background job ran.
168169
* `config => call => blur-virtual-background` (local) - Boolean, whether blur background is set by default when joining a conversation
169170

docs/settings.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
## User settings
2323

24-
**Note:** Settings from `calls_start_without_media` onwards can not be set via above API.
24+
**Note:** Settings from `calls_start_without_audio` onwards can not be set via above API.
2525
Instead, the server API `POST /ocs/v2.php/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}` needs to be used.
2626

2727
| Key | Capability | Default | Valid values |
@@ -30,7 +30,8 @@ Instead, the server API `POST /ocs/v2.php/apps/provisioning_api/api/v1/config/us
3030
| `read_status_privacy` | `config => chat => read-privacy` | `0` | One of the read-status constants from the [constants list](constants.md#participant-read-status-privacy) |
3131
| `typing_privacy` | `config => chat => typing-privacy` | `0` | One of the typing privacy constants from the [constants list](constants.md#participant-typing-privacy) |
3232
| `play_sounds` | | `'yes'` | `'yes'` and `'no'` |
33-
| `calls_start_without_media` | `config => call => start-without-media` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
33+
| `calls_start_without_audio` | `config => call => start-without-audio` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
34+
| `calls_start_without_video` | `config => call => start-without-video` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
3435
| `blur_virtual_background` | `config => call => blur-virtual-background` | `'no'` | `'yes'` and `'no'` |
3536
| `conversations_list_style` | `config => conversations => list-style` | `''` falling back to app config with the same name | One of the constants from the [constants list](constants.md#conversation-list-style) |
3637
| `chat_style` | `config => chat => chat-style` | `''` falling back to app config with the same name | One of the constants from the [constants list](constants.md#chat-style) |
@@ -117,7 +118,8 @@ Legend:
117118
| `hide_signaling_warning` | string<br>`yes` or `no` | `no` | No | 🖌️ | Flag that allows to suppress the warning that an HPB should be configured |
118119
| `conversations_list_style` | string<br>`two-lines` or `compact` | `two-lines` | No | | Default conversation list style when not overwritten by the user |
119120
| `chat_style` | string<br>`split` or `unified` | `split` | No | | Default chat style when not overwritten by the user |
120-
| `calls_start_without_media` | bool | `false` | No | | Whether participants start with enabled or disabled audio and video by default |
121+
| `calls_start_without_audio` | bool | `false` | No | | Whether participants start with audio disabled by default |
122+
| `calls_start_without_video` | bool | `false` | No | | Whether participants start with video disabled by default |
121123
| `breakout_rooms` | bool | `true` | Yes | | Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.) |
122124
| `call_recording` | string<br>`yes` or `no` | `yes` | Yes | | Enable call recording |
123125
| `call_recording_summary` | string<br>`yes` or `no` | `yes` | No | 🖌️ | Whether call recordings should automatically be summarized when a transcription and summary provider is enabled. |

lib/Capabilities.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ class Capabilities implements IPublicCapability {
189189
'predefined-backgrounds',
190190
'predefined-backgrounds-v2',
191191
'can-upload-background',
192-
'start-without-media',
192+
'start-without-audio',
193+
'start-without-video',
193194
'blur-virtual-background',
194195
'live-transcription-target-language-id',
195196
'play-sounds',
@@ -290,7 +291,8 @@ public function getCapabilities(): array {
290291
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
291292
'default-phone-region' => $this->serverConfig->getSystemValueString('default_phone_region'),
292293
'can-enable-sip' => false,
293-
'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()),
294+
'start-without-audio' => $this->talkConfig->getCallsStartWithoutAudio($user?->getUID()),
295+
'start-without-video' => $this->talkConfig->getCallsStartWithoutVideo($user?->getUID()),
294296
'max-duration' => $this->appConfig->getAppValueInt('max_call_duration'),
295297
'blur-virtual-background' => $this->talkConfig->getBlurVirtualBackground($user?->getUID()),
296298
'end-to-end-encryption' => $this->talkConfig->isCallEndToEndEncryptionEnabled(),

lib/Config.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class Config {
6060
public const string EXTERNAL_CALL_SERVICE_AUTH_USER = 'external_call_service_auth_user';
6161
public const string EXTERNAL_CALL_SERVICE_AUTH_PASSWORD = 'external_call_service_auth_password';
6262
public const string EXTERNAL_CALL_SERVICE_IFRAME_FIELD = 'external_call_service_iframe_field';
63+
public const string CALLS_START_WITHOUT_AUDIO = 'calls_start_without_audio';
64+
public const string CALLS_START_WITHOUT_VIDEO = 'calls_start_without_video';
65+
/** @deprecated Kept as fallback for existing installations. */
6366
public const string CALLS_START_WITHOUT_MEDIA = 'calls_start_without_media';
6467
public const string INACTIVITY_LOCK_AFTER_DAYS = 'inactivity_lock_after_days';
6568
public const string INACTIVITY_ENABLE_LOBBY = 'inactivity_enable_lobby';
@@ -872,12 +875,30 @@ public function getGridVideosLimitEnforced(): bool {
872875
* @param ?string $userId
873876
* @return bool
874877
*/
875-
public function getCallsStartWithoutMedia(?string $userId): bool {
878+
public function getCallsStartWithoutAudio(?string $userId): bool {
879+
return $this->getCallsStartWithoutMediaType($userId, self::CALLS_START_WITHOUT_AUDIO);
880+
}
881+
882+
public function getCallsStartWithoutVideo(?string $userId): bool {
883+
return $this->getCallsStartWithoutMediaType($userId, self::CALLS_START_WITHOUT_VIDEO);
884+
}
885+
886+
private function getCallsStartWithoutMediaType(?string $userId, string $key): bool {
876887
if ($userId !== null) {
877-
$userSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_MEDIA);
888+
$userSetting = $this->config->getUserValue($userId, 'spreed', $key);
878889
if ($userSetting === 'yes' || $userSetting === 'no') {
879890
return $userSetting === 'yes';
880891
}
892+
893+
// Legacy setting for backward compatibility
894+
$legacyUserSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_MEDIA);
895+
if ($legacyUserSetting === 'yes' || $legacyUserSetting === 'no') {
896+
return $legacyUserSetting === 'yes';
897+
}
898+
}
899+
900+
if ($this->appConfig->getAppValue($key) !== '') {
901+
return $this->appConfig->getAppValueBool($key);
881902
}
882903

883904
return $this->appConfig->getAppValueBool(self::CALLS_START_WITHOUT_MEDIA);

lib/ConfigLexicon.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public function getAppConfigs(): array {
4949
new Entry(Config::EXTERNAL_CALL_SERVICE_AUTH_PASSWORD, ValueType::STRING, '', definition: 'HTTP Basic Auth password used when Talk calls the external service'),
5050
new Entry(Config::EXTERNAL_CALL_SERVICE_FRAME_ORIGINS, ValueType::ARRAY, [], definition: 'JSON array of scheme+host(+port) origins that may be loaded in the iframe.' . PHP_EOL . 'Added to `Content-Security-Policy: frame-src` and the `Permissions-Policy` for camera/microphone'),
5151
new Entry(Config::EXTERNAL_CALL_SERVICE_IFRAME_FIELD, ValueType::STRING, '', definition: 'JSON field name in the external service response that contains the iframe URL'),
52-
new Entry(Config::CALLS_START_WITHOUT_MEDIA, ValueType::BOOL, false, definition: 'Whether participants start with enabled or disabled audio and video by default'),
52+
new Entry(Config::CALLS_START_WITHOUT_AUDIO, ValueType::BOOL, false, definition: 'Whether participants start with audio disabled by default'),
53+
new Entry(Config::CALLS_START_WITHOUT_VIDEO, ValueType::BOOL, false, definition: 'Whether participants start with video disabled by default'),
5354
new Entry(Config::INACTIVITY_LOCK_AFTER_DAYS, ValueType::INT, 0, definition: 'A duration (in days) after which rooms are locked. Calculated from the last activity in the room,'),
5455
new Entry(Config::INACTIVITY_ENABLE_LOBBY, ValueType::BOOL, false, definition: 'Additionally enable the lobby for inactive rooms so they can only be read by moderators.'),
5556
new Entry(Config::EXPERIMENTS_USERS, ValueType::INT, 0, definition: 'Bit flag of experiments that should be enabled for logged-in users on this server' . PHP_EOL . 'See https://github.com/nextcloud/spreed/blob/main/docs/settings.md#experiments'),

lib/Controller/RoomController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,8 +3373,11 @@ public function getCapabilities(): DataResponse {
33733373
if (isset($data['config']['chat']['typing-privacy'])) {
33743374
$data['config']['chat']['typing-privacy'] = $this->talkConfig->getUserTypingPrivacy($this->userId);
33753375
}
3376-
if (isset($data['config']['call']['start-without-media'])) {
3377-
$data['config']['call']['start-without-media'] = $this->talkConfig->getCallsStartWithoutMedia($this->userId);
3376+
if (isset($data['config']['call']['start-without-audio'])) {
3377+
$data['config']['call']['start-without-audio'] = $this->talkConfig->getCallsStartWithoutAudio($this->userId);
3378+
}
3379+
if (isset($data['config']['call']['start-without-video'])) {
3380+
$data['config']['call']['start-without-video'] = $this->talkConfig->getCallsStartWithoutVideo($this->userId);
33783381
}
33793382
if (isset($data['config']['call']['blur-virtual-background'])) {
33803383
$data['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurVirtualBackground($this->userId);

lib/ResponseDefinitions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,8 @@
792792
* // Whether the user can enable SIP for conversations
793793
* can-enable-sip: bool,
794794
* // Whether calls start without media by default
795-
* start-without-media: bool,
795+
* start-without-audio: bool,
796+
* start-without-video: bool,
796797
* // Maximum duration of a call in seconds, `0` means unlimited
797798
* max-duration: int,
798799
* // Whether the blur virtual background is available

lib/Settings/BeforePreferenceSetEventListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function validatePreference(string $userId, string $key, string|int|null
6060
}
6161

6262
// "boolean" yes/no
63-
if ($key === UserPreference::CALLS_START_WITHOUT_MEDIA
63+
if ($key === UserPreference::CALLS_START_WITHOUT_AUDIO
64+
|| $key === UserPreference::CALLS_START_WITHOUT_VIDEO
65+
|| $key === UserPreference::CALLS_START_WITHOUT_MEDIA
6466
|| $key === UserPreference::PLAY_SOUNDS
6567
|| $key === UserPreference::BLUR_VIRTUAL_BACKGROUND) {
6668
return $value === 'yes' || $value === 'no';

lib/Settings/UserPreference.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
class UserPreference {
1212
public const ATTACHMENT_FOLDER = 'attachment_folder';
1313
public const BLUR_VIRTUAL_BACKGROUND = 'blur_virtual_background';
14+
public const CALLS_START_WITHOUT_AUDIO = 'calls_start_without_audio';
15+
public const CALLS_START_WITHOUT_VIDEO = 'calls_start_without_video';
16+
/** @deprecated Kept as fallback for existing installations. */
1417
public const CALLS_START_WITHOUT_MEDIA = 'calls_start_without_media';
1518
public const CONVERSATIONS_LIST_STYLE = 'conversations_list_style';
1619
public const CHAT_STYLE = 'chat_style';

openapi-administration.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@
174174
"sip-dialout-enabled",
175175
"default-phone-region",
176176
"can-enable-sip",
177-
"start-without-media",
177+
"start-without-audio",
178+
"start-without-video",
178179
"max-duration",
179180
"blur-virtual-background",
180181
"end-to-end-encryption",
@@ -244,9 +245,13 @@
244245
"type": "boolean",
245246
"description": "Whether the user can enable SIP for conversations"
246247
},
247-
"start-without-media": {
248+
"start-without-audio": {
248249
"type": "boolean",
249-
"description": "Whether calls start without media by default"
250+
"description": "Whether calls start without audio by default"
251+
},
252+
"start-without-video": {
253+
"type": "boolean",
254+
"description": "Whether calls start without video by default"
250255
},
251256
"max-duration": {
252257
"type": "integer",

0 commit comments

Comments
 (0)