diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js --- a/web/chat/chat-input-bar.react.js +++ b/web/chat/chat-input-bar.react.js @@ -250,9 +250,9 @@ mediaSource = { ...mediaSource, type: mediaType, - holder: uri, + blobURI: uri, encryptionKey, - thumbnailHolder: null, + thumbnailBlobURI: null, thumbnailEncryptionKey: null, }; } diff --git a/web/chat/multimedia-message.react.js b/web/chat/multimedia-message.react.js --- a/web/chat/multimedia-message.react.js +++ b/web/chat/multimedia-message.react.js @@ -47,17 +47,17 @@ } else { const { type, - holder, + holder: blobURI, encryptionKey, - thumbnailHolder, + thumbnailHolder: thumbnailBlobURI, thumbnailEncryptionKey, dimensions, } = singleMedia; mediaSource = { type, - holder, + blobURI, encryptionKey, - thumbnailHolder, + thumbnailBlobURI, thumbnailEncryptionKey, dimensions, thumbHash, diff --git a/web/media/encrypted-multimedia.react.js b/web/media/encrypted-multimedia.react.js --- a/web/media/encrypted-multimedia.react.js +++ b/web/media/encrypted-multimedia.react.js @@ -14,10 +14,10 @@ import LoadingIndicator from '../loading-indicator.react.js'; type Props = { - +holder: string, + +blobURI: string, +encryptionKey: string, +type: EncryptedMediaType, - +thumbnailHolder?: ?string, + +thumbnailBlobURI?: ?string, +thumbnailEncryptionKey?: ?string, +placeholderSrc?: ?string, +multimediaClassName?: string, @@ -26,7 +26,7 @@ function EncryptedMultimedia(props: Props): React.Node { const { - holder, + blobURI, encryptionKey, placeholderSrc, elementStyle, @@ -42,7 +42,7 @@ setSource(null); const loadDecrypted = async () => { - const { result } = await decryptMedia(holder, encryptionKey); + const { result } = await decryptMedia(blobURI, encryptionKey); if (!isMounted) { return; } @@ -64,7 +64,7 @@ URL.revokeObjectURL(uriToDispose); } }; - }, [holder, encryptionKey]); + }, [blobURI, encryptionKey]); // we need to update the video source when the source changes // because re-rendering the <source> element wouldn't reload parent <video> @@ -97,15 +97,15 @@ mediaNode = ( <img src={source?.uri ?? placeholderSrc} - key={holder} + key={blobURI} className={multimediaClassName} style={elementStyle} /> ); } else { - const { thumbnailHolder, thumbnailEncryptionKey } = props; + const { thumbnailBlobURI, thumbnailEncryptionKey } = props; invariant( - thumbnailHolder && thumbnailEncryptionKey, + thumbnailBlobURI && thumbnailEncryptionKey, 'Thumbnail missing for encrypted video', ); @@ -113,8 +113,8 @@ <LoadableVideo uri={null} ref={videoRef} - key={holder} - thumbnailSource={{ thumbnailHolder, thumbnailEncryptionKey }} + key={blobURI} + thumbnailSource={{ thumbnailBlobURI, thumbnailEncryptionKey }} elementStyle={elementStyle} thumbHashDataURL={placeholderSrc} multimediaClassName={multimediaClassName} diff --git a/web/media/encryption-utils.js b/web/media/encryption-utils.js --- a/web/media/encryption-utils.js +++ b/web/media/encryption-utils.js @@ -132,13 +132,13 @@ }; /** - * Fetches the encrypted media for given {@link holder}, decrypts it, + * Fetches the encrypted media for given {@link blobURI}, decrypts it, * and stores it in a blob. Returns the object URL of the blob. * * The returned object URL should be revoked when the media is no longer needed. */ async function decryptMedia( - holder: string, + blobURI: string, encryptionKey: string, ): Promise<{ steps: $ReadOnlyArray<DecryptFileStep>, @@ -151,7 +151,7 @@ // Step 1 - Fetch the encrypted media and convert it to a Uint8Array let data; const fetchStartTime = Date.now(); - const url = fetchableMediaURI(holder); + const url = fetchableMediaURI(blobURI); try { const response = await fetch(url); if (!response.ok) { diff --git a/web/media/loadable-video.react.js b/web/media/loadable-video.react.js --- a/web/media/loadable-video.react.js +++ b/web/media/loadable-video.react.js @@ -13,7 +13,7 @@ +thumbnailURI: string, } | { - +thumbnailHolder: string, + +thumbnailBlobURI: string, +thumbnailEncryptionKey: string, }; type Props = { @@ -32,7 +32,7 @@ elementStyle, multimediaClassName, } = props; - const { thumbnailURI, thumbnailHolder, thumbnailEncryptionKey } = + const { thumbnailURI, thumbnailBlobURI, thumbnailEncryptionKey } = thumbnailSource; const [thumbnailImage, setThumbnailImage] = React.useState(null); @@ -52,11 +52,11 @@ } invariant( - thumbnailHolder && thumbnailEncryptionKey, + thumbnailBlobURI && thumbnailEncryptionKey, 'invalid encrypted thumbnail source', ); const { result } = await decryptMedia( - thumbnailHolder, + thumbnailBlobURI, thumbnailEncryptionKey, ); if (isMounted && result.success) { @@ -71,7 +71,7 @@ URL.revokeObjectURL(uriToDispose); } }; - }, [thumbnailURI, thumbnailHolder, thumbnailEncryptionKey]); + }, [thumbnailURI, thumbnailBlobURI, thumbnailEncryptionKey]); let videoSource; if (uri) { diff --git a/web/media/multimedia-modal.react.js b/web/media/multimedia-modal.react.js --- a/web/media/multimedia-modal.react.js +++ b/web/media/multimedia-modal.react.js @@ -27,11 +27,11 @@ } | { +type: EncryptedMediaType, - +holder: string, + +blobURI: string, +encryptionKey: string, +dimensions: ?Dimensions, +thumbHash: ?string, - +thumbnailHolder: ?string, + +thumbnailBlobURI: ?string, +thumbnailEncryptionKey: ?string, }; @@ -97,9 +97,9 @@ ); const { type, - holder, + blobURI, encryptionKey, - thumbnailHolder, + thumbnailBlobURI, thumbnailEncryptionKey, } = media; const dimensions = this.state.dimensions ?? media.dimensions; @@ -112,9 +112,9 @@ mediaModalItem = ( <EncryptedMultimedia type={type} - holder={holder} + blobURI={blobURI} encryptionKey={encryptionKey} - thumbnailHolder={thumbnailHolder} + thumbnailBlobURI={thumbnailBlobURI} thumbnailEncryptionKey={thumbnailEncryptionKey} placeholderSrc={placeholderImage} elementStyle={elementStyle} diff --git a/web/media/multimedia.react.js b/web/media/multimedia.react.js --- a/web/media/multimedia.react.js +++ b/web/media/multimedia.react.js @@ -40,11 +40,11 @@ } | { +type: EncryptedMediaType, - +holder: string, + +blobURI: string, +encryptionKey: string, +dimensions: ?Dimensions, +thumbHash: ?string, - +thumbnailHolder: ?string, + +thumbnailBlobURI: ?string, +thumbnailEncryptionKey: ?string, }; @@ -184,14 +184,14 @@ mediaSource.type === 'encrypted_photo' || mediaSource.type === 'encrypted_video' ) { - const { type, holder, thumbnailHolder } = mediaSource; + const { type, blobURI, thumbnailBlobURI } = mediaSource; invariant(encryptionKey, 'encryptionKey undefined for encrypted media'); mediaElement = ( <EncryptedMultimedia type={type} - holder={holder} + blobURI={blobURI} encryptionKey={encryptionKey} - thumbnailHolder={thumbnailHolder} + thumbnailBlobURI={thumbnailBlobURI} thumbnailEncryptionKey={thumbnailEncryptionKey} elementStyle={elementStyle} placeholderSrc={placeholderImage} diff --git a/web/modals/threads/gallery/thread-settings-media-gallery-item.react.js b/web/modals/threads/gallery/thread-settings-media-gallery-item.react.js --- a/web/modals/threads/gallery/thread-settings-media-gallery-item.react.js +++ b/web/modals/threads/gallery/thread-settings-media-gallery-item.react.js @@ -16,7 +16,7 @@ } | { +kind: 'encrypted', - +holder: string, + +blobURI: string, +encryptionKey: string, +thumbHash: ?string, }; @@ -45,12 +45,12 @@ const uri = fetchableMediaURI(imageSource.uri); image = <img src={uri} className={imageCSSClass} style={imageStyle} />; } else if (imageSource.kind === 'encrypted') { - const { holder } = imageSource; + const { blobURI } = imageSource; invariant(encryptionKey, 'encryptionKey undefined for encrypted image'); image = ( <EncryptedMultimedia type="encrypted_photo" - holder={holder} + blobURI={blobURI} encryptionKey={encryptionKey} placeholderSrc={placeholderImage} multimediaClassName={imageCSSClass} diff --git a/web/modals/threads/gallery/thread-settings-media-gallery.react.js b/web/modals/threads/gallery/thread-settings-media-gallery.react.js --- a/web/modals/threads/gallery/thread-settings-media-gallery.react.js +++ b/web/modals/threads/gallery/thread-settings-media-gallery.react.js @@ -64,17 +64,17 @@ }; } else { const { - holder, + holder: blobURI, encryptionKey, - thumbnailHolder, + thumbnailHolder: thumbnailBlobURI, thumbnailEncryptionKey, } = media; mediaInfo = { ...mediaInfo, type: media.type, - holder, + blobURI, encryptionKey, - thumbnailHolder, + thumbnailBlobURI, thumbnailEncryptionKey, }; } @@ -114,14 +114,14 @@ } else if (media.type === 'encrypted_photo') { imageSource = { kind: 'encrypted', - holder: media.holder, + blobURI: media.holder, encryptionKey: media.encryptionKey, thumbHash: media.thumbHash, }; } else { imageSource = { kind: 'encrypted', - holder: media.thumbnailHolder, + blobURI: media.thumbnailHolder, encryptionKey: media.thumbnailEncryptionKey, thumbHash: media.thumbnailThumbHash, };