Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
* `chat-summary-api` (local) - Whether the endpoint to get summarized chat messages in a conversation is available
* `email-csv-import` - Whether the endpoint to import a CSV email list as participants exists
* `config => chat => summary-threshold` (local) - Number of unread messages that should exist to show a "Generate summary" option
* `config => call => start-without-media` (local) - Boolean, whether media should be disabled when starting or joining a conversation
* `config => call => start-without-media` (local, deprecated) - Boolean, whether media should be disabled when starting or joining a conversation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mention what should be checked instead

* `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.
* `config => call => blur-virtual-background` (local) - Boolean, whether blur background is set by default when joining a conversation

Expand Down Expand Up @@ -237,3 +237,5 @@
* `config => call => external-call-service` (local) - The target URL for an external call service if one is configured
* `bot-features-api` (local) - Whether bots can fetch their own enabled features using their shared secret
* `promote-demote-owner` - Whether owners can promote other participants to owner and demote other owners again, by sending the `participantType` parameter when promoting or demoting a participant
* `config => call => start-without-audio` (local) - Boolean, whether audio should be disabled when starting or joining a conversation
* `config => call => start-without-video` (local) - Boolean, whether video should be disabled when starting or joining a conversation
8 changes: 5 additions & 3 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## User settings

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

| Key | Capability | Default | Valid values |
Expand All @@ -30,7 +30,8 @@ Instead, the server API `POST /ocs/v2.php/apps/provisioning_api/api/v1/config/us
| `read_status_privacy` | `config => chat => read-privacy` | `0` | One of the read-status constants from the [constants list](constants.md#participant-read-status-privacy) |
| `typing_privacy` | `config => chat => typing-privacy` | `0` | One of the typing privacy constants from the [constants list](constants.md#participant-typing-privacy) |
| `play_sounds` | | `'yes'` | `'yes'` and `'no'` |
| `calls_start_without_media` | `config => call => start-without-media` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
| `calls_start_without_audio` | `config => call => start-without-audio` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
| `calls_start_without_video` | `config => call => start-without-video` | `''` falling back to app config with the same name | `'yes'` and `'no'` |
| `blur_virtual_background` | `config => call => blur-virtual-background` | `'no'` | `'yes'` and `'no'` |
| `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) |
| `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) |
Expand Down Expand Up @@ -117,7 +118,8 @@ Legend:
| `hide_signaling_warning` | string<br>`yes` or `no` | `no` | No | 🖌️ | Flag that allows to suppress the warning that an HPB should be configured |
| `conversations_list_style` | string<br>`two-lines` or `compact` | `two-lines` | No | | Default conversation list style when not overwritten by the user |
| `chat_style` | string<br>`split` or `unified` | `split` | No | | Default chat style when not overwritten by the user |
| `calls_start_without_media` | bool | `false` | No | | Whether participants start with enabled or disabled audio and video by default |
| `calls_start_without_audio` | bool | `false` | No | | Whether participants start with audio disabled by default |
| `calls_start_without_video` | bool | `false` | No | | Whether participants start with video disabled by default |
| `breakout_rooms` | bool | `true` | Yes | | Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.) |
| `call_recording` | string<br>`yes` or `no` | `yes` | Yes | | Enable call recording |
| `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. |
Expand Down
4 changes: 4 additions & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class Capabilities implements IPublicCapability {
'predefined-backgrounds-v2',
'can-upload-background',
'start-without-media',
'start-without-audio',
'start-without-video',
'blur-virtual-background',
'live-transcription-target-language-id',
'play-sounds',
Expand Down Expand Up @@ -291,6 +293,8 @@ public function getCapabilities(): array {
'default-phone-region' => $this->serverConfig->getSystemValueString('default_phone_region'),
'can-enable-sip' => false,
'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()),
'start-without-audio' => $this->talkConfig->getCallsStartWithoutAudio($user?->getUID()),
'start-without-video' => $this->talkConfig->getCallsStartWithoutVideo($user?->getUID()),
'max-duration' => $this->appConfig->getAppValueInt('max_call_duration'),
'blur-virtual-background' => $this->talkConfig->getBlurVirtualBackground($user?->getUID()),
'end-to-end-encryption' => $this->talkConfig->isCallEndToEndEncryptionEnabled(),
Expand Down
57 changes: 57 additions & 0 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class Config {
public const string EXTERNAL_CALL_SERVICE_AUTH_USER = 'external_call_service_auth_user';
public const string EXTERNAL_CALL_SERVICE_AUTH_PASSWORD = 'external_call_service_auth_password';
public const string EXTERNAL_CALL_SERVICE_IFRAME_FIELD = 'external_call_service_iframe_field';
public const string CALLS_START_WITHOUT_AUDIO = 'calls_start_without_audio';
public const string CALLS_START_WITHOUT_VIDEO = 'calls_start_without_video';
/** @deprecated Kept as fallback for existing installations. */
public const string CALLS_START_WITHOUT_MEDIA = 'calls_start_without_media';
public const string INACTIVITY_LOCK_AFTER_DAYS = 'inactivity_lock_after_days';
public const string INACTIVITY_ENABLE_LOBBY = 'inactivity_enable_lobby';
Expand Down Expand Up @@ -872,14 +875,68 @@ public function getGridVideosLimitEnforced(): bool {
* @param ?string $userId
* @return bool
*/
public function getCallsStartWithoutAudio(?string $userId): bool {
return $this->getCallsStartWithoutMediaType($userId, self::CALLS_START_WITHOUT_AUDIO);
}

public function getCallsStartWithoutVideo(?string $userId): bool {
return $this->getCallsStartWithoutMediaType($userId, self::CALLS_START_WITHOUT_VIDEO);
}

/** @deprecated Use getCallsStartWithoutAudio() and getCallsStartWithoutVideo(). */
public function getCallsStartWithoutMedia(?string $userId): bool {
if ($userId !== null) {
$userSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_MEDIA);
if ($userSetting === 'yes' || $userSetting === 'no') {
return $userSetting === 'yes';
}

// If the legacy setting is not set, check the new settings for audio and video separately.
$audioSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_AUDIO);
$videoSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_VIDEO);
if ($audioSetting === 'yes' || $videoSetting === 'yes') {
return true;
}
if ($audioSetting === 'no' && $videoSetting === 'no') {
return false;
}
}

$legacyAppSetting = $this->appConfig->getAppValue(self::CALLS_START_WITHOUT_MEDIA);
if ($legacyAppSetting !== '') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use hasAppKey instead, then you can still use getAppValueBool?

return $legacyAppSetting === 'yes' || $legacyAppSetting === '1';
}

// If the legacy setting is not set, check the new settings for audio and video separately.
$audioAppSetting = $this->appConfig->getAppValue(self::CALLS_START_WITHOUT_AUDIO);
$videoAppSetting = $this->appConfig->getAppValue(self::CALLS_START_WITHOUT_VIDEO);
if ($audioAppSetting !== '' || $videoAppSetting !== '') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

return $audioAppSetting === 'yes' || $audioAppSetting === '1'
|| $videoAppSetting === 'yes' || $videoAppSetting === '1';
}

return false;
}

private function getCallsStartWithoutMediaType(?string $userId, string $key): bool {
if ($userId !== null) {
$userSetting = $this->config->getUserValue($userId, 'spreed', $key);
if ($userSetting === 'yes' || $userSetting === 'no') {
return $userSetting === 'yes';
}

// If the new setting is not set, check the legacy setting.
$legacyUserSetting = $this->config->getUserValue($userId, 'spreed', UserPreference::CALLS_START_WITHOUT_MEDIA);
if ($legacyUserSetting === 'yes' || $legacyUserSetting === 'no') {
return $legacyUserSetting === 'yes';
}
}

if ($this->appConfig->getAppValue($key) !== '') {
return $this->appConfig->getAppValueBool($key);
}

// If the new setting is not set, check the legacy setting.
return $this->appConfig->getAppValueBool(self::CALLS_START_WITHOUT_MEDIA);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function getAppConfigs(): array {
new Entry(Config::EXTERNAL_CALL_SERVICE_AUTH_PASSWORD, ValueType::STRING, '', definition: 'HTTP Basic Auth password used when Talk calls the external service'),
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'),
new Entry(Config::EXTERNAL_CALL_SERVICE_IFRAME_FIELD, ValueType::STRING, '', definition: 'JSON field name in the external service response that contains the iframe URL'),
new Entry(Config::CALLS_START_WITHOUT_MEDIA, ValueType::BOOL, false, definition: 'Whether participants start with enabled or disabled audio and video by default'),
new Entry(Config::CALLS_START_WITHOUT_MEDIA, ValueType::BOOL, false, definition: 'Deprecated: whether participants start with audio and video disabled by default', deprecated: true),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mention what to check instead

new Entry(Config::CALLS_START_WITHOUT_AUDIO, ValueType::BOOL, false, definition: 'Whether participants start with audio disabled by default'),
new Entry(Config::CALLS_START_WITHOUT_VIDEO, ValueType::BOOL, false, definition: 'Whether participants start with video disabled by default'),
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,'),
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.'),
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'),
Expand Down
6 changes: 6 additions & 0 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3373,9 +3373,15 @@ public function getCapabilities(): DataResponse {
if (isset($data['config']['chat']['typing-privacy'])) {
$data['config']['chat']['typing-privacy'] = $this->talkConfig->getUserTypingPrivacy($this->userId);
}
if (isset($data['config']['call']['start-without-audio'])) {
$data['config']['call']['start-without-audio'] = $this->talkConfig->getCallsStartWithoutAudio($this->userId);
}
if (isset($data['config']['call']['start-without-media'])) {
$data['config']['call']['start-without-media'] = $this->talkConfig->getCallsStartWithoutMedia($this->userId);
}
if (isset($data['config']['call']['start-without-video'])) {
$data['config']['call']['start-without-video'] = $this->talkConfig->getCallsStartWithoutVideo($this->userId);
}
if (isset($data['config']['call']['blur-virtual-background'])) {
$data['config']['call']['blur-virtual-background'] = $this->talkConfig->getBlurVirtualBackground($this->userId);
}
Expand Down
1 change: 1 addition & 0 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function setUserSetting(string $key, string|int|null $value): DataRespons
}

$this->config->setUserValue($this->userId, 'spreed', $key, $value);
$this->preferenceListener->synchronizeMediaPreferences($this->userId, $key, (string)$value);

return new DataResponse(null);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,8 @@
* can-enable-sip: bool,
* // Whether calls start without media by default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mention the deprecation and what to check instead

* start-without-media: bool,
* start-without-audio: bool,
* start-without-video: bool,
Comment on lines +796 to +797

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both should have docs.

* // Maximum duration of a call in seconds, `0` means unlimited
* max-duration: int,
* // Whether the blur virtual background is available
Expand Down
Loading