Page MenuHomePhabricator

D7620.id25809.diff
No OneTemporary

D7620.id25809.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -63,7 +63,10 @@
updateUserAvatarResponder,
} from './responders/user-responders.js';
import { codeVerificationResponder } from './responders/verification-responders.js';
-import { uploadDeletionResponder } from './uploads/uploads.js';
+import {
+ uploadMediaMetadataResponder,
+ uploadDeletionResponder,
+} from './uploads/uploads.js';
const jsonEndpoints: { [id: Endpoint]: JSONResponder } = {
create_account: {
@@ -262,6 +265,10 @@
responder: updateUserAvatarResponder,
requiredPolicies: baseLegalPolicies,
},
+ upload_media_metadata: {
+ responder: uploadMediaMetadataResponder,
+ requiredPolicies: baseLegalPolicies,
+ },
};
export { jsonEndpoints };
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
@@ -2,9 +2,10 @@
import type { Shape } from '../types/core.js';
import type {
+ UploadMediaMetadataRequest,
UploadMultimediaResult,
Dimensions,
-} from '../types/media-types.js';
+} from '../types/media-types';
import type { CallServerEndpoint } from '../utils/call-server-endpoint.js';
import type { UploadBlob } from '../utils/upload-blob.js';
@@ -19,6 +20,21 @@
encryptionKey?: string,
}>;
+const uploadMediaMetadata =
+ (
+ callServerEndpoint: CallServerEndpoint,
+ ): ((input: UploadMediaMetadataRequest) => Promise<UploadMultimediaResult>) =>
+ async input => {
+ const response = await callServerEndpoint('upload_media_metadata', input);
+ return {
+ id: response.id,
+ uri: response.uri,
+ mediaType: response.mediaType,
+ dimensions: response.dimensions,
+ loop: response.loop,
+ };
+ };
+
const uploadMultimedia =
(
callServerEndpoint: CallServerEndpoint,
@@ -84,6 +100,7 @@
export {
uploadMultimedia,
+ uploadMediaMetadata,
updateMultimediaMessageMediaActionType,
deleteUpload,
};
diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js
--- a/lib/types/endpoints.js
+++ b/lib/types/endpoints.js
@@ -87,6 +87,7 @@
SIWE_NONCE: 'siwe_nonce',
SIWE_AUTH: 'siwe_auth',
UPDATE_USER_AVATAR: 'update_user_avatar',
+ UPLOAD_MEDIA_METADATA: 'upload_media_metadata',
});
type SocketPreferredEndpoint = $Values<typeof socketPreferredEndpoints>;

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 3:48 AM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2448343
Default Alt Text
D7620.id25809.diff (2 KB)

Event Timeline