Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix issues

Abhinav1bd8b234f685
diff --git a/apps/photos/src/pages/gallery/index.tsx b/apps/photos/src/pages/gallery/index.tsx
index 41ed28c099..d11b03d4af 100644
--- a/apps/photos/src/pages/gallery/index.tsx
+++ b/apps/photos/src/pages/gallery/index.tsx
@@ -310,7 +310,7 @@ export default function Gallery() {
if (!valid) {
return;
}
- downloadManager.init(APPS.PHOTOS, { token });
+ await downloadManager.init(APPS.PHOTOS, { token });
setupSelectAllKeyBoardShortcutHandler();
setActiveCollectionID(ALL_SECTION);
setIsFirstLoad(isFirstLogin());
diff --git a/apps/photos/src/pages/shared-albums/index.tsx b/apps/photos/src/pages/shared-albums/index.tsx
index 9ea3fef94d..61c4be4445 100644
--- a/apps/photos/src/pages/shared-albums/index.tsx
+++ b/apps/photos/src/pages/shared-albums/index.tsx
@@ -197,7 +197,7 @@ export default function PublicCollectionGallery() {
setPublicFiles(localPublicFiles);
passwordJWTToken.current =
await getLocalPublicCollectionPassword(collectionUID);
- downloadManager.init(APPS.PHOTOS, {
+ await downloadManager.init(APPS.PHOTOS, {
token: token.current,
passwordToken: passwordJWTToken.current,
});
@@ -386,7 +386,11 @@ export default function PublicCollectionGallery() {
hashedPassword
);
passwordJWTToken.current = jwtToken;
- savePublicCollectionPassword(collectionUID, jwtToken);
+ await downloadManager.init(APPS.PHOTOS, {
+ token: token.current,
+ passwordToken: passwordJWTToken.current,
+ });
+ await savePublicCollectionPassword(collectionUID, jwtToken);
} catch (e) {
const parsedError = parseSharingErrorCodes(e);
if (parsedError.message === CustomError.TOKEN_EXPIRED) {
diff --git a/apps/photos/src/services/clipService.ts b/apps/photos/src/services/clipService.ts
index c1083258c2..8ca1fefa84 100644
--- a/apps/photos/src/services/clipService.ts
+++ b/apps/photos/src/services/clipService.ts
@@ -297,11 +297,7 @@ class ClipServiceImpl {
};
private extractFileClipImageEmbedding = async (file: EnteFile) => {
- const thumb = await downloadManager
- .getThumbnail(file)
- .then((fileBlob) =>
- fileBlob.arrayBuffer().then((buffer) => new Uint8Array(buffer))
- );
+ const thumb = await downloadManager.getThumbnail(file);
const embedding = await ElectronAPIs.computeImageEmbedding(thumb);
return embedding;
};
diff --git a/apps/photos/src/services/download/index.ts b/apps/photos/src/services/download/index.ts
index d3849f49b4..6102b0c426 100644
--- a/apps/photos/src/services/download/index.ts
+++ b/apps/photos/src/services/download/index.ts
@@ -98,7 +98,7 @@ class DownloadManager {
);
if (cacheResp) {
- return cacheResp.blob();
+ return new Uint8Array(await cacheResp.arrayBuffer());
}
} catch (e) {
logError(e, 'failed to get cached thumbnail');
diff --git a/apps/photos/src/services/machineLearning/machineLearningService.ts b/apps/photos/src/services/machineLearning/machineLearningService.ts
index eee95be2b1..4e3662cbc2 100644
--- a/apps/photos/src/services/machineLearning/machineLearningService.ts
+++ b/apps/photos/src/services/machineLearning/machineLearningService.ts
@@ -63,7 +63,7 @@ class MachineLearningService {
throw Error('Token needed by ml service to sync file');
}
- downloadManager.init(APPS.PHOTOS, { token });
+ await downloadManager.init(APPS.PHOTOS, { token });
// await this.init();
// Used to debug tf memory leak, all tf memory
diff --git a/apps/photos/src/utils/machineLearning/index.ts b/apps/photos/src/utils/machineLearning/index.ts
index e6156ad9ed..ad3236b839 100644
--- a/apps/photos/src/utils/machineLearning/index.ts
+++ b/apps/photos/src/utils/machineLearning/index.ts
@@ -363,10 +363,10 @@ export async function getOriginalImageBitmap(
}
export async function getThumbnailImageBitmap(file: EnteFile) {
- const thumbBlob = await DownloadManager.getThumbnail(file);
+ const thumb = await DownloadManager.getThumbnail(file);
addLogLine('[MLService] Got thumbnail: ', file.id.toString());
- return getImageBlobBitmap(thumbBlob);
+ return getImageBlobBitmap(new Blob([thumb]));
}
export async function getLocalFileImageBitmap(