Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tighten

Manav Rathifb7f64bd35a1
diff --git a/web/apps/photos/src/services/upload/takeout.ts b/web/apps/photos/src/services/upload/takeout.ts
index bd5e825380..44ca156d09 100644
--- a/web/apps/photos/src/services/upload/takeout.ts
+++ b/web/apps/photos/src/services/upload/takeout.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/dot-notation */
/** @file Dealing with the JSON metadata sidecar files */
import { ensureElectron } from "@/base/electron";
@@ -116,19 +117,19 @@ const parseMetadataJSONText = (text: string) => {
const parsedMetadataJSON: ParsedMetadataJSON = {};
parsedMetadataJSON.creationTime =
- parseGTTimestamp(metadataJSON.photoTakenTime) ??
- parseGTTimestamp(metadataJSON.creationTime);
+ parseGTTimestamp(metadataJSON["photoTakenTime"]) ??
+ parseGTTimestamp(metadataJSON["creationTime"]);
parsedMetadataJSON.modificationTime = parseGTTimestamp(
- metadataJSON.modificationTime,
+ metadataJSON["modificationTime"],
);
parsedMetadataJSON.location =
- parseGTLocation(metadataJSON.geoData) ??
- parseGTLocation(metadataJSON.geoDataExif);
+ parseGTLocation(metadataJSON["geoData"]) ??
+ parseGTLocation(metadataJSON["geoDataExif"]);
parsedMetadataJSON.description = parseGTNonEmptyString(
- metadataJSON.description,
+ metadataJSON["description"],
);
return parsedMetadataJSON;
diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.ts
index b7d712ba2b..6ef2e4e6c2 100644
--- a/web/apps/photos/tests/upload.test.ts
+++ b/web/apps/photos/tests/upload.test.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/dot-notation */
import { FileType } from "@/media/file-type";
import { groupFilesByCollectionID } from "@/new/photos/services/file";
import { getLocalFiles } from "@/new/photos/services/files";
@@ -211,9 +212,7 @@ async function thumbnailGenerationFailedFilesCheck(expectedState) {
}
fileNamesWithStaticThumbnail.forEach((fileName) => {
if (
- !expectedState.thumbnail_generation_failure.files.includes(
- fileName,
- )
+ !expectedState.thumbnail_generation_failure.files.includes(fileName)
) {
throw Error(
`thumbnailGenerationFailedFiles Check failed ❌
@@ -271,27 +270,27 @@ async function exifDataParsingCheck(expectedState) {
throw Error(`exifDataParsingCheck failed , ${fileName} missing`);
}
if (
- exifValues.creation_time &&
- exifValues.creation_time !== matchingFile.metadata.creationTime
+ exifValues["creation_time"] &&
+ exifValues["creation_time"] !== matchingFile.metadata.creationTime
) {
throw Error(`exifDataParsingCheck failed ❌ ,
for ${fileName}
- expected: ${exifValues.creation_time} got: ${matchingFile.metadata.creationTime}`);
+ expected: ${exifValues["creation_time"]} got: ${matchingFile.metadata.creationTime}`);
}
if (
- exifValues.location &&
+ exifValues["location"] &&
(Math.abs(
- exifValues.location.latitude -
+ exifValues["location"].latitude -
matchingFile.metadata.latitude,
) > 1 ||
Math.abs(
- exifValues.location.longitude -
+ exifValues["location"].longitude -
matchingFile.metadata.longitude,
) > 1)
) {
throw Error(`exifDataParsingCheck failed ❌ ,
for ${fileName}
- expected: ${JSON.stringify(exifValues.location)}
+ expected: ${JSON.stringify(exifValues["location"])}
got: [${matchingFile.metadata.latitude},${
matchingFile.metadata.longitude
}]`);
@@ -313,14 +312,14 @@ async function fileDimensionExtractionCheck(expectedState) {
);
}
if (
- dimensions.width &&
- dimensions.width !== matchingFile.pubMagicMetadata.data.w &&
- dimensions.height &&
- dimensions.height !== matchingFile.pubMagicMetadata.data.h
+ 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}`);
+ expected: ${dimensions["width"]} x ${dimensions["height"]} got: ${matchingFile.pubMagicMetadata.data.w} x ${matchingFile.pubMagicMetadata.data.h}`);
}
},
);
@@ -329,46 +328,41 @@ async function fileDimensionExtractionCheck(expectedState) {
async function googleMetadataReadingCheck(expectedState) {
const files = await getLocalFiles();
- Object.entries(expectedState.google_import).map(
- ([fileName, metadata]) => {
- const matchingFile = files.find(
- (file) => file.metadata.title === fileName,
- );
- if (!matchingFile) {
- throw Error(
- `exifDataParsingCheck failed , ${fileName} missing`,
- );
- }
- if (
- metadata.creation_time &&
- metadata.creation_time !== matchingFile.metadata.creationTime
- ) {
- throw Error(`googleMetadataJSON reading check failed ❌ ,
+ Object.entries(expectedState.google_import).map(([fileName, metadata]) => {
+ const matchingFile = files.find(
+ (file) => file.metadata.title === fileName,
+ );
+ if (!matchingFile) {
+ throw Error(`exifDataParsingCheck failed , ${fileName} missing`);
+ }
+ if (
+ metadata["creation_time"] &&
+ metadata["creation_time"] !== matchingFile.metadata.creationTime
+ ) {
+ throw Error(`googleMetadataJSON reading check failed ❌ ,
for ${fileName}
- expected: ${metadata.creation_time} got: ${matchingFile.metadata.creationTime}`);
- }
- if (
- metadata.location &&
- (Math.abs(
- metadata.location.latitude -
- matchingFile.metadata.latitude,
- ) > 1 ||
- Math.abs(
- metadata.location.longitude -
- matchingFile.metadata.longitude,
- ) > 1)
- ) {
- throw Error(`googleMetadataJSON reading check failed ❌ ,
+ expected: ${metadata["creation_time"]} got: ${matchingFile.metadata.creationTime}`);
+ }
+ if (
+ metadata["location"] &&
+ (Math.abs(
+ metadata["location"].latitude - matchingFile.metadata.latitude,
+ ) > 1 ||
+ Math.abs(
+ metadata["location"].longitude -
+ matchingFile.metadata.longitude,
+ ) > 1)
+ ) {
+ throw Error(`googleMetadataJSON reading check failed ❌ ,
for ${fileName}
expected: ${JSON.stringify(
- metadata.location,
+ metadata["location"],
)}
got: [${matchingFile.metadata.latitude},${
matchingFile.metadata.longitude
}]`);
- }
- },
- );
+ }
+ });
console.log("googleMetadataJSON reading check passed βœ…");
}
diff --git a/web/apps/photos/tsconfig.json b/web/apps/photos/tsconfig.json
index 07f7f2efcb..650d79ee4d 100644
--- a/web/apps/photos/tsconfig.json
+++ b/web/apps/photos/tsconfig.json
@@ -1,42 +1,20 @@
{
+ "extends": "@/build-config/tsconfig-next.json",
"compilerOptions": {
- "allowJs": true,
- "allowSyntheticDefaultImports": true,
- // "baseUrl": ".",
- "esModuleInterop": true,
- "forceConsistentCasingInFileNames": true,
- "incremental": true,
- "isolatedModules": true,
- // "jsx": "react-jsx",
- // "lib": ["dom", "dom.iterable", "esnext"],
- "module": "esnext",
- // "moduleResolution": "node",
- "noEmit": true,
- "noFallthroughCasesInSwitch": true,
- // "noImplicitAny": true,
- // "noUnusedLocals": true,
- // "noUnusedParameters": true,
- "resolveJsonModule": true,
- "skipLibCheck": true,
- "strict": true,
- // "target": "es2021",
+ /* Set the base directory from which to resolve bare module names. */
"baseUrl": "./src",
- "downlevelIteration": true,
- "jsx": "preserve",
- "lib": ["dom", "dom.iterable", "esnext", "webworker"],
+ /* MUI doesn't work with exactOptionalPropertyTypes yet. */
+ "exactOptionalPropertyTypes": false,
+
+ /* Override tsconfig-next.json (TODO: Remove me) */
+ "verbatimModuleSyntax": false,
+ /* Override tsconfig-next.json (TODO: Remove me) */
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
- "strictNullChecks": false,
- "target": "es5",
- "useUnknownInCatchVariables": false,
- /* TODO(MR): Add to auth */
- "moduleResolution": "bundler"
-
- // "paths": {
- // "@ente/eslint-config/*": ["./packages/eslint-config/*"],
- // "@ente/shared/*": ["./packages/shared/*"]
- // }
+ "noImplicitReturns": false,
+ "noUncheckedIndexedAccess": false,
+ "strictNullChecks": false
},
"include": [
"next-env.d.ts",