fix(capabilities): Mark federation and signaling capabilities as local

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2024-05-10 12:08:24 +02:00
parent bf240be8cf
commit fb8a73c011
No known key found for this signature in database
GPG key ID: 74434EFE0D2E2205
3 changed files with 25 additions and 13 deletions

View file

@ -101,8 +101,8 @@
* `silent-call` - Allow to start calls without sending notification
* `talk-polls` - Polls feature is available to use in the chat
* `config => call => enabled` - Whether calling is enabled on the instance or not
* `config => signaling => session-ping-limit` - Number of sessions the HPB is allowed to ping in the same request
* `config => signaling => hello-v2-token-key` - Public key to use when verifying JWT auth tokens for hello V2.
* `config => signaling => session-ping-limit` (local) - Number of sessions the HPB is allowed to ping in the same request
* `config => signaling => hello-v2-token-key` (local) - Public key to use when verifying JWT auth tokens for hello V2.
## 16
* `breakout-rooms-v1` - Whether breakout-rooms API v1 is available
@ -145,10 +145,10 @@
* `silent-send-state` - Whether messages contain a flag that they were sent silently
* `chat-read-last` - Whether chat can be marked read without giving a message ID (will fall back to the conversations last message ID)
* `federation-v1` - Whether basic chatting is possible with federation
* `config => federation => enabled` - Boolean, whether federation is enabled on instance
* `config => federation => incoming-enabled` - Boolean, whether users are allowed to be invited into federated conversations on other servers
* `config => federation => outgoing-enabled` - Boolean, whether users are allowed to invited federated users of other servers into conversations
* `config => federation => only-trusted-servers` - Boolean, whether federation invites are limited to trusted servers
* `config => federation => enabled` (local) - Boolean, whether federation is enabled on instance
* `config => federation => incoming-enabled` (local) - Boolean, whether users are allowed to be invited into federated conversations on other servers
* `config => federation => outgoing-enabled` (local) - Boolean, whether users are allowed to invited federated users of other servers into conversations
* `config => federation => only-trusted-servers` (local) - Boolean, whether federation invites are limited to trusted servers
## 20
* `ban-v1` - Whether the API to ban attendees is available

View file

@ -130,9 +130,19 @@ class Capabilities implements IPublicCapability {
'conversations' => [
'can-create',
],
'federation' => [
'enabled',
'incoming-enabled',
'outgoing-enabled',
'only-trusted-servers',
],
'previews' => [
'max-gif-size',
],
'signaling' => [
'session-ping-limit',
'hello-v2-token-key',
],
];
protected ICache $talkCache;
@ -167,6 +177,7 @@ class Capabilities implements IPublicCapability {
'config' => [
'attachments' => [
'allowed' => $user instanceof IUser,
// 'folder' => string,
],
'call' => [
'enabled' => ((int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE,
@ -174,8 +185,11 @@ class Capabilities implements IPublicCapability {
'recording' => $this->talkConfig->isRecordingEnabled(),
'recording-consent' => $this->talkConfig->recordingConsentRequired(),
'supported-reactions' => ['❤️', '🎉', '👏', '👍', '👎', '😂', '🤩', '🤔', '😲', '😥'],
// 'predefined-backgrounds' => list<string>,
'can-upload-background' => false,
'sip-enabled' => $this->talkConfig->isSIPConfigured(),
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
'can-enable-sip' => false,
],
'chat' => [
'max-length' => ChatManager::MAX_CHAT_LENGTH,
@ -197,6 +211,7 @@ class Capabilities implements IPublicCapability {
],
'signaling' => [
'session-ping-limit' => max(0, (int)$this->serverConfig->getAppValue('spreed', 'session-ping-limit', '200')),
// 'hello-v2-token-key' => string,
],
],
'config-local' => self::LOCAL_CONFIGS,
@ -277,9 +292,6 @@ class Capabilities implements IPublicCapability {
}
$capabilities['config']['call']['can-upload-background'] = $quota === 'none' || $quota > 0;
$capabilities['config']['call']['can-enable-sip'] = $this->talkConfig->canUserEnableSIP($user);
} else {
$capabilities['config']['call']['can-upload-background'] = false;
$capabilities['config']['call']['can-enable-sip'] = false;
}
return [

View file

@ -115,8 +115,10 @@ class CapabilitiesTest extends TestCase {
'recording' => false,
'recording-consent' => 0,
'supported-reactions' => ['❤️', '🎉', '👏', '👍', '👎', '😂', '🤩', '🤔', '😲', '😥'],
'can-upload-background' => false,
'sip-enabled' => false,
'sip-dialout-enabled' => false,
'can-enable-sip' => false,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
@ -127,8 +129,6 @@ class CapabilitiesTest extends TestCase {
'7_library.jpg',
'8_space_station.jpg',
],
'can-upload-background' => false,
'can-enable-sip' => false,
],
'chat' => [
'max-length' => 32000,
@ -249,8 +249,10 @@ class CapabilitiesTest extends TestCase {
'recording' => false,
'recording-consent' => 0,
'supported-reactions' => ['❤️', '🎉', '👏', '👍', '👎', '😂', '🤩', '🤔', '😲', '😥'],
'can-upload-background' => $canUpload,
'sip-enabled' => false,
'sip-dialout-enabled' => false,
'can-enable-sip' => false,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
@ -261,8 +263,6 @@ class CapabilitiesTest extends TestCase {
'7_library.jpg',
'8_space_station.jpg',
],
'can-upload-background' => $canUpload,
'can-enable-sip' => false,
],
'chat' => [
'max-length' => 32000,