π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Stylistic
Manav Rathi50a144702025
diff --git a/desktop/.eslintrc.js b/desktop/.eslintrc.jsindex ed16db5264..44d03ef0c1 100644--- a/desktop/.eslintrc.js+++ b/desktop/.eslintrc.js@@ -5,8 +5,7 @@ module.exports = {"eslint:recommended","plugin:@typescript-eslint/eslint-recommended","plugin:@typescript-eslint/strict-type-checked",- /* What we really want eventually */- // "plugin:@typescript-eslint/stylistic-type-checked",+ "plugin:@typescript-eslint/stylistic-type-checked",],plugins: ["@typescript-eslint"],parser: "@typescript-eslint/parser",diff --git a/desktop/src/main/services/ml-clip.ts b/desktop/src/main/services/ml-clip.tsindex c9378edf29..e3dd99204a 100644--- a/desktop/src/main/services/ml-clip.ts+++ b/desktop/src/main/services/ml-clip.ts@@ -45,7 +45,7 @@ const clipImageEmbedding_ = async (jpegFilePath: string) => {`onnx/clip image embedding took ${Date.now() - t1} ms (prep: ${t2 - t1} ms, inference: ${Date.now() - t2} ms)`,);/* Need these model specific casts to type the result */- const imageEmbedding = ensure(results["output"]).data as Float32Array;+ const imageEmbedding = ensure(results.output).data as Float32Array;return normalizeEmbedding(imageEmbedding);};@@ -120,13 +120,12 @@ const getRGBData = async (jpegFilePath: string): Promise<number[]> => {const normalizeEmbedding = (embedding: Float32Array) => {let normalization = 0;- for (let index = 0; index < embedding.length; index++) {- normalization += ensure(embedding[index]) * ensure(embedding[index]);- }+ for (const v of embedding) normalization += v * v;+const sqrtNormalization = Math.sqrt(normalization);- for (let index = 0; index < embedding.length; index++) {+ for (let index = 0; index < embedding.length; index++)embedding[index] = ensure(embedding[index]) / sqrtNormalization;- }+return embedding;};@@ -168,6 +167,6 @@ export const clipTextEmbeddingIfAvailable = async (text: string) => {() =>`onnx/clip text embedding took ${Date.now() - t1} ms (prep: ${t2 - t1} ms, inference: ${Date.now() - t2} ms)`,);- const textEmbedding = ensure(results["output"]).data as Float32Array;+ const textEmbedding = ensure(results.output).data as Float32Array;return normalizeEmbedding(textEmbedding);};diff --git a/desktop/src/main/services/ml-face.ts b/desktop/src/main/services/ml-face.tsindex e72f043e06..9765252555 100644--- a/desktop/src/main/services/ml-face.ts+++ b/desktop/src/main/services/ml-face.ts@@ -24,7 +24,7 @@ export const detectFaces = async (input: Float32Array) => {};const results = await session.run(feeds);log.debug(() => `onnx/yolo face detection took ${Date.now() - t} ms`);- return ensure(results["output"]).data;+ return ensure(results.output).data;};const cachedFaceEmbeddingSession = makeCachedInferenceSession(@@ -47,7 +47,6 @@ export const faceEmbedding = async (input: Float32Array) => {const results = await session.run(feeds);log.debug(() => `onnx/yolo face embedding took ${Date.now() - t} ms`);/* Need these model specific casts to extract and type the result */- return (results.embeddings as unknown as Record<string, unknown>)[- "cpuData"- ] as Float32Array;+ return (results.embeddings as unknown as Record<string, unknown>)+ .cpuData as Float32Array;};diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.tsindex 96835bfb00..7871b56fda 100644--- a/desktop/src/main/services/upload.ts+++ b/desktop/src/main/services/upload.ts@@ -14,7 +14,7 @@ export const listZipItems = async (zipPath: string): Promise<ZipItem[]> => {for (const entry of Object.values(entries)) {const basename = path.basename(entry.name);// Ignore "hidden" files (files whose names begins with a dot).- if (entry.isFile && basename.length > 0 && basename[0] != ".") {+ if (entry.isFile && basename.startsWith(".")) {// `entry.name` is the path within the zip.entryNames.push(entry.name);}diff --git a/desktop/src/main/utils/temp.ts b/desktop/src/main/utils/temp.tsindex 582f0a2b3d..11f7a5d845 100644--- a/desktop/src/main/utils/temp.ts+++ b/desktop/src/main/utils/temp.ts@@ -98,7 +98,9 @@ export const makeFileForDataOrPathOrZipItem = async (): Promise<FileForDataOrPathOrZipItem> => {let path: string;let isFileTemporary: boolean;- let writeToTemporaryFile = async () => {};+ let writeToTemporaryFile = async () => {+ /* no-op */+ };if (typeof dataOrPathOrZipItem == "string") {path = dataOrPathOrZipItem;