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'; @@ -126,7 +128,7 @@ async function uploadMediaMetadataResponder( viewer: Viewer, input: mixed, -): Promise { +): Promise { const request = await validateInput( viewer, uploadMediaMetadataInputValidator, @@ -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 = + tShape({ + ...uploadMultimediaResultValidator.meta.props, + blobHolder: t.String, + blobHash: t.String, + }); + export type UpdateMultimediaMessageMediaPayload = { +messageID: string, +currentMediaID: string, diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js --- a/native/input/input-state-container.react.js +++ b/native/input/input-state-container.react.js @@ -53,6 +53,7 @@ import type { Dimensions, UploadMultimediaResult, + UploadMediaMetadataResult, Media, NativeMediaSelection, MediaMissionResult, @@ -150,7 +151,7 @@ ) => Promise, +uploadMediaMetadata: ( input: UploadMediaMetadataRequest, - ) => Promise, + ) => Promise, +sendMultimediaMessage: ( threadID: string, localID: string, @@ -1174,7 +1175,7 @@ +thumbHash: ?string, }, options?: ?CallServerEndpointOptions, - ): Promise { + ): Promise { const newHolder = uuid.v4(); const blobHash = toBase64URL(input.blobHash); diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js --- a/web/input/input-state-container.react.js +++ b/web/input/input-state-container.react.js @@ -57,6 +57,7 @@ import type { UploadMultimediaResult, UploadMediaMetadataRequest, + UploadMediaMetadataResult, MediaMissionStep, MediaMissionFailure, MediaMissionResult, @@ -140,7 +141,7 @@ ) => Promise, +uploadMediaMetadata: ( input: UploadMediaMetadataRequest, - ) => Promise, + ) => Promise, +deleteUpload: (id: string) => Promise, +sendMultimediaMessage: ( threadID: string,