Send proof hint flags for media messages

This commit is contained in:
N-Pex 2025-08-25 14:47:12 +02:00
parent f1b9de48d1
commit a667f28984
3 changed files with 16 additions and 4 deletions

View file

@ -23,6 +23,7 @@ export const ROOM_TYPE_FILE_MODE = "im.keanu.room_type_file";
export const ROOM_TYPE_CHANNEL = "im.keanu.room_type_channel";
export const STATE_EVENT_ROOM_TYPE = "im.keanu.room_type";
export const CLIENT_EVENT_PROOF_HINT = "im.keanu.proof_hint";
export const THUMBNAIL_MAX_WIDTH = 640;
export const THUMBNAIL_MAX_HEIGHT = 640;
@ -410,7 +411,7 @@ class Util {
return [encryptedBytes, encryptedFile];
}
sendFile(matrixClient, roomId, file, onUploadProgress, threadRoot, dimensions, thumbnail) {
sendFile(matrixClient, roomId, file, onUploadProgress, threadRoot, dimensions, thumbnail, proofHintFlags) {
const uploadPromise = new UploadPromise(undefined);
uploadPromise.wrappedPromise = new Promise((resolve, reject) => {
var reader = new FileReader();
@ -485,12 +486,16 @@ class Util {
msgtype = "m.video";
}
var messageContent = {
let messageContent = {
body: description,
info: info,
msgtype: msgtype,
};
if (proofHintFlags) {
messageContent[CLIENT_EVENT_PROOF_HINT] = JSON.stringify(proofHintFlags);
}
// If thread root (an eventId) is set, add that here
if (threadRoot) {
messageContent["m.relates_to"] = {