π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix
Manav Rathi4d9b7d763295
diff --git a/web/packages/new/photos/services/ml/cluster.ts b/web/packages/new/photos/services/ml/cluster.tsindex 41ba76504b..c3474b22b8 100644--- a/web/packages/new/photos/services/ml/cluster.ts+++ b/web/packages/new/photos/services/ml/cluster.ts@@ -15,9 +15,9 @@ export interface ClusterFacesResult {* pipeline. Each embedding is for a face detected in an image (a single image* may have multiple faces detected within it).*/-export const clusterFaces = async (- faceEmbeddings: Array<Array<number>>,-): Promise<ClusterFacesResult> => {+export const clusterFaces = (+ faceEmbeddings: number[][],+): ClusterFacesResult => {const hdbscan = new Hdbscan({input: faceEmbeddings,minClusterSize: 3,diff --git a/web/packages/new/photos/services/ml/crop.ts b/web/packages/new/photos/services/ml/crop.tsindex 6e63c3893b..1e305bbe7c 100644--- a/web/packages/new/photos/services/ml/crop.ts+++ b/web/packages/new/photos/services/ml/crop.ts@@ -1,5 +1,6 @@import type { Box } from "@/new/photos/services/ml/types";import { blobCache } from "@/next/blob-cache";+import { ensure } from "@/utils/ensure";import type { FaceAlignment } from "./f-index";export const saveFaceCrop = async (@@ -19,7 +20,7 @@ export const saveFaceCrop = async (const imageBitmapToBlob = (imageBitmap: ImageBitmap) => {const canvas = new OffscreenCanvas(imageBitmap.width, imageBitmap.height);- canvas.getContext("2d").drawImage(imageBitmap, 0, 0);+ ensure(canvas.getContext("2d")).drawImage(imageBitmap, 0, 0);return canvas.convertToBlob({ type: "image/jpeg", quality: 0.8 });};@@ -46,7 +47,7 @@ const extractFaceCrop = (}const offscreen = new OffscreenCanvas(outputSize.width, outputSize.height);- const offscreenCtx = offscreen.getContext("2d");+ const offscreenCtx = ensure(offscreen.getContext("2d"));offscreenCtx.imageSmoothingQuality = "high";offscreenCtx.translate(outputSize.width / 2, outputSize.height / 2);@@ -77,12 +78,12 @@ const extractFaceCrop = (};/** Round all the components of the box. */-const roundBox = (box: Box): Box => {- const [x, y, width, height] = [box.x, box.y, box.width, box.height].map(- (val) => Math.round(val),- );- return { x, y, width, height };-};+const roundBox = (box: Box): Box => ({+ x: Math.round(box.x),+ y: Math.round(box.y),+ width: Math.round(box.width),+ height: Math.round(box.height),+});/** Increase the size of the given {@link box} by {@link factor}. */const enlargeBox = (box: Box, factor: number): Box => {diff --git a/web/packages/new/photos/services/ml/face.worker.ts b/web/packages/new/photos/services/ml/face.worker.tsindex f5cc4b8b6f..d313ecfe09 100644--- a/web/packages/new/photos/services/ml/face.worker.ts+++ b/web/packages/new/photos/services/ml/face.worker.ts@@ -1,7 +1,7 @@import downloadManager from "@/new/photos/services/download";-import { EnteFile } from "@/new/photos/types/file";+import type { EnteFile } from "@/new/photos/types/file";import { expose } from "comlink";-import mlService from "services/machineLearning/machineLearningService";+import mlService from "./machineLearningService";export class DedicatedMLWorker {public async closeLocalSyncContext() {@@ -15,7 +15,13 @@ export class DedicatedMLWorker {enteFile: EnteFile,localFile: globalThis.File,) {- mlService.syncLocalFile(token, userID, userAgent, enteFile, localFile);+ return mlService.syncLocalFile(+ token,+ userID,+ userAgent,+ enteFile,+ localFile,+ );}public async sync(token: string, userID: number, userAgent: string) {