Skip to content
Open
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
3 changes: 2 additions & 1 deletion lib/BackgroundJob/CheckCertificates.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use OCA\Talk\AppInfo\Application;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCA\Talk\Service\CertificateService;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -93,7 +94,7 @@ private function checkServerCertificate(string $host): void {
return;
}

$expirationWarningLimit = $this->appConfig->getAppValueInt(Config::CERTIFICATE_EXPIRATION_DAYS);
$expirationWarningLimit = $this->appConfig->getAppValueInt(ConfigLexicon::CERTIFICATE_EXPIRATION_DAYS);
$expirationWarningLimit = min(365, max(0, $expirationWarningLimit));
if ($expirationInDays < $expirationWarningLimit) {
$this->logger->warning('Certificate of ' . $host . ' expires in less than ' . $expirationInDays . ' days');
Expand Down
9 changes: 5 additions & 4 deletions lib/BackgroundJob/CheckHostedSignalingServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace OCA\Talk\BackgroundJob;

use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCA\Talk\DataObjects\AccountId;
use OCA\Talk\Exceptions\HostedSignalingServerAPIException;
use OCA\Talk\Service\HostedSignalingServerService;
Expand Down Expand Up @@ -73,11 +74,11 @@ private function updateStunTurnSettings(array $oldAccountInfo, array $accountInf
if (!empty($accountInfo['stun']['servers'])) {
if ($this->talkConfig->getStunServers() !== $accountInfo['stun']['servers']) {
// STUN servers were added / changed
$this->appConfig->setAppValueArray(Config::STUN_SERVERS, $accountInfo['stun']['servers']);
$this->appConfig->setAppValueArray(ConfigLexicon::STUN_SERVERS, $accountInfo['stun']['servers']);
}
} elseif (!empty($oldAccountInfo['stun']['servers'])) {
// STUN servers are no longer available, reset to default.
$this->appConfig->deleteAppValue(Config::STUN_SERVERS);
$this->appConfig->deleteAppValue(ConfigLexicon::STUN_SERVERS);
}

if (!empty($accountInfo['turn']['servers'])) {
Expand All @@ -93,11 +94,11 @@ private function updateStunTurnSettings(array $oldAccountInfo, array $accountInf

if ($this->talkConfig->getTurnServers() !== $newTurnServers) {
// TURN servers were added / changed
$this->appConfig->setAppValueArray(Config::TURN_SERVERS, $newTurnServers);
$this->appConfig->setAppValueArray(ConfigLexicon::TURN_SERVERS, $newTurnServers);
}
} elseif (!empty($oldAccountInfo['turn']['servers'])) {
// TURN servers are no longer available, reset to default.
$this->appConfig->deleteAppValue(Config::TURN_SERVERS);
$this->appConfig->deleteAppValue(ConfigLexicon::TURN_SERVERS);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/BackgroundJob/CheckMatterbridges.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace OCA\Talk\BackgroundJob;

use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCA\Talk\MatterbridgeManager;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -41,7 +41,7 @@ public function __construct(

#[\Override]
protected function run($argument): void {
if ($this->appConfig->getAppValueBool(Config::MATTERBRIDGE_ENABLED)) {
if ($this->appConfig->getAppValueBool(ConfigLexicon::MATTERBRIDGE_ENABLED)) {
$this->bridgeManager->checkAllBridges();
$this->bridgeManager->killZombieBridges();
$this->logger->info('Checked if Matterbridge instances are running correctly.');
Expand Down
4 changes: 2 additions & 2 deletions lib/BackgroundJob/ExpireObjectRooms.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace OCA\Talk\BackgroundJob;

use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCA\Talk\Manager;
use OCA\Talk\Room;
use OCA\Talk\Service\RoomService;
Expand Down Expand Up @@ -52,7 +52,7 @@ protected function run($argument): void {
// Classified conversations are deleted shortly (default 1 hour) after a
// call happened, unless a moderator kept them (object_type is then
// "classified_persist" and no longer matched here).
$classifiedRetention = $this->appConfig->getAppValueInt(Config::RETENTION_CLASSIFIED_ROOMS);
$classifiedRetention = $this->appConfig->getAppValueInt(ConfigLexicon::RETENTION_CLASSIFIED_ROOMS);
if ($classifiedRetention !== 0) {
$this->executeRetention(Room::OBJECT_TYPE_CLASSIFIED, $classifiedRetention);
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function getCapabilities(): array {
'has-translation-providers' => $this->translationManager->hasProviders(),
'has-translation-task-providers' => false,
'typing-privacy' => Participant::PRIVACY_PUBLIC,
'summary-threshold' => max(1, $this->appConfig->getAppValueInt(Config::SUMMARY_THRESHOLD)),
'summary-threshold' => max(1, $this->appConfig->getAppValueInt(ConfigLexicon::SUMMARY_THRESHOLD)),
'style' => $this->talkConfig->getChatStyle($user?->getUID()),
'matterbridge-enabled' => $user instanceof IUser && $this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1',
],
Expand All @@ -320,7 +320,7 @@ public function getCapabilities(): array {
'retention-event' => max(0, $this->appConfig->getAppValueInt('retention_event_rooms', 28)),
'retention-phone' => max(0, $this->appConfig->getAppValueInt('retention_phone_rooms', 7)),
'retention-instant-meetings' => max(0, $this->appConfig->getAppValueInt('retention_instant_meetings', 1)),
'retention-classified' => max(0, $this->appConfig->getAppValueInt(Config::RETENTION_CLASSIFIED_ROOMS)),
'retention-classified' => max(0, $this->appConfig->getAppValueInt(ConfigLexicon::RETENTION_CLASSIFIED_ROOMS)),
],
'federation' => [
'enabled' => false,
Expand All @@ -329,18 +329,18 @@ public function getCapabilities(): array {
'only-trusted-servers' => true,
],
'previews' => [
'max-gif-size' => $this->appConfig->getAppValueInt(Config::MAX_GIF_SIZE, 3145728),
'max-gif-size' => $this->appConfig->getAppValueInt(ConfigLexicon::MAX_GIF_SIZE, 3145728),
],
'signaling' => [
'session-ping-limit' => max(0, (int)$this->serverConfig->getAppValue('spreed', 'session-ping-limit', '200')),
'mode' => $this->talkConfig->getSignalingMode(),
// 'hello-v2-token-key' => string,
],
'experiments' => [
'enabled' => max(0, $this->appConfig->getAppValueInt($user instanceof IUser ? Config::EXPERIMENTS_USERS : Config::EXPERIMENTS_GUESTS)),
'enabled' => max(0, $this->appConfig->getAppValueInt($user instanceof IUser ? ConfigLexicon::EXPERIMENTS_USERS : ConfigLexicon::EXPERIMENTS_GUESTS)),
],
'feature-hints' => [
'current' => Config::FEATURE_HINT,
'current' => ConfigLexicon::FEATURE_HINT,
'hidden' => max(0, $this->appConfig->getAppValueInt('feature_hints_hidden')),
],
'permissions' => [
Expand Down Expand Up @@ -421,7 +421,7 @@ public function getCapabilities(): array {
$capabilities['config']['chat']['has-translation-task-providers'] = true;
}

if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_EXTERNAL) {
if ($this->talkConfig->getSignalingMode() === ConfigLexicon::SIGNALING_EXTERNAL) {
$capabilities['features'][] = 'call-end-to-end-encryption';
}

Expand All @@ -447,7 +447,7 @@ public function getCapabilities(): array {
}

protected function isLiveTranscriptionSupported(): bool {
return $this->talkConfig->getSignalingMode() === Config::SIGNALING_EXTERNAL
return $this->talkConfig->getSignalingMode() === ConfigLexicon::SIGNALING_EXTERNAL
&& $this->liveTranscriptionService->isLiveTranscriptionAppEnabled();
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Command/Stun/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Stun;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

$servers = $this->appConfig->getAppValueArray(Config::STUN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::STUN_SERVERS);

// check if the server is already in the list
foreach ($servers as $existingServer) {
Expand All @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$servers[] = "$host:$port";

$this->appConfig->setAppValueArray(Config::STUN_SERVERS, $servers);
$this->appConfig->setAppValueArray(ConfigLexicon::STUN_SERVERS, $servers);
$output->writeln('<info>Added ' . "$host:$port" . '.</info>');
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Command/Stun/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Stun;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -38,19 +38,19 @@ protected function configure(): void {
protected function execute(InputInterface $input, OutputInterface $output): int {
$server = $input->getArgument('server');

$servers = $this->appConfig->getAppValueArray(Config::STUN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::STUN_SERVERS);

$count = count($servers);
// remove all occurrences of $server
$servers = array_filter($servers, fn ($s) => $s !== $server);
$servers = array_values($servers); // reindex

if (empty($servers)) {
$servers = [Config::DEFAULT_STUN_SERVER];
$this->appConfig->setAppValueArray(Config::STUN_SERVERS, $servers);
$servers = [ConfigLexicon::DEFAULT_STUN_SERVER];
$this->appConfig->setAppValueArray(ConfigLexicon::STUN_SERVERS, $servers);
$output->writeln('<info>You deleted all STUN servers. A default STUN server was added.</info>');
} else {
$this->appConfig->setAppValueArray(Config::STUN_SERVERS, $servers);
$this->appConfig->setAppValueArray(ConfigLexicon::STUN_SERVERS, $servers);
if ($count > count($servers)) {
$output->writeln('<info>Deleted ' . $server . '.</info>');
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/Command/Stun/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Stun;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -32,7 +32,7 @@ protected function configure(): void {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
$servers = $this->appConfig->getAppValueArray(Config::STUN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::STUN_SERVERS);
$this->writeArrayInOutputFormat($input, $output, $servers);
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Command/Turn/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Turn;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Security\ISecureRandom;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$server = substr($server, 7);
}

$servers = $this->appConfig->getAppValueArray(Config::TURN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::TURN_SERVERS);

//Checking if the server is already added
foreach ($servers as $existingServer) {
Expand All @@ -116,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'protocols' => $protocols,
];

$this->appConfig->setAppValueArray(Config::TURN_SERVERS, $servers);
$this->appConfig->setAppValueArray(ConfigLexicon::TURN_SERVERS, $servers);
$output->writeln('<info>Added ' . $server . '.</info>');
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Command/Turn/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Turn;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -48,14 +48,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$server = $input->getArgument('server');
$protocols = $input->getArgument('protocols');

$servers = $this->appConfig->getAppValueArray(Config::TURN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::TURN_SERVERS);

$count = count($servers);
// remove all occurrences which match $schemes, $server and $protocols
$servers = array_filter($servers, fn ($s) => $s['schemes'] !== $schemes || $s['server'] !== $server || $s['protocols'] !== $protocols);
$servers = array_values($servers); // reindex

$this->appConfig->setAppValueArray(Config::TURN_SERVERS, $servers);
$this->appConfig->setAppValueArray(ConfigLexicon::TURN_SERVERS, $servers);
if ($count > count($servers)) {
$output->writeln('<info>Deleted ' . $server . '.</info>');
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/Command/Turn/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace OCA\Talk\Command\Turn;

use OC\Core\Command\Base;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCP\AppFramework\Services\IAppConfig;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -32,7 +32,7 @@ protected function configure(): void {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
$servers = $this->appConfig->getAppValueArray(Config::TURN_SERVERS);
$servers = $this->appConfig->getAppValueArray(ConfigLexicon::TURN_SERVERS);
$this->writeMixedInOutputFormat($input, $output, $servers);
return 0;
}
Expand Down
Loading
Loading