Skip to content

armgit / ente

Public Imported from GitHub
0

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

Debugging code

Manav Rathi839727393b8f
diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts
index 2bb7d304cb..97721a13ad 100644
--- a/web/apps/photos/src/services/searchService.ts
+++ b/web/apps/photos/src/services/searchService.ts
@@ -419,12 +419,14 @@ function convertSuggestionToSearchQuery(option: Suggestion): Search {
async function getAllPeople(limit: number = undefined) {
if (!(await wipClusterEnable())) return [];
- const entityKey = await getEntityKey("person_v2" as EntityType);
- const peopleR = await personDiff(entityKey.data);
- const r = peopleR.length;
- log.debug(() => ["people", peopleR]);
+ if (Math.random() < 0.01) {
+ const entityKey = await getEntityKey("person" as EntityType);
+ const peopleR = await personDiff(entityKey.data);
+ const r = peopleR.length;
+ log.debug(() => ["people", peopleR]);
- if (r) return [];
+ if (r) return [];
+ }
let people: Array<Person> = []; // await mlIDbStorage.getAllPeople();
people = await wipCluster();
diff --git a/web/packages/new/photos/services/user-entity.ts b/web/packages/new/photos/services/user-entity.ts
index e7b08b822e..c6cca31cc6 100644
--- a/web/packages/new/photos/services/user-entity.ts
+++ b/web/packages/new/photos/services/user-entity.ts
@@ -2,7 +2,6 @@ import { decryptMetadataBytes } from "@/base/crypto/ente";
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
import { apiURL } from "@/base/origins";
import { z } from "zod";
-import { gunzip } from "./gzip";
/**
* User entities are predefined lists of otherwise arbitrary data that the user
@@ -11,11 +10,12 @@ import { gunzip } from "./gzip";
* e.g. location tags, people in their photos.
*/
export type EntityType =
+ | "person"
/**
* A new version of the Person entity where the data is gzipped before
* encryption.
*/
- "person_v2";
+ | "person_v2";
/**
* The maximum number of items to fetch in a single diff
@@ -124,11 +124,12 @@ export const userEntityDiff = async (
* time we checked.
*/
export const personDiff = async (entityKeyB64: string) => {
- const entities = await userEntityDiff("person_v2", 0, entityKeyB64);
+ const entities = await userEntityDiff("person", 0, entityKeyB64);
return Promise.all(
entities.map(async ({ data }) => {
if (!data) return undefined;
- return JSON.parse(await gunzip(data)) as unknown;
+ // return JSON.parse(await gunzip(data)) as unknown;
+ return JSON.parse(new TextDecoder().decode(data)) as unknown;
}),
);
};