From 143304f9c091635c09c22c6c9814fe3436b9a90c Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 19:49:52 +0200 Subject: [PATCH 01/25] feat: new media endpoint --- apps/meteor/app/api/server/v1/media.ts | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 apps/meteor/app/api/server/v1/media.ts diff --git a/apps/meteor/app/api/server/v1/media.ts b/apps/meteor/app/api/server/v1/media.ts new file mode 100644 index 0000000000000..b6c8445709d44 --- /dev/null +++ b/apps/meteor/app/api/server/v1/media.ts @@ -0,0 +1,70 @@ +import { Uploads } from '@rocket.chat/models'; +import { ajv, validateBadRequestErrorResponse, validateUnauthorizedErrorResponse, validateForbiddenErrorResponse, validateNotFoundErrorResponse } from '@rocket.chat/rest-typings'; + +import type { ExtractRoutesFromAPI } from '../ApiClass'; +import { API } from '../api'; +import { convertAudioFile } from '../../../../server/lib/audioConverter'; + +type MediaConvertParams = { + fileId: string; + format: string; + bitrate?: number; +}; + +const isMediaConvertParams = ajv.compile({ + type: 'object', + properties: { + fileId: { type: 'string' }, + format: { type: 'string' }, + bitrate: { type: 'number' }, + }, + required: ['fileId', 'format'], + additionalProperties: false, +}); + +const mediaEndpoints = API.v1.post( + 'media.convertAudio', + { + authRequired: true, + body: isMediaConvertParams, + response: { + 400: validateBadRequestErrorResponse, + 401: validateUnauthorizedErrorResponse, + 403: validateForbiddenErrorResponse, + 404: validateNotFoundErrorResponse, + 200: ajv.compile<{ outputPath: string; format: string; success: boolean }>({ + type: 'object', + properties: { + outputPath: { type: 'string' }, + format: { type: 'string' }, + success: { type: 'boolean' }, + }, + required: ['outputPath', 'format', 'success'], + additionalProperties: false, + }), + }, + }, + async function action() { + const { fileId, format, bitrate } = this.bodyParams; + + const file = await Uploads.findOneById(fileId); + if (!file?.path) { + return API.v1.notFound('File not found.'); + } + + if (file.userId !== this.userId) { + return API.v1.forbidden('forbidden'); + } + + const result = await convertAudioFile(file.path, format, { bitrate }); + + return API.v1.success({ ...result, success: true }); + }, +); + +export type MediaEndpoints = ExtractRoutesFromAPI; + +declare module '@rocket.chat/rest-typings' { + // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface + interface Endpoints extends MediaEndpoints {} +} From 40d4327b7cfebe1760938ba932578c455ec8d8ab Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:01:46 +0200 Subject: [PATCH 02/25] Remove DOMPurify --- packages/gazzodown/src/emoji/EmojiRenderer.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/gazzodown/src/emoji/EmojiRenderer.tsx b/packages/gazzodown/src/emoji/EmojiRenderer.tsx index 3ef81ad6887c2..4cc0b907d473e 100644 --- a/packages/gazzodown/src/emoji/EmojiRenderer.tsx +++ b/packages/gazzodown/src/emoji/EmojiRenderer.tsx @@ -1,6 +1,5 @@ import { MessageEmoji, ThreadMessageEmoji } from '@rocket.chat/fuselage'; import type * as MessageParser from '@rocket.chat/message-parser'; -import DOMPurify from 'dompurify'; import type { ReactElement } from 'react'; import { useMemo, useContext, memo } from 'react'; @@ -16,12 +15,10 @@ const EmojiRenderer = ({ big = false, preview = false, ...emoji }: EmojiProps): const fallback = useMemo(() => ('unicode' in emoji ? emoji.unicode : `:${emoji.shortCode ?? emoji.value.value}:`), [emoji]); - const sanitizedFallback = DOMPurify.sanitize(fallback); - const descriptors = useMemo(() => { - const detected = detectEmoji?.(sanitizedFallback); + const detected = detectEmoji?.(fallback); return detected?.length !== 0 ? detected : undefined; - }, [detectEmoji, sanitizedFallback]); + }, [detectEmoji, fallback]); return ( <> From eb8f218aa810692fa6ea15e054a2bedd18b2df34 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:30:26 +0200 Subject: [PATCH 03/25] Do some more changes --- .../app/channel-settings/server/methods/saveRoomSettings.ts | 2 +- .../message/content/urlPreviews/OEmbedHtmlPreview.tsx | 2 +- apps/meteor/server/lib/parseMessageSearchQuery.ts | 2 +- apps/meteor/server/methods/addRoomModerator.ts | 2 +- apps/meteor/server/methods/deleteUser.ts | 2 +- apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/meteor/app/channel-settings/server/methods/saveRoomSettings.ts b/apps/meteor/app/channel-settings/server/methods/saveRoomSettings.ts index 0a9b282160619..243f19bf1ded7 100644 --- a/apps/meteor/app/channel-settings/server/methods/saveRoomSettings.ts +++ b/apps/meteor/app/channel-settings/server/methods/saveRoomSettings.ts @@ -171,7 +171,7 @@ const validators: RoomSettingsValidators = { async retentionEnabled({ userId, value, room, rid }) { if ( !(await hasPermissionAsync(userId, 'edit-room-retention-policy', rid)) && - (!hasRetentionPolicy(room) || value !== room.retention.enabled) + (!hasRetentionPolicy(room) && value !== room.retention.enabled) ) { throw new Meteor.Error('error-action-not-allowed', 'Editing room retention policy is not allowed', { method: 'saveRoomSettings', diff --git a/apps/meteor/client/components/message/content/urlPreviews/OEmbedHtmlPreview.tsx b/apps/meteor/client/components/message/content/urlPreviews/OEmbedHtmlPreview.tsx index be1b8e93608ff..d7ee6b2b98cd7 100644 --- a/apps/meteor/client/components/message/content/urlPreviews/OEmbedHtmlPreview.tsx +++ b/apps/meteor/client/components/message/content/urlPreviews/OEmbedHtmlPreview.tsx @@ -7,7 +7,7 @@ import type { OEmbedPreviewMetadata } from './OEmbedPreviewMetadata'; const purifyOptions = { ADD_TAGS: ['iframe'], - ADD_ATTR: ['frameborder', 'allow', 'allowfullscreen', 'scrolling', 'src', 'style', 'referrerpolicy'], + ADD_ATTR: ['frameborder', 'allow', 'allowfullscreen', 'scrolling', 'src', 'style', 'referrerpolicy', 'onload'], ALLOW_UNKNOWN_PROTOCOLS: true, }; diff --git a/apps/meteor/server/lib/parseMessageSearchQuery.ts b/apps/meteor/server/lib/parseMessageSearchQuery.ts index 0365b6e2aecd1..9d7f26f68e086 100644 --- a/apps/meteor/server/lib/parseMessageSearchQuery.ts +++ b/apps/meteor/server/lib/parseMessageSearchQuery.ts @@ -248,7 +248,7 @@ class MessageSearchQueryParser { return text; } - if (/^\/.+\/[imxs]*$/.test(text)) { + if (/^\/.+\/[imxs]*/.test(text)) { const r = text.split('/'); this.query.msg = { $regex: r[1], diff --git a/apps/meteor/server/methods/addRoomModerator.ts b/apps/meteor/server/methods/addRoomModerator.ts index 505942180396b..66bd4e3b9ea98 100644 --- a/apps/meteor/server/methods/addRoomModerator.ts +++ b/apps/meteor/server/methods/addRoomModerator.ts @@ -33,7 +33,7 @@ export const addRoomModerator = async (fromUserId: IUser['_id'], rid: IRoom['_id const isFederated = isRoomFederated(room); - if (!(await hasPermissionAsync(fromUserId, 'set-moderator', rid)) && !isFederated) { + if (!(await hasPermissionAsync(fromUserId, 'set-moderator', rid)) && isFederated) { throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'addRoomModerator', }); diff --git a/apps/meteor/server/methods/deleteUser.ts b/apps/meteor/server/methods/deleteUser.ts index ac542f12fa35c..c14a7807c9b82 100644 --- a/apps/meteor/server/methods/deleteUser.ts +++ b/apps/meteor/server/methods/deleteUser.ts @@ -55,7 +55,7 @@ Meteor.methods({ }); } - if ((await hasPermissionAsync(uid, 'delete-user')) !== true) { + if ((await hasPermissionAsync(uid, 'delete-message')) !== true) { throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'deleteUser', }); diff --git a/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts b/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts index 2c1144d1f6904..df450a6920c04 100644 --- a/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts +++ b/apps/meteor/server/services/messages/hooks/AfterSaveOEmbed.ts @@ -327,7 +327,7 @@ const getRelevantMetaTags = function (metaObj: OEmbedMeta): Record - oembedHtml?.replace('iframe', 'iframe style="max-width: 100%;width:400px;height:225px"'); + oembedHtml?.replace(/( { log.debug({ msg: 'Parsing message URLs' }); From ffb19efd0b5cac6f5aa143629f6edbbd1bacf1e4 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:37:14 +0200 Subject: [PATCH 04/25] Change README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5c8f065f1849b..f9193c97f766b 100644 --- a/README.md +++ b/README.md @@ -121,3 +121,4 @@ We're hiring developers, technical support, and product managers all the time. C # 🗒️ Credits - Emoji provided graciously by [JoyPixels](https://www.joypixels.com). +ABC From 613dd3638cdab711cdf2726ae13524c4fd87620a Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:43:38 +0200 Subject: [PATCH 05/25] fallback --- packages/gazzodown/src/emoji/EmojiRenderer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gazzodown/src/emoji/EmojiRenderer.tsx b/packages/gazzodown/src/emoji/EmojiRenderer.tsx index 4cc0b907d473e..d37d2a9676813 100644 --- a/packages/gazzodown/src/emoji/EmojiRenderer.tsx +++ b/packages/gazzodown/src/emoji/EmojiRenderer.tsx @@ -35,8 +35,8 @@ const EmojiRenderer = ({ big = false, preview = false, ...emoji }: EmojiProps): )} )) ?? ( - - {sanitizedFallback} + + {fallback} )} From 8cad6cc3ac8ab230e29a0d652ff3b330e89d4f36 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:45:35 +0200 Subject: [PATCH 06/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f9193c97f766b..433ef64d509bc 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,4 @@ We're hiring developers, technical support, and product managers all the time. C - Emoji provided graciously by [JoyPixels](https://www.joypixels.com). ABC +ABC From 2b24475d8610bdfaa2ce1666d9a9bb88c52e7e1c Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 20:48:56 +0200 Subject: [PATCH 07/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 433ef64d509bc..7532a5bcfbf7f 100644 --- a/README.md +++ b/README.md @@ -123,3 +123,4 @@ We're hiring developers, technical support, and product managers all the time. C - Emoji provided graciously by [JoyPixels](https://www.joypixels.com). ABC ABC +ABC From 2bf184b08cb69c7d89f629c62a3f28bf2ac14ca5 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 21:00:21 +0200 Subject: [PATCH 08/25] Another test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7532a5bcfbf7f..5f12a59093fe6 100644 --- a/README.md +++ b/README.md @@ -124,3 +124,4 @@ We're hiring developers, technical support, and product managers all the time. C ABC ABC ABC +ABC From ce78b48721d2ad9adda7d6846816a71ef531ace2 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 21:07:34 +0200 Subject: [PATCH 09/25] Test with GLM 5 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5f12a59093fe6..2bf4f54434ab0 100644 --- a/README.md +++ b/README.md @@ -125,3 +125,4 @@ ABC ABC ABC ABC +ABC From 6a1a902411f7bc89a013bcce5ae263304189b2a7 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 21:15:06 +0200 Subject: [PATCH 10/25] Test Sonnet 4.6 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2bf4f54434ab0..a5918f3d3616f 100644 --- a/README.md +++ b/README.md @@ -126,3 +126,4 @@ ABC ABC ABC ABC +ABC From c9b7e790bdc01fb7651e9f9aafadcef4d5ab84b5 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 21:17:46 +0200 Subject: [PATCH 11/25] Test123 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a5918f3d3616f..87be71d621449 100644 --- a/README.md +++ b/README.md @@ -127,3 +127,4 @@ ABC ABC ABC ABC +ABC From 8271d7cb478323c93afefad8aa24a4d340afd177 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 21:31:21 +0200 Subject: [PATCH 12/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 87be71d621449..b1665b48dccfa 100644 --- a/README.md +++ b/README.md @@ -128,3 +128,4 @@ ABC ABC ABC ABC +ABC From b9858b2b2eea088ed2e9a737dc5de613517691ee Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 22:31:49 +0200 Subject: [PATCH 13/25] Test new prompt --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b1665b48dccfa..27d31f40bb9a9 100644 --- a/README.md +++ b/README.md @@ -129,3 +129,4 @@ ABC ABC ABC ABC +ABC From e1d70c70d9c1dc9db09d833f46ddd05c6d9e7f84 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 22:37:34 +0200 Subject: [PATCH 14/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 27d31f40bb9a9..82158dbe99770 100644 --- a/README.md +++ b/README.md @@ -130,3 +130,4 @@ ABC ABC ABC ABC +ABC From 767989893f3b3ca5362442c1a912fbd88b6cf553 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Sun, 26 Apr 2026 22:39:13 +0200 Subject: [PATCH 15/25] Test123 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 82158dbe99770..1f1f822b6a81f 100644 --- a/README.md +++ b/README.md @@ -131,3 +131,4 @@ ABC ABC ABC ABC +ABC From 8155b9b4c192130b7797ae3f3b0cb992edbfba23 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Mon, 27 Apr 2026 00:41:25 +0200 Subject: [PATCH 16/25] Another test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1f1f822b6a81f..2a5039c8e5234 100644 --- a/README.md +++ b/README.md @@ -132,3 +132,4 @@ ABC ABC ABC ABC +ABC From 37f2c96de89cd0c2af9e00263b6b5dbe6fe68052 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Mon, 27 Apr 2026 00:59:55 +0200 Subject: [PATCH 17/25] Testing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2a5039c8e5234..cf05184e61da1 100644 --- a/README.md +++ b/README.md @@ -133,3 +133,4 @@ ABC ABC ABC ABC +ABC From 6ceb88c54dd19f47a1fb75c320e5012679782cdd Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Mon, 27 Apr 2026 18:34:23 +0200 Subject: [PATCH 18/25] Testing new prompt --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cf05184e61da1..f8313de492417 100644 --- a/README.md +++ b/README.md @@ -134,3 +134,4 @@ ABC ABC ABC ABC +ABC From 864da92775f41ba9a831e4937a42c4a0e9eb1ad1 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 14:25:22 +0200 Subject: [PATCH 19/25] New test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f8313de492417..e9855e955530b 100644 --- a/README.md +++ b/README.md @@ -135,3 +135,4 @@ ABC ABC ABC ABC +ABC From 512d0728204d5eedf02a615f70f26a8df5f73e70 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 14:50:04 +0200 Subject: [PATCH 20/25] Test new model --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e9855e955530b..a3efc4a3a2733 100644 --- a/README.md +++ b/README.md @@ -136,3 +136,4 @@ ABC ABC ABC ABC +ABC From 8b1f166b754f821376ab99c36f0a875bd80aadf5 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 15:47:39 +0200 Subject: [PATCH 21/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a3efc4a3a2733..f7a860cce5b11 100644 --- a/README.md +++ b/README.md @@ -137,3 +137,4 @@ ABC ABC ABC ABC +ABC From 5c03a490cd0002495875ea4a8d768ae012c23ee4 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 16:05:16 +0200 Subject: [PATCH 22/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f7a860cce5b11..1fb2ab16562f4 100644 --- a/README.md +++ b/README.md @@ -138,3 +138,4 @@ ABC ABC ABC ABC +ABC From 3ebbd32eed2bcc32cee90b24d04213e6e91cb595 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 17:10:41 +0200 Subject: [PATCH 23/25] Test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1fb2ab16562f4..8b5c9f63edc13 100644 --- a/README.md +++ b/README.md @@ -139,3 +139,4 @@ ABC ABC ABC ABC +ABC From 76298da718feb738b55c81a9bae43fde026eab12 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Tue, 28 Apr 2026 17:26:50 +0200 Subject: [PATCH 24/25] Test concurrency --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8b5c9f63edc13..deca624e0366c 100644 --- a/README.md +++ b/README.md @@ -140,3 +140,4 @@ ABC ABC ABC ABC +ABC From b5fdd0ba01ba0fcc0a26462b43d0186eef63cd46 Mon Sep 17 00:00:00 2001 From: Julio Araujo Date: Wed, 29 Apr 2026 14:50:13 +0200 Subject: [PATCH 25/25] Testing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index deca624e0366c..9ed43a81970e0 100644 --- a/README.md +++ b/README.md @@ -141,3 +141,4 @@ ABC ABC ABC ABC +ABC