Skip to content
Merged
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
60 changes: 30 additions & 30 deletions docs/settings.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion lib/BackgroundJob/CheckMatterbridges.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

namespace OCA\Talk\BackgroundJob;

use OCA\Talk\Config;
use OCA\Talk\MatterbridgeManager;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\TimedJob;
Expand All @@ -25,6 +27,7 @@ class CheckMatterbridges extends TimedJob {
public function __construct(
ITimeFactory $time,
private readonly IConfig $serverConfig,
private readonly IAppConfig $appConfig,
private readonly MatterbridgeManager $bridgeManager,
private readonly LoggerInterface $logger,
) {
Expand All @@ -38,7 +41,7 @@ public function __construct(

#[\Override]
protected function run($argument): void {
if ($this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1') {
if ($this->appConfig->getAppValueBool(Config::MATTERBRIDGE_ENABLED)) {
$this->bridgeManager->checkAllBridges();
$this->bridgeManager->killZombieBridges();
$this->logger->info('Checked if Matterbridge instances are running correctly.');
Expand Down
13 changes: 11 additions & 2 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class Config {
public const string ALLOWED_GROUPS_CONVERSATIONS = 'start_conversations';
public const string BREAKOUT_ROOMS_ENABLED = 'breakout_rooms';
public const string CONVERSATION_SUBFOLDERS = 'conversation_subfolders';
public const string CONVERSATIONS_FILES = 'conversations_files';
public const string CONVERSATIONS_FILES_PUBLIC_SHARES = 'conversations_files_public_shares';
public const string DEFAULT_ROOM_PERMISSIONS = 'default_permissions';
public const string DEFAULT_ATTACHMENT_FOLDER = 'default_attachment_folder';
public const string GRID_VIDEOS_LIMIT = 'grid_videos_limit';
Expand All @@ -66,6 +68,13 @@ class Config {
public const string EXPERIMENTS_USERS = 'experiments_users';
public const string EXPERIMENTS_GUESTS = 'experiments_guests';
public const string CALL_END_TO_END_ENCRYPTION = 'call_end_to_end_encryption';
public const string FORCE_PASSWORDS = 'force_passwords';
public const string BACKGROUNDS_BRANDED_FOR_GUESTS = 'backgrounds_branded_for_guests';
public const string BACKGROUNDS_DEFAULT_FOR_USERS = 'backgrounds_default_for_useres';
public const string BACKGROUNDS_UPLOAD_USERS = 'backgrounds_upload_users';
public const string CREATE_SAMPLES = 'create_samples';
public const string MATTERBRIDGE_ENABLED = 'enable_matterbridge';
public const string DELETE_ONE_TO_ONE_CONVERSATIONS = 'delete_one_to_one_conversations';

/**
* 1. Call recording, …
Expand Down Expand Up @@ -1019,7 +1028,7 @@ public function hasExperiment(int $experiment): bool {
}

public function isPasswordEnforced(): bool {
return $this->appConfig->getAppValueBool('force_passwords');
return $this->appConfig->getAppValueBool(self::FORCE_PASSWORDS);
}

public function isCallEndToEndEncryptionEnabled(): bool {
Expand All @@ -1039,6 +1048,6 @@ public function getPlaySoundsForUser(?IUser $user): bool {
}

public function getPlaySoundsDefaultForGuests(): bool {
return $this->appConfig->getAppValueBool('guests_play_sounds', true);
return $this->appConfig->getAppValueBool(self::GUESTS_PLAY_SOUNDS);
}
}
11 changes: 10 additions & 1 deletion lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function getAppConfigs(): array {
new Entry(Config::ALLOWED_GROUPS_CONVERSATIONS, ValueType::ARRAY, [], definition: 'List of group ids that are allowed to create conversation'),
new Entry(Config::BREAKOUT_ROOMS_ENABLED, ValueType::BOOL, true, definition: 'Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.'),
new Entry(Config::CONVERSATION_SUBFOLDERS, ValueType::BOOL, true, definition: ''),
new Entry(Config::CONVERSATIONS_FILES, ValueType::BOOL, true, definition: 'Whether the files app integration is enabled allowing tostart conversations in the right sidebar'),
new Entry(Config::CONVERSATIONS_FILES_PUBLIC_SHARES, ValueType::BOOL, true, definition: 'Whether the public share integration is enabled allowing to start conversations in the right sidebar on the public share page (Requires `conversations_files` also to be enabled'),
new Entry(Config::DEFAULT_ROOM_PERMISSIONS, ValueType::INT, 246, definition: 'Default permissions for non-moderators' . PHP_EOL . '(see https://github.com/nextcloud/spreed/blob/main/docs/constants.md#attendee-permissions for bit flags)'),
new Entry(Config::DEFAULT_ATTACHMENT_FOLDER, ValueType::STRING, '/Talk', definition: 'Specify default attachment folder location'),
new Entry(Config::GRID_VIDEOS_LIMIT, ValueType::INT, 19 /* 5*4 - self */, definition: 'Maximum number of videos to show (additional to the own video)'),
Expand All @@ -50,11 +52,18 @@ public function getAppConfigs(): array {
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::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_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'),
new Entry(Config::EXPERIMENTS_GUESTS, ValueType::INT, 0, definition: 'Bit flag of experiments that should be enabled for guests on this server' . PHP_EOL . 'See https://github.com/nextcloud/spreed/blob/main/docs/settings.md#experiments'),
new Entry(Config::CALL_END_TO_END_ENCRYPTION, ValueType::BOOL, false, definition: 'Whether clients should end-to-end encrypt streams in calls (Only supported with High-performance backend'),
new Entry(Config::FORCE_PASSWORDS, ValueType::BOOL, false, definition: 'Whether public chats are forced to use a password'),
new Entry(Config::BACKGROUNDS_BRANDED_FOR_GUESTS, ValueType::BOOL, false, definition: 'Whether guests are allowed to use the virtual backgrounds provided via `themes/talk-backgrounds/`'),
new Entry(Config::BACKGROUNDS_DEFAULT_FOR_USERS, ValueType::BOOL, definition: 'Whether users are allowed to use the default virutal backgrounds provided by the releases'),
new Entry(Config::BACKGROUNDS_UPLOAD_USERS, ValueType::BOOL, definition: 'Whether users are allowed to upload custom virtual backgrounds and choose from their Nextcloud Files'),
new Entry(Config::CREATE_SAMPLES, ValueType::BOOL, true, definition: 'Create sample conversations (the content can be overwritten by providing files in a provided `samples_directory` app config)'),
new Entry(Config::MATTERBRIDGE_ENABLED, ValueType::BOOL, false, definition: 'Whether the Matterbridge integration is enabled and can be configured'),
new Entry(Config::DELETE_ONE_TO_ONE_CONVERSATIONS, ValueType::BOOL, false, definition: 'Whether one-to-one conversations can be left by either participant or should be deleted when one participant leaves'),
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ public function clearHistory(): DataResponse {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
}

if (!$this->appConfig->getAppValueBool('delete_one_to_one_conversations')
if (!$this->appConfig->getAppValueBool(Config::DELETE_ONE_TO_ONE_CONVERSATIONS)
&& ($this->room->getType() === Room::TYPE_ONE_TO_ONE
|| $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER)) {
// Not allowed to purge one-to-one conversations
Expand Down
9 changes: 6 additions & 3 deletions lib/Controller/FilesIntegrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace OCA\Talk\Controller;

use OCA\Talk\Config;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Files\Util;
use OCA\Talk\Manager;
Expand All @@ -24,6 +25,7 @@
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Files\FileInfo;
use OCP\Files\NotFoundException;
use OCP\IConfig;
Expand All @@ -48,6 +50,7 @@ public function __construct(
private readonly TalkSession $talkSession,
private readonly Util $util,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
private readonly IL10N $l,
) {
parent::__construct($appName, $request);
Expand Down Expand Up @@ -89,7 +92,7 @@ public function __construct(
'fileId' => '.+',
])]
public function getRoomByFileId(string $fileId): DataResponse {
if ($this->config->getAppValue('spreed', 'conversations_files', '1') !== '1') {
if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES)) {
return new DataResponse(null, Http::STATUS_BAD_REQUEST);
}

Expand Down Expand Up @@ -167,8 +170,8 @@ public function getRoomByFileId(string $fileId): DataResponse {
'shareToken' => '.+',
])]
public function getRoomByShareToken(string $shareToken): DataResponse {
if ($this->config->getAppValue('spreed', 'conversations_files', '1') !== '1'
|| $this->config->getAppValue('spreed', 'conversations_files_public_shares', '1') !== '1') {
if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES)
|| !$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES)) {
return new DataResponse(null, Http::STATUS_BAD_REQUEST);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ protected function getTalkHashHeader(): array {
$this->appConfig->getAppValueInt(Config::DEFAULT_ROOM_PERMISSIONS),
$this->appConfig->getAppValueBool(Config::BREAKOUT_ROOMS_ENABLED),
$this->config->getAppValue('spreed', 'federation_enabled'),
$this->config->getAppValue('spreed', 'enable_matterbridge'),
json_encode($this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_SIP)),
$this->appConfig->getAppValueBool(Config::MATTERBRIDGE_ENABLED),
$this->config->getAppValue('spreed', 'sip_bridge_dialin_info'),
$this->config->getAppValue('spreed', 'sip_bridge_shared_secret'),
$this->config->getAppValue('spreed', 'recording_consent'),
Expand Down Expand Up @@ -1132,7 +1132,7 @@ public function deleteRoom(): DataResponse {
return new DataResponse(['error' => 'preserved'], Http::STATUS_FORBIDDEN);
}

if (!$this->appConfig->getAppValueBool('delete_one_to_one_conversations')
if (!$this->appConfig->getAppValueBool(Config::DELETE_ONE_TO_ONE_CONVERSATIONS)
&& in_array($this->room->getType(), [Room::TYPE_ONE_TO_ONE, Room::TYPE_ONE_TO_ONE_FORMER], true)) {
return new DataResponse(null, Http::STATUS_BAD_REQUEST);
}
Expand Down Expand Up @@ -1734,7 +1734,7 @@ protected function removeSelfFromRoomLogic(Room $room, Participant $participant)
return new DataResponse(null);
}

if ($this->appConfig->getAppValueBool('delete_one_to_one_conversations')
if ($this->appConfig->getAppValueBool(Config::DELETE_ONE_TO_ONE_CONVERSATIONS)
&& in_array($this->room->getType(), [Room::TYPE_ONE_TO_ONE, Room::TYPE_ONE_TO_ONE_FORMER], true)) {
$this->roomService->deleteRoom($room);
return new DataResponse(null);
Expand Down
4 changes: 3 additions & 1 deletion lib/Files/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use OCA\Files\Event\LoadSidebar;
use OCA\Talk\AppInfo\Application;
use OCA\Talk\Config;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
Expand All @@ -30,6 +31,7 @@ public function __construct(
private readonly IInitialState $initialState,
private readonly Config $talkConfig,
private readonly IConfig $serverConfig,
private readonly IAppConfig $appConfig,
private readonly IUserSession $userSession,
private readonly IRequest $request,
) {
Expand All @@ -49,7 +51,7 @@ public function handle(Event $event): void {
return;
}

if ($this->serverConfig->getAppValue('spreed', 'conversations_files', '1') !== '1') {
if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES)) {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/PublicShare/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
use OCA\Talk\AppInfo\Application;
use OCA\Talk\Config;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
Expand All @@ -31,6 +32,7 @@ public function __construct(
private readonly IInitialState $initialState,
private readonly Config $talkConfig,
private readonly IConfig $serverConfig,
private readonly IAppConfig $appConfig,
) {
}

Expand All @@ -49,8 +51,8 @@ public function handle(Event $event): void {
return;
}

if ($this->serverConfig->getAppValue('spreed', 'conversations_files', '1') !== '1'
|| $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1') !== '1') {
if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES)
|| !$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Service/SampleConversationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\ReactionManager;
use OCA\Talk\Config;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Room;
use OCP\AppFramework\Services\IAppConfig;
Expand Down Expand Up @@ -44,7 +45,7 @@ public function __construct(
}

public function initialCreateSamples(string $userId): void {
if (!$this->appConfig->getAppValueBool('create_samples', true)) {
if (!$this->appConfig->getAppValueBool(Config::CREATE_SAMPLES, true)) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public function getForm(): TemplateResponse {

protected function initGeneralSettings(): void {
$this->initialState->provideInitialState('default_group_notification', (int)$this->serverConfig->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_ALWAYS));
$this->initialState->provideInitialState('conversations_files', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files', '1'));
$this->initialState->provideInitialState('conversations_files_public_shares', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1'));
$this->initialState->provideInitialState(Config::CONVERSATIONS_FILES, (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES));
$this->initialState->provideInitialState(Config::CONVERSATIONS_FILES_PUBLIC_SHARES, (int)$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES));
$this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration());
}

Expand Down Expand Up @@ -117,7 +117,7 @@ protected function initMatterbridge(): void {

$this->initialState->provideInitialState(
'matterbridge_enable',
$this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1'
$this->appConfig->getAppValueBool(Config::MATTERBRIDGE_ENABLED)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/chat-1/delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,5 @@ Feature: chat-1/delete
And user "participant1" sends message "Message" to room "room" with 201
Then user "participant1" deletes chat history for room "room" with 403
When the following "spreed" app config is set
| delete_one_to_one_conversations | 1 |
| delete_one_to_one_conversations | true |
Then user "participant1" deletes chat history for room "room" with 200
4 changes: 2 additions & 2 deletions tests/integration/features/conversation-3/one-to-one.feature
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Feature: conversation-3/one-to-one
| roomType | 1 |
| invite | participant2 |
And the following "spreed" app config is set
| delete_one_to_one_conversations | 1 |
| delete_one_to_one_conversations | true |
Then user "participant1" removes themselves from room "room" with 200 (v4)
And user "participant1" is participant of the following rooms (v4)
And user "participant2" is participant of the following rooms (v4)
Expand All @@ -248,7 +248,7 @@ Feature: conversation-3/one-to-one
And user "participant1" sends message "Message" to room "room" with 201
Then user "participant1" deletes room "room" with 400 (v4)
When the following "spreed" app config is set
| delete_one_to_one_conversations | 1 |
| delete_one_to_one_conversations | true |
Then user "participant1" deletes room "room" with 200 (v4)
And user "participant1" is participant of the following rooms (v4)
And user "participant2" is participant of the following rooms (v4)
Loading