Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3405802
D8370.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8370.diff
View Options
diff --git a/lib/media/media-utils.js b/lib/media/media-utils.js
--- a/lib/media/media-utils.js
+++ b/lib/media/media-utils.js
@@ -46,7 +46,9 @@
(!!media.uri && isBlobServiceURI(media.uri)) ||
(!!media.holder && isBlobServiceURI(media.holder)) ||
(!!media.thumbnailURI && isBlobServiceURI(media.thumbnailURI)) ||
- (!!media.thumbnailHolder && isBlobServiceURI(media.thumbnailHolder))
+ (!!media.thumbnailHolder && isBlobServiceURI(media.thumbnailHolder)) ||
+ (!!media.blobURI && isBlobServiceURI(media.blobURI)) ||
+ (!!media.thumbnailBlobURI && isBlobServiceURI(media.thumbnailBlobURI))
);
}
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
@@ -672,25 +672,31 @@
localMediaSelection: t.maybe(nativeMediaSelectionValidator),
});
-export type EncryptedImage = {
+type EncryptedImageCommons = {
+id: string,
- // a media URI for keyserver uploads / blob holder for Blob service uploads
- +holder: string,
+encryptionKey: string,
+type: 'encrypted_photo',
+dimensions: Dimensions,
+thumbHash: ?string,
};
+// old message formats (native codeVersion < FUTURE_CODE_VERSION) used holder
+// new format uses blobURI. Effectively, they both mean blob URI
+export type EncryptedImage =
+ | { ...EncryptedImageCommons, +holder: string }
+ | { ...EncryptedImageCommons, +blobURI: string };
-export const encryptedImageValidator: TInterface<EncryptedImage> =
- tShape<EncryptedImage>({
- id: tID,
- holder: t.String,
- encryptionKey: t.String,
- type: tString('encrypted_photo'),
- dimensions: dimensionsValidator,
- thumbHash: t.maybe(t.String),
- });
+const encryptedImageCommonsValidator = {
+ id: tID,
+ encryptionKey: t.String,
+ type: tString('encrypted_photo'),
+ dimensions: dimensionsValidator,
+ thumbHash: t.maybe(t.String),
+};
+
+const encryptedImageValidator = t.union<EncryptedImage>([
+ tShape({ ...encryptedImageCommonsValidator, holder: t.String }),
+ tShape({ ...encryptedImageCommonsValidator, blobURI: t.String }),
+]);
export type Video = {
+id: string,
@@ -717,33 +723,44 @@
localMediaSelection: t.maybe(nativeMediaSelectionValidator),
});
-export type EncryptedVideo = {
+type EncryptedVideoCommons = {
+id: string,
- // a media URI for keyserver uploads / blob holder for Blob service uploads
- +holder: string,
+encryptionKey: string,
+type: 'encrypted_video',
+dimensions: Dimensions,
+loop?: boolean,
+thumbnailID: string,
- +thumbnailHolder: string,
+thumbnailEncryptionKey: string,
+thumbnailThumbHash: ?string,
};
+// old message formats (native codeVersion < FUTURE_CODE_VERSION) used holder
+// new format uses blobURI. Effectively, they both mean blob URI
+export type EncryptedVideo =
+ | { ...EncryptedVideoCommons, +holder: string, +thumbnailHolder: string }
+ | { ...EncryptedVideoCommons, +blobURI: string, +thumbnailBlobURI: string };
-export const encryptedVideoValidator: TInterface<EncryptedVideo> =
- tShape<EncryptedVideo>({
- id: tID,
+const encryptedVideoCommonsValidator = {
+ id: tID,
+ encryptionKey: t.String,
+ type: tString('encrypted_video'),
+ dimensions: dimensionsValidator,
+ loop: t.maybe(t.Boolean),
+ thumbnailID: tID,
+ thumbnailEncryptionKey: t.String,
+ thumbnailThumbHash: t.maybe(t.String),
+};
+const encryptedVideoValidator = t.union<EncryptedVideo>([
+ tShape({
+ ...encryptedVideoCommonsValidator,
holder: t.String,
- encryptionKey: t.String,
- type: tString('encrypted_video'),
- dimensions: dimensionsValidator,
- loop: t.maybe(t.Boolean),
- thumbnailID: tID,
thumbnailHolder: t.String,
- thumbnailEncryptionKey: t.String,
- thumbnailThumbHash: t.maybe(t.String),
- });
+ }),
+ tShape({
+ ...encryptedVideoCommonsValidator,
+ blobURI: t.String,
+ thumbnailBlobURI: t.String,
+ }),
+]);
export type Media = Image | Video | EncryptedImage | EncryptedVideo;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 4, 11:00 PM (12 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615070
Default Alt Text
D8370.diff (3 KB)
Attached To
Mode
D8370: [lib] Introduce blobURI multimedia message field
Attached
Detach File
Event Timeline
Log In to Comment