Skip to content

armgit / ente

Public Imported from GitHub
0

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

Auto fix

Manav Rathi8f0efb41fee4
diff --git a/web/apps/photos/eslint.config.mjs b/web/apps/photos/eslint.config.mjs
index ecb708ae7f..b0153b57e2 100644
--- a/web/apps/photos/eslint.config.mjs
+++ b/web/apps/photos/eslint.config.mjs
@@ -26,7 +26,6 @@ export default [
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/no-useless-constructor": "off",
- "@typescript-eslint/dot-notation": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-optional-chain": "off",
diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
index af81944ee2..68feb8add9 100644
--- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
@@ -42,7 +42,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
useEffect(() => {
castGateway.revokeAllTokens();
- setBrowserCanCast(typeof window["chrome"] !== "undefined");
+ setBrowserCanCast(typeof window.chrome !== "undefined");
}, []);
const onSubmit: SingleInputFormProps["callback"] = async (
diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
index 82845fe728..0369a70eb1 100644
--- a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx
@@ -359,14 +359,14 @@ const parseExifInfo = (
if (exif) {
if (exif.Make && exif.Model)
- info["takenOnDevice"] =
+ info.takenOnDevice =
`${exif.Make.description} ${exif.Model.description}`;
if (exif.FNumber)
info.fNumber = exif.FNumber.description; /* e.g. "f/16" */
if (exif.ExposureTime)
- info["exposureTime"] = exif.ExposureTime.description; /* "1/10" */
+ info.exposureTime = exif.ExposureTime.description; /* "1/10" */
if (exif.ISOSpeedRatings)
info.iso = `ISO${tagNumericValue(exif.ISOSpeedRatings)}`;
diff --git a/web/apps/photos/src/services/upload/publicUploadHttpClient.ts b/web/apps/photos/src/services/upload/publicUploadHttpClient.ts
index 2b7a4d480e..3019025627 100644
--- a/web/apps/photos/src/services/upload/publicUploadHttpClient.ts
+++ b/web/apps/photos/src/services/upload/publicUploadHttpClient.ts
@@ -63,7 +63,7 @@ class PublicUploadHttpClient {
},
);
const response = await this.uploadURLFetchInProgress;
- for (const url of response.data["urls"]) {
+ for (const url of response.data.urls) {
urlStore.push(url);
}
} finally {
@@ -99,7 +99,7 @@ class PublicUploadHttpClient {
},
);
- return response.data["urls"];
+ return response.data.urls;
} catch (e) {
log.error("fetch public multipart-upload-url failed", e);
throw e;
diff --git a/web/apps/photos/src/services/upload/takeout.ts b/web/apps/photos/src/services/upload/takeout.ts
index bb30ed11d7..bd5e825380 100644
--- a/web/apps/photos/src/services/upload/takeout.ts
+++ b/web/apps/photos/src/services/upload/takeout.ts
@@ -116,19 +116,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/src/services/upload/uploadHttpClient.ts b/web/apps/photos/src/services/upload/uploadHttpClient.ts
index dce8bc4ca6..98b5a7cc0f 100644
--- a/web/apps/photos/src/services/upload/uploadHttpClient.ts
+++ b/web/apps/photos/src/services/upload/uploadHttpClient.ts
@@ -47,7 +47,7 @@ class UploadHttpClient {
{ "X-Auth-Token": token },
);
const response = await this.uploadURLFetchInProgress;
- for (const url of response.data["urls"]) {
+ for (const url of response.data.urls) {
urlStore.push(url);
}
} finally {
@@ -77,7 +77,7 @@ class UploadHttpClient {
{ "X-Auth-Token": token },
);
- return response.data["urls"];
+ return response.data.urls;
} catch (e) {
log.error("fetch multipart-upload-url failed", e);
throw e;
diff --git a/web/apps/photos/src/services/userService.ts b/web/apps/photos/src/services/userService.ts
index 1d66bda69b..d2b60a0301 100644
--- a/web/apps/photos/src/services/userService.ts
+++ b/web/apps/photos/src/services/userService.ts
@@ -36,7 +36,7 @@ export const isTokenValid = async (token: string) => {
if (resp.data[HAS_SET_KEYS] === undefined) {
throw Error("resp.data.hasSetKey undefined");
}
- if (!resp.data["hasSetKeys"]) {
+ if (!resp.data.hasSetKeys) {
try {
await putAttributes(
token,
diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.ts
index 139756112f..b7d712ba2b 100644
--- a/web/apps/photos/tests/upload.test.ts
+++ b/web/apps/photos/tests/upload.test.ts
@@ -129,23 +129,23 @@ export async function testUpload() {
async function totalFileCountCheck(expectedState) {
const userDetails = await getUserDetailsV2();
- if (expectedState["total_file_count"] === userDetails.fileCount) {
+ 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}`,
+ `total file count check failed ❌, expected: ${expectedState.total_file_count}, got: ${userDetails.fileCount}`,
);
}
}
async function totalCollectionCountCheck(expectedState) {
const collections = await getLocalCollections();
- if (expectedState["collection_count"] === collections.length) {
+ 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}`,
+ expected : ${expectedState.collection_count}, got: ${collections.length}`,
);
}
}
@@ -163,7 +163,7 @@ async function collectionWiseFileCount(expectedState) {
files.length,
]),
);
- Object.entries(expectedState["collection_files_count"]).forEach(
+ Object.entries(expectedState.collection_files_count).forEach(
([collectionName, fileCount]) => {
if (fileCount !== collectionNameToFileCount.get(collectionName)) {
throw Error(
@@ -201,23 +201,23 @@ async function thumbnailGenerationFailedFilesCheck(expectedState) {
);
if (
- expectedState["thumbnail_generation_failure"]["count"] <
+ expectedState.thumbnail_generation_failure.count <
uniqueFilesWithStaticThumbnail.length
) {
throw Error(
`thumbnailGenerationFailedFiles Count Check failed ❌
- expected: ${expectedState["thumbnail_generation_failure"]["count"]}, got: ${uniqueFilesWithStaticThumbnail.length}`,
+ expected: ${expectedState.thumbnail_generation_failure.count}, got: ${uniqueFilesWithStaticThumbnail.length}`,
);
}
fileNamesWithStaticThumbnail.forEach((fileName) => {
if (
- !expectedState["thumbnail_generation_failure"]["files"].includes(
+ !expectedState.thumbnail_generation_failure.files.includes(
fileName,
)
) {
throw Error(
`thumbnailGenerationFailedFiles Check failed ❌
- expected: ${expectedState["thumbnail_generation_failure"]["files"]}, got: ${fileNamesWithStaticThumbnail}`,
+ expected: ${expectedState.thumbnail_generation_failure.files}, got: ${fileNamesWithStaticThumbnail}`,
);
}
});
@@ -244,17 +244,17 @@ async function livePhotoClubbingCheck(expectedState) {
(file) => file.metadata.title,
);
- if (expectedState["live_photo"]["count"] !== livePhotoFileNames.length) {
+ if (expectedState.live_photo.count !== livePhotoFileNames.length) {
throw Error(
`livePhotoClubbing Check failed ❌
- expected: ${expectedState["live_photo"]["count"]}, got: ${livePhotoFileNames.length}`,
+ expected: ${expectedState.live_photo.count}, got: ${livePhotoFileNames.length}`,
);
}
- expectedState["live_photo"]["files"].forEach((fileName) => {
+ expectedState.live_photo.files.forEach((fileName) => {
if (!livePhotoFileNames.includes(fileName)) {
throw Error(
`livePhotoClubbing Check failed ❌
- expected: ${expectedState["live_photo"]["files"]}, got: ${livePhotoFileNames}`,
+ expected: ${expectedState.live_photo.files}, got: ${livePhotoFileNames}`,
);
}
});
@@ -263,7 +263,7 @@ async function livePhotoClubbingCheck(expectedState) {
async function exifDataParsingCheck(expectedState) {
const files = await getLocalFiles();
- Object.entries(expectedState["exif"]).map(([fileName, exifValues]) => {
+ Object.entries(expectedState.exif).map(([fileName, exifValues]) => {
const matchingFile = files.find(
(file) => file.metadata.title === fileName,
);
@@ -271,27 +271,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
}]`);
@@ -302,7 +302,7 @@ async function exifDataParsingCheck(expectedState) {
async function fileDimensionExtractionCheck(expectedState) {
const files = await getLocalFiles();
- Object.entries(expectedState["file_dimensions"]).map(
+ Object.entries(expectedState.file_dimensions).map(
([fileName, dimensions]) => {
const matchingFile = files.find(
(file) => file.metadata.title === fileName,
@@ -313,14 +313,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,7 +329,7 @@ async function fileDimensionExtractionCheck(expectedState) {
async function googleMetadataReadingCheck(expectedState) {
const files = await getLocalFiles();
- Object.entries(expectedState["google_import"]).map(
+ Object.entries(expectedState.google_import).map(
([fileName, metadata]) => {
const matchingFile = files.find(
(file) => file.metadata.title === fileName,
@@ -340,28 +340,28 @@ async function googleMetadataReadingCheck(expectedState) {
);
}
if (
- metadata["creation_time"] &&
- metadata["creation_time"] !== matchingFile.metadata.creationTime
+ 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}`);
+ expected: ${metadata.creation_time} got: ${matchingFile.metadata.creationTime}`);
}
if (
- metadata["location"] &&
+ metadata.location &&
(Math.abs(
- metadata["location"]["latitude"] -
+ metadata.location.latitude -
matchingFile.metadata.latitude,
) > 1 ||
Math.abs(
- metadata["location"]["longitude"] -
+ 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