Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33105080
D7291.1768476078.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7291.1768476078.diff
View Options
diff --git a/keyserver/src/fetchers/upload-fetchers.js b/keyserver/src/fetchers/upload-fetchers.js
--- a/keyserver/src/fetchers/upload-fetchers.js
+++ b/keyserver/src/fetchers/upload-fetchers.js
@@ -105,15 +105,34 @@
const id = row.uploadID.toString();
const dimensions = { width, height };
const uri = getUploadURL(id, secret);
+ const isEncrypted = !!uploadExtra.encryptionKey;
if (type === 'photo') {
- return { id, type: 'photo', uri, dimensions };
- } else if (loop) {
- // $FlowFixMe add thumbnailID, thumbnailURI once they're in DB
- return { id, type: 'video', uri, dimensions, loop };
+ if (!isEncrypted) {
+ return { id, type: 'photo', uri, dimensions };
+ }
+ return {
+ id,
+ type: 'encrypted_photo',
+ holder: uri,
+ dimensions,
+ encryptionKey: uploadExtra.encryptionKey,
+ };
+ }
+
+ let video;
+ if (!isEncrypted) {
+ video = { id, type: 'video', uri, dimensions };
} else {
- // $FlowFixMe add thumbnailID, thumbnailURI once they're in DB
- return { id, type: 'video', uri, dimensions };
+ video = {
+ id,
+ type: 'encrypted_video',
+ holder: uri,
+ dimensions,
+ encryptionKey: uploadExtra.encryptionKey,
+ };
}
+ // $FlowFixMe add thumbnailID, thumbnailURI once they're in DB
+ return loop ? { ...video, loop } : video;
}
async function fetchMedia(
diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -188,13 +188,20 @@
throw new ServerError('invalid_parameters');
}
- const messageData = createMediaMessageData({
- localID,
- threadID,
- creatorID: viewer.id,
- media,
- sidebarCreation,
- });
+ // We use the MULTIMEDIA type for encrypted photos
+ const containsEncryptedMedia = media.some(
+ m => m.type === 'encrypted_photo' || m.type === 'encrypted_video',
+ );
+ const messageData = createMediaMessageData(
+ {
+ localID,
+ threadID,
+ creatorID: viewer.id,
+ media,
+ sidebarCreation,
+ },
+ { forceMultimediaMessageType: containsEncryptedMedia },
+ );
const [newMessageInfo] = await createMessages(viewer, [messageData]);
const { id } = newMessageInfo;
invariant(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 11:21 AM (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5937505
Default Alt Text
D7291.1768476078.diff (2 KB)
Attached To
Mode
D7291: [keyserver] Support encrypted media in create_multimedia_message
Attached
Detach File
Event Timeline
Log In to Comment