π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Interface
Manav Rathia86cdb1f1ec6
diff --git a/web/apps/photos/src/components/ml/PeopleList.tsx b/web/apps/photos/src/components/ml/PeopleList.tsxindex 97fa504a0a..54d2843f21 100644--- a/web/apps/photos/src/components/ml/PeopleList.tsx+++ b/web/apps/photos/src/components/ml/PeopleList.tsx@@ -1,4 +1,3 @@-import { cached } from "@/next/blob-cache";import { ensureLocalUser } from "@/next/local-user";import log from "@/next/log";import { Skeleton, styled } from "@mui/material";@@ -169,24 +168,13 @@ const FaceCropImageView: React.FC<FaceCropImageViewProps> = ({if (!url) {blob = undefined;} else {- const user = await ensureLocalUser();- blob = await cached("face-crops", url, async () => {- try {- log.debug(- () =>- `ImageCacheView: regenerate face crop for ${faceId}`,- );- return machineLearningService.regenerateFaceCrop(- user.token,- user.id,- faceId,- );- } catch (e) {- log.error(- "ImageCacheView: regenerate face crop failed",- e,- );- }+ blob = await cachedOrNew("face-crops", url, async () => {+ const user = await ensureLocalUser();+ return machineLearningService.regenerateFaceCrop(+ user.token,+ user.id,+ faceId,+ );});}diff --git a/web/packages/next/blob-cache.ts b/web/packages/next/blob-cache.tsindex 6b8dc5e421..bc6387123c 100644--- a/web/packages/next/blob-cache.ts+++ b/web/packages/next/blob-cache.ts@@ -198,19 +198,24 @@ const openOPFSCacheWeb = async (name: BlobCacheNamespace) => {};};-export async function cached(+/**+ * Return a cached blob for {@link key} in {@link cacheName}. If the blob is not+ * found in the cache, recreate/fetch it using {@link get}, cache it, and then+ * return it.+ */+export const cachedOrNew = async (cacheName: BlobCacheNamespace,- id: string,+ key: string,get: () => Promise<Blob>,-): Promise<Blob> {+): Promise<Blob> => {const cache = await openCache(cacheName);- const cachedBlob = await cache.get(id);+ const cachedBlob = await cache.get(key);if (cachedBlob) return cachedBlob;const blob = await get();- await cache.put2(id, blob);+ await cache.put2(key, blob);return blob;-}+};/*** Delete all cached data.