diff --git a/docs/capabilities.md b/docs/capabilities.md index 03c878d7d75..234362367ee 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -51,3 +51,6 @@ title: Capabilities * `force-mute` - "forceMute" signaling messages can be sent to mute other participants. * `conversation-v2` - The conversations API v2 is less load heavy and should be used by clients when available. Check the difference in the [Conversation API documentation](conversation.md). * `chat-reference-id` - an optional referenceId can be sent with a chat message to be able to identify it in parallel get requests to earlier fade out a temporary message + +## 11.0 +* `config => previews => max-gif-size` - Maximum size in bytes below which a GIF can be embedded directly in the page at render time. Bigger files will be rendered statically using the preview endpoint instead. Can be set with `occ config:app:set spreed max-gif-size --value=X` where X is the new value in bytes. Defaults to 3 MB. diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 3a31ad55636..7971a0b459a 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -89,6 +89,9 @@ public function getCapabilities(): array { 'max-length' => ChatManager::MAX_CHAT_LENGTH, ], 'conversations' => [], + 'previews' => [ + 'max-gif-size' => (int)$this->serverConfig->getAppValue('spreed', 'max-gif-size', '3145728') + ], ], ]; diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 1b892c410f1..c69aeaf9598 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -323,6 +323,7 @@ protected function getFileFromShare(Participant $participant, string $shareId): $share = $this->shareProvider->getShareById($shareId); $node = $share->getNode(); $name = $node->getName(); + $size = $node->getSize(); $path = $name; if (!$participant->isGuest()) { @@ -349,6 +350,7 @@ protected function getFileFromShare(Participant $participant, string $shareId): $fullPath = $userNode->getPath(); $pathSegments = explode('/', $fullPath, 4); $name = $userNode->getName(); + $size = $userNode->getSize(); $path = $pathSegments[3] ?? $path; } } else { @@ -370,6 +372,7 @@ protected function getFileFromShare(Participant $participant, string $shareId): 'type' => 'file', 'id' => (string) $node->getId(), 'name' => $name, + 'size' => $size, 'path' => $path, 'link' => $url, 'mimetype' => $node->getMimeType(), diff --git a/package-lock.json b/package-lock.json index 9f83ad84436..1f4e6c4d9b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4919,6 +4919,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "optional": true, "requires": { "color-convert": "^2.0.1" } @@ -4983,6 +4984,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "optional": true, "requires": { "color-name": "~1.1.4" } @@ -4991,7 +4993,8 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "optional": true }, "electron-to-chromium": { "version": "1.3.582", @@ -5009,7 +5012,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true + "dev": true, + "optional": true }, "escalade": { "version": "3.1.1", @@ -5298,6 +5302,7 @@ "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.9.tgz", "integrity": "sha512-mu9pg6554GbXDSO8LlxkQM6qUJzUkb/A0FJc9LgRqnU9MCnhzEXwCt1Zx5NObvFpzs2mH2dH/uUCDwL8Qaz9sA==", "dev": true, + "optional": true, "requires": { "chalk": "^4.1.0", "hash-sum": "^2.0.0", @@ -5309,6 +5314,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, + "optional": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5319,6 +5325,7 @@ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", "dev": true, + "optional": true, "requires": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", diff --git a/package.json b/package.json index 6178cb6d5a9..4f3b9933dfb 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@nextcloud/auth": "^1.3.0", "@nextcloud/axios": "^1.4.0", "@nextcloud/browser-storage": "^0.1.1", + "@nextcloud/capabilities": "^1.0.2", "@nextcloud/dialogs": "^3.0.0", "@nextcloud/event-bus": "^1.2.0", "@nextcloud/initial-state": "^1.2.0", diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue index 2d4f5844bd1..2862d7b17f7 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue @@ -28,7 +28,7 @@ :class="{ 'file-preview--viewer-available': isViewerAvailable, 'file-preview--upload-editor': isUploadEditor }" @click="handleClick" @keydown.enter="handleClick"> -