diff --git a/keyserver/src/uploads/uploads.js b/keyserver/src/uploads/uploads.js --- a/keyserver/src/uploads/uploads.js +++ b/keyserver/src/uploads/uploads.js @@ -9,7 +9,9 @@ import { type UploadMediaMetadataRequest, type UploadMultimediaResult, + type UploadMediaMetadataResult, uploadMultimediaResultValidator, + uploadMediaMetadataResultValidator, type UploadDeletionRequest, type Dimensions, } from 'lib/types/media-types.js'; @@ -159,10 +161,15 @@ thumbHash: request.thumbHash, }; - const [result] = await createUploads(viewer, [uploadInfo]); + const [creationResult] = await createUploads(viewer, [uploadInfo]); + const result: UploadMediaMetadataResult = { + ...creationResult, + blobHolder, + blobHash, + }; return validateOutput( viewer.platformDetails, - uploadMultimediaResultValidator, + uploadMediaMetadataResultValidator, result, ); } diff --git a/lib/actions/upload-actions.js b/lib/actions/upload-actions.js --- a/lib/actions/upload-actions.js +++ b/lib/actions/upload-actions.js @@ -5,6 +5,7 @@ UploadMediaMetadataRequest, UploadMultimediaResult, Dimensions, + UploadMediaMetadataResult, } from '../types/media-types'; import type { CallServerEndpoint } from '../utils/call-server-endpoint.js'; import type { UploadBlob } from '../utils/upload-blob.js'; @@ -24,7 +25,9 @@ const uploadMediaMetadata = ( callServerEndpoint: CallServerEndpoint, - ): ((input: UploadMediaMetadataRequest) => Promise) => + ): (( + input: UploadMediaMetadataRequest, + ) => Promise) => async input => { const response = await callServerEndpoint('upload_media_metadata', input); return { @@ -33,6 +36,8 @@ mediaType: response.mediaType, dimensions: response.dimensions, loop: response.loop, + blobHolder: response.blobHolder, + blobHash: response.blobHash, }; }; diff --git a/lib/types/media-types.js b/lib/types/media-types.js --- a/lib/types/media-types.js +++ b/lib/types/media-types.js @@ -74,6 +74,18 @@ loop: t.Boolean, }); +export type UploadMediaMetadataResult = { + ...UploadMultimediaResult, + +blobHolder: string, + +blobHash: string, +}; +export const uploadMediaMetadataResultValidator: TInterface = + // $FlowFixMe: TInterface has no function `extend` + (uploadMultimediaResultValidator: any).extend({ + blobHolder: t.String, + blobHash: t.String, + }); + export type UpdateMultimediaMessageMediaPayload = { +messageID: string, +currentMediaID: string,