π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove web trace upload envs
Manav Rathic2cf1e6b0dd4
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex fd723b90e7..00ae86bbbf 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -509,8 +509,6 @@ const Page: React.FC = () => {],);- if (process.env.NEXT_PUBLIC_ENTE_TRACE) console.log("render", state);-const router = useRouter();useEffect(() => {diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.tsindex daad91fa08..8d29e91cb1 100644--- a/web/apps/photos/tests/upload.test.ts+++ b/web/apps/photos/tests/upload.test.ts@@ -1,12 +1,6 @@-/* eslint-disable @typescript-eslint/no-unsafe-member-access */// TODO: Audit this file-/* eslint-disable @typescript-eslint/no-unsafe-call */-/* eslint-disable @typescript-eslint/no-unsafe-assignment */-/* eslint-disable @typescript-eslint/no-unsafe-argument *//* eslint-disable @typescript-eslint/ban-ts-comment */-/* eslint-disable @typescript-eslint/no-base-to-string *//* eslint-disable @typescript-eslint/restrict-template-expressions */-/* eslint-disable @typescript-eslint/dot-notation */// @ts-nocheckimport {parseDateFromDigitGroups,@@ -16,18 +10,6 @@ import {matchJSONMetadata,metadataJSONMapKeyForJSON,} from "ente-gallery/services/upload/metadata-json";-import { groupFilesByCollectionID } from "ente-gallery/utils/file";-import {- fileCreationTime,- fileFileName,- fileLocation,-} from "ente-media/file-metadata";-import { FileType } from "ente-media/file-type";-import {- savedCollectionFiles,- savedCollections,-} from "ente-new/photos/services/photos-fdb";-import { userDetailsSnapshot } from "ente-new/photos/services/user-details";const DATE_TIME_PARSING_TEST_FILE_NAMES = [{@@ -150,261 +132,13 @@ const fileNameToJSONMappingCases = [},];-export async function testUpload() {+export function testUpload() {try {parseDateTimeFromFileNameTest();fileNameToJSONMappingTests();} catch (e) {console.log(e);}-- const jsonString = process.env.NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON;- if (!jsonString) {- console.warn(- "Not running upload tests. Please specify the NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON to run the upload tests",- );- return;- }-- const expectedState = JSON.parse(jsonString);- if (!expectedState) throw Error("Invalid JSON");-- try {- await totalCollectionCountCheck(expectedState);- await collectionWiseFileCount(expectedState);- await thumbnailGenerationFailedFilesCheck(expectedState);- await livePhotoClubbingCheck(expectedState);- await exifDataParsingCheck(expectedState);- await fileDimensionExtractionCheck(expectedState);- await googleMetadataReadingCheck(expectedState);- totalFileCountCheck(expectedState);- } catch (e) {- console.log(e);- }-}--function totalFileCountCheck(expectedState) {- const userDetails = userDetailsSnapshot();- if (expectedState.total_file_count === userDetails.fileCount) {- console.log("file count check passed β ");- } else {- throw Error(- `total file count check failed β, expected: ${expectedState.total_file_count}, got: ${userDetails.fileCount}`,- );- }-}--async function totalCollectionCountCheck(expectedState) {- const collections = await savedCollections();- if (expectedState.collection_count === collections.length) {- console.log("collection count check passed β ");- } else {- throw Error(- `total Collection count check failed β- expected : ${expectedState.collection_count}, got: ${collections.length}`,- );- }-}--async function collectionWiseFileCount(expectedState) {- const files = await savedCollectionFiles();- const collections = await savedCollections();- const collectionToFilesMap = groupFilesByCollectionID(files);- const collectionIDToNameMap = new Map(- collections.map((collection) => [collection.id, collection.name]),- );- const collectionNameToFileCount = new Map(- [...collectionToFilesMap.entries()].map(([collectionID, files]) => [- collectionIDToNameMap.get(collectionID),- files.length,- ]),- );- Object.entries(expectedState.collection_files_count).forEach(- ([collectionName, fileCount]) => {- if (fileCount !== collectionNameToFileCount.get(collectionName)) {- throw Error(- `collectionWiseFileCount check failed β- for collection ${collectionName}- expected File count : ${fileCount} , got: ${collectionNameToFileCount.get(- collectionName,- )}`,- );- }- },- );- console.log("collection wise file count check passed β ");-}--async function thumbnailGenerationFailedFilesCheck(expectedState) {- const files = await savedCollectionFiles();- const filesWithStaticThumbnail = files.filter(- (file) => file.metadata.hasStaticThumbnail,- );-- const fileIDSet = new Set();- const uniqueFilesWithStaticThumbnail = filesWithStaticThumbnail.filter(- (file) => {- if (fileIDSet.has(file.id)) {- return false;- } else {- fileIDSet.add(file.id);- return true;- }- },- );- const fileNamesWithStaticThumbnail =- uniqueFilesWithStaticThumbnail.map(fileFileName);-- if (- expectedState.thumbnail_generation_failure.count <- uniqueFilesWithStaticThumbnail.length- ) {- throw Error(- `thumbnailGenerationFailedFiles Count Check failed β- expected: ${expectedState.thumbnail_generation_failure.count}, got: ${uniqueFilesWithStaticThumbnail.length}`,- );- }- fileNamesWithStaticThumbnail.forEach((fileName) => {- if (- !expectedState.thumbnail_generation_failure.files.includes(fileName)- ) {- throw Error(- `thumbnailGenerationFailedFiles Check failed β- expected: ${expectedState.thumbnail_generation_failure.files}, got: ${fileNamesWithStaticThumbnail}`,- );- }- });- console.log("thumbnail generation failure check passed β ");-}--async function livePhotoClubbingCheck(expectedState) {- const files = await savedCollectionFiles();- const livePhotos = files.filter(- (file) => file.metadata.fileType == FileType.livePhoto,- );-- const fileIDSet = new Set();- const uniqueLivePhotos = livePhotos.filter((file) => {- if (fileIDSet.has(file.id)) {- return false;- } else {- fileIDSet.add(file.id);- return true;- }- });-- const livePhotoFileNames = uniqueLivePhotos.map(fileFileName);-- if (expectedState.live_photo.count !== livePhotoFileNames.length) {- throw Error(- `livePhotoClubbing Check failed β- expected: ${expectedState.live_photo.count}, got: ${livePhotoFileNames.length}`,- );- }- expectedState.live_photo.files.forEach((fileName) => {- if (!livePhotoFileNames.includes(fileName)) {- throw Error(- `livePhotoClubbing Check failed β- expected: ${expectedState.live_photo.files}, got: ${livePhotoFileNames}`,- );- }- });- console.log("live-photo clubbing check passed β ");-}--async function exifDataParsingCheck(expectedState) {- const files = await savedCollectionFiles();- Object.entries(expectedState.exif).map(([fileName, exifValues]) => {- const matchingFile = files.find(- (file) => fileFileName(file) == fileName,- );- if (!matchingFile) {- throw Error(`exifDataParsingCheck failed , ${fileName} missing`);- }- if (- exifValues["creation_time"] &&- exifValues["creation_time"] !== fileCreationTime(matchingFile)- ) {- throw Error(`exifDataParsingCheck failed β ,- for ${fileName}- expected: ${exifValues["creation_time"]} got: ${fileCreationTime(matchingFile)}`);- }- if (!exifValues["location"]) return;- const location = fileLocation(matchingFile);- if (- !location ||- Math.abs(exifValues["location"].latitude - location.latitude) > 1 ||- Math.abs(exifValues["location"].longitude - location.longitude) > 1- ) {- throw Error(`exifDataParsingCheck failed β ,- for ${fileName}- expected: ${JSON.stringify(exifValues["location"])}- got: ${location}`);- }- });- console.log("exif data parsing check passed β ");-}--async function fileDimensionExtractionCheck(expectedState) {- const files = await savedCollectionFiles();- Object.entries(expectedState.file_dimensions).map(- ([fileName, dimensions]) => {- const matchingFile = files.find(- (file) => fileFileName(file) == fileName,- );- if (!matchingFile) {- throw Error(- `fileDimensionExtractionCheck failed , ${fileName} missing`,- );- }- if (- dimensions["width"] &&- dimensions["width"] !== matchingFile.pubMagicMetadata.data.w &&- dimensions["height"] &&- dimensions["height"] !== matchingFile.pubMagicMetadata.data.h- ) {- throw Error(`fileDimensionExtractionCheck failed β ,- for ${fileName}- expected: ${dimensions["width"]} x ${dimensions["height"]} got: ${matchingFile.pubMagicMetadata.data.w} x ${matchingFile.pubMagicMetadata.data.h}`);- }- },- );- console.log("file dimension extraction check passed β ");-}--async function googleMetadataReadingCheck(expectedState) {- const files = await savedCollectionFiles();- Object.entries(expectedState.google_import).map(([fileName, metadata]) => {- const matchingFile = files.find(- (file) => fileFileName(file) == fileName,- );- if (!matchingFile) {- throw Error(`exifDataParsingCheck failed , ${fileName} missing`);- }- if (- metadata["creation_time"] &&- metadata["creation_time"] !== fileCreationTime(matchingFile)- ) {- throw Error(`googleMetadataJSON reading check failed β ,- for ${fileName}- expected: ${metadata["creation_time"]} got: ${fileCreationTime(matchingFile)}`);- }- if (!metadata["location"]) return;- const location = fileLocation(matchingFile);- if (- !location ||- Math.abs(metadata["location"].latitude - location.latitude) > 1 ||- Math.abs(metadata["location"].longitude - location.longitude) > 1- ) {- throw Error(`googleMetadataJSON reading check failed β ,- for ${fileName}- expected: ${JSON.stringify(- metadata["location"],- )}- got: ${location}`);- }- });- console.log("googleMetadataJSON reading check passed β ");}function parseDateTimeFromFileNameTest() {diff --git a/web/packages/base/env.ts b/web/packages/base/env.tsindex 1bc75310bb..5ad22bcdb0 100644--- a/web/packages/base/env.ts+++ b/web/packages/base/env.ts@@ -5,7 +5,6 @@ declare const process: {readonly env: {readonly NODE_ENV: "development" | "production" | "test";readonly NEXT_PUBLIC_ENTE_ENDPOINT?: string;- readonly NEXT_PUBLIC_ENTE_TRACE?: string;readonly appName: string;readonly desktopAppVersion?: string;readonly gitSHA?: string;@@ -27,7 +26,6 @@ declare const process: {export const isDevBuild = process.env.NODE_ENV == "development";export const customAPIEndpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;-export const isTraceEnabled = !!process.env.NEXT_PUBLIC_ENTE_TRACE;export const buildAppName = process.env.appName;export const buildIsDesktop = process.env.isDesktop == "1";export const buildDesktopAppVersion = process.env.desktopAppVersion;diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 9decadb518..7afe060879 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -1,5 +1,4 @@import { type LocalUser } from "ente-accounts/services/user";-import { isTraceEnabled } from "ente-base/env";import {groupFilesByCollectionID,sortFiles,@@ -552,7 +551,6 @@ const galleryReducer: React.Reducer<GalleryState, GalleryAction> = (state,action,) => {- if (isTraceEnabled) console.log("dispatch", action);switch (action.type) {case "mount": {const { user, familyData } = action;