Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add temporary gateways

Manav Rathia1c9ceae6b93
diff --git a/web/apps/cast/src/pages/index.tsx b/web/apps/cast/src/pages/index.tsx
index e3e6b83fc8..ce3ec3763e 100644
--- a/web/apps/cast/src/pages/index.tsx
+++ b/web/apps/cast/src/pages/index.tsx
@@ -1,6 +1,6 @@
+import log from "@/next/log";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { boxSealOpen, toB64 } from "@ente/shared/crypto/internal/libsodium";
-import log from "@/next/log";
import castGateway from "@ente/shared/network/cast";
import LargeType from "components/LargeType";
import _sodium from "libsodium-wrappers";
diff --git a/web/apps/cast/src/utils/comlink/comlinkWorker.ts b/web/apps/cast/src/utils/comlink/comlinkWorker.ts
index 23360a4fec..ea8393b38b 100644
--- a/web/apps/cast/src/utils/comlink/comlinkWorker.ts
+++ b/web/apps/cast/src/utils/comlink/comlinkWorker.ts
@@ -1,5 +1,5 @@
-import { Remote, wrap } from "comlink";
import log from "@/next/log";
+import { Remote, wrap } from "comlink";
export class ComlinkWorker<T extends new () => InstanceType<T>> {
public remote: Promise<Remote<InstanceType<T>>>;
diff --git a/web/apps/photos/src/services/upload/fileService.ts b/web/apps/photos/src/services/upload/fileService.ts
index d9f402df45..b7c4dff3d9 100644
--- a/web/apps/photos/src/services/upload/fileService.ts
+++ b/web/apps/photos/src/services/upload/fileService.ts
@@ -1,5 +1,5 @@
+import { getFileNameSize } from "@/next/file";
import { addLogLine } from "@ente/shared/logging";
-import { getFileNameSize } from "@ente/shared/logging/web";
import { logError } from "@ente/shared/sentry";
import { FILE_READER_CHUNK_SIZE, MULTIPART_PART_SIZE } from "constants/upload";
import {
diff --git a/web/apps/photos/src/services/upload/hashService.tsx b/web/apps/photos/src/services/upload/hashService.tsx
index 17e1346b21..623bf86092 100644
--- a/web/apps/photos/src/services/upload/hashService.tsx
+++ b/web/apps/photos/src/services/upload/hashService.tsx
@@ -1,7 +1,7 @@
+import { getFileNameSize } from "@/next/file";
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
import { CustomError } from "@ente/shared/error";
import { addLogLine } from "@ente/shared/logging";
-import { getFileNameSize } from "@ente/shared/logging/web";
import { logError } from "@ente/shared/sentry";
import { Remote } from "comlink";
import { FILE_READER_CHUNK_SIZE } from "constants/upload";
diff --git a/web/apps/photos/src/services/upload/thumbnailService.ts b/web/apps/photos/src/services/upload/thumbnailService.ts
index 6bf4e0cfff..4c39d36ab3 100644
--- a/web/apps/photos/src/services/upload/thumbnailService.ts
+++ b/web/apps/photos/src/services/upload/thumbnailService.ts
@@ -1,8 +1,7 @@
import ElectronAPIs from "@/next/electron";
-import { convertBytesToHumanReadable } from "@/next/file";
+import { convertBytesToHumanReadable, getFileNameSize } from "@/next/file";
import { CustomError } from "@ente/shared/error";
import { addLogLine } from "@ente/shared/logging";
-import { getFileNameSize } from "@ente/shared/logging/web";
import { logError } from "@ente/shared/sentry";
import { FILE_TYPE } from "constants/file";
import { BLACK_THUMBNAIL_BASE64 } from "constants/upload";
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.ts
index 18676c0f57..ab135fd73b 100644
--- a/web/apps/photos/src/services/upload/uploadManager.ts
+++ b/web/apps/photos/src/services/upload/uploadManager.ts
@@ -24,10 +24,10 @@ import UIService from "./uiService";
import UploadService from "./uploadService";
import uploader from "./uploader";
+import { getFileNameSize } from "@/next/file";
import { getDedicatedCryptoWorker } from "@ente/shared/crypto";
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
import { addLogLine } from "@ente/shared/logging";
-import { getFileNameSize } from "@ente/shared/logging/web";
import { ComlinkWorker } from "@ente/shared/worker/comlinkWorker";
import { Remote } from "comlink";
import { UPLOAD_RESULT, UPLOAD_STAGES } from "constants/upload";
diff --git a/web/apps/photos/src/services/upload/videoMetadataService.ts b/web/apps/photos/src/services/upload/videoMetadataService.ts
index f23ab21fde..e687c51994 100644
--- a/web/apps/photos/src/services/upload/videoMetadataService.ts
+++ b/web/apps/photos/src/services/upload/videoMetadataService.ts
@@ -1,5 +1,5 @@
+import { getFileNameSize } from "@/next/file";
import { addLogLine } from "@ente/shared/logging";
-import { getFileNameSize } from "@ente/shared/logging/web";
import { logError } from "@ente/shared/sentry";
import { NULL_EXTRACTED_METADATA } from "constants/upload";
import * as ffmpegService from "services/ffmpeg/ffmpegService";
diff --git a/web/apps/photos/tests/zip-file-reading.test.ts b/web/apps/photos/tests/zip-file-reading.test.ts
index afc647634e..38be7ae754 100644
--- a/web/apps/photos/tests/zip-file-reading.test.ts
+++ b/web/apps/photos/tests/zip-file-reading.test.ts
@@ -1,5 +1,5 @@
import ElectronAPIs from "@/next/electron";
-import { getFileNameSize } from "@ente/shared/logging/web";
+import { getFileNameSize } from "@/next/file";
import { FILE_READER_CHUNK_SIZE, PICKED_UPLOAD_TYPE } from "constants/upload";
import isElectron from "is-electron";
import { getElectronFileStream, getFileStream } from "services/readerService";
diff --git a/web/packages/shared/crypto/helpers.ts b/web/packages/shared/crypto/helpers.ts
index ba659f9aa8..908c255d43 100644
--- a/web/packages/shared/crypto/helpers.ts
+++ b/web/packages/shared/crypto/helpers.ts
@@ -1,3 +1,4 @@
+import ElectronAPIs from "@/next/electron";
import { setRecoveryKey } from "@ente/accounts/api/user";
import { logError } from "@ente/shared/sentry";
import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage";
@@ -7,7 +8,6 @@ import { getActualKey } from "@ente/shared/user";
import { KeyAttributes } from "@ente/shared/user/types";
import isElectron from "is-electron";
import ComlinkCryptoWorker from ".";
-import ElectronAPIs from "@/next/electron";
import { addLogLine } from "../logging";
const LOGIN_SUB_KEY_LENGTH = 32;
diff --git a/web/packages/shared/logging/index.ts b/web/packages/shared/logging/index.ts
index 6a587a7272..b4d1373cfb 100644
--- a/web/packages/shared/logging/index.ts
+++ b/web/packages/shared/logging/index.ts
@@ -1,33 +1,9 @@
-import { inWorker, isDevBuild } from "@/next/env";
-import { logToDisk } from "@/next/log";
-import { workerBridge } from "@/next/worker/worker-bridge";
-import { logError } from "@ente/shared/sentry";
+import log from "@/next/log";
export function addLogLine(
- log: string | number | boolean,
+ msg: string | number | boolean,
...optionalParams: (string | number | boolean)[]
) {
- try {
- const completeLog = [log, ...optionalParams].join(" ");
- if (isDevBuild) {
- console.log(completeLog);
- }
- if (inWorker()) {
- workerBridge
- .logToDisk(completeLog)
- .catch((e) =>
- console.error(
- "Failed to log a message from worker",
- e,
- "\nThe message was",
- completeLog,
- ),
- );
- } else {
- logToDisk(completeLog);
- }
- } catch (e) {
- logError(e, "failed to addLogLine", undefined, true);
- // ignore
- }
+ const completeLog = [msg, ...optionalParams].join(" ");
+ log.info(completeLog);
}