Add temporary gateways

This commit is contained in:
Manav Rathi 2024-04-08 20:45:29 +05:30
parent 3e3712efb3
commit a1c9ceae6b
No known key found for this signature in database
10 changed files with 13 additions and 38 deletions

View File

@ -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";

View File

@ -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>>>;

View File

@ -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 {

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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;

View File

@ -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);
}