diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts index 23e8604c23d25e3d2003d60ab4f7f3196341d0bc..0fdd10056ace45dda4567d3bd0c3f5df6b693cec 100644 --- a/desktop/src/main/ipc.ts +++ b/desktop/src/main/ipc.ts @@ -180,12 +180,12 @@ export const attachIPCHandlers = () => { ipcMain.handle( "saveStreamToDisk", - (_, path: string, fileStream: ReadableStream) => + (_, path: string, fileStream: ReadableStream) => saveStreamToDisk(path, fileStream), ); - ipcMain.handle("saveFileToDisk", (_, path: string, file: any) => - saveFileToDisk(path, file), + ipcMain.handle("saveFileToDisk", (_, path: string, contents: string) => + saveFileToDisk(path, contents), ); ipcMain.handle("readTextFile", (_, path: string) => readTextFile(path)); diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts index b4efd862eabd44bd8b9fdee1f5e7645b9d1bf2fa..0d2c8f7bf3b8e38319740f6823f5658a5ee4738e 100644 --- a/desktop/src/preload.ts +++ b/desktop/src/preload.ts @@ -32,9 +32,9 @@ * and when changing one of them, remember to see if the other two also need * changing: * - * - [renderer] web/packages/shared/electron/types.ts contains docs - * - [preload] desktop/src/preload.ts ↕︎ - * - [main] desktop/src/main/ipc.ts contains impl + * - [renderer] web/packages/next/types/electron.ts contains docs + * - [preload] desktop/src/preload.ts ↕︎ + * - [main] desktop/src/main/ipc.ts contains impl */ import { contextBridge, ipcRenderer } from "electron/renderer"; @@ -227,11 +227,11 @@ const checkExistsAndCreateDir = (dirPath: string): Promise => const saveStreamToDisk = ( path: string, - fileStream: ReadableStream, + fileStream: ReadableStream, ): Promise => ipcRenderer.invoke("saveStreamToDisk", path, fileStream); -const saveFileToDisk = (path: string, file: any): Promise => - ipcRenderer.invoke("saveFileToDisk", path, file); +const saveFileToDisk = (path: string, contents: string): Promise => + ipcRenderer.invoke("saveFileToDisk", path, contents); const readTextFile = (path: string): Promise => ipcRenderer.invoke("readTextFile", path); diff --git a/web/apps/photos/src/components/Directory/index.tsx b/web/apps/photos/src/components/Directory/index.tsx index a87202771836aaab377f3f71005085737f215347..154db456ec0c8ce722fe22d7853d50c33092b1b2 100644 --- a/web/apps/photos/src/components/Directory/index.tsx +++ b/web/apps/photos/src/components/Directory/index.tsx @@ -1,5 +1,5 @@ +import ElectronAPIs from "@/next/electron"; import LinkButton from "@ente/shared/components/LinkButton"; -import ElectronAPIs from "@ente/shared/electron"; import { logError } from "@ente/shared/sentry"; import { Tooltip } from "@mui/material"; import { styled } from "@mui/material/styles"; diff --git a/web/apps/photos/src/components/FilesDownloadProgress.tsx b/web/apps/photos/src/components/FilesDownloadProgress.tsx index 8c86f8757ffe1d908e9de9e8e9651023c33d4d17..1185cc61c1fe6b24cbba2eac6b181179b88f9c64 100644 --- a/web/apps/photos/src/components/FilesDownloadProgress.tsx +++ b/web/apps/photos/src/components/FilesDownloadProgress.tsx @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import Notification from "components/Notification"; import { t } from "i18next"; import isElectron from "is-electron"; diff --git a/web/apps/photos/src/components/Sidebar/DebugSection.tsx b/web/apps/photos/src/components/Sidebar/DebugSection.tsx index b2d07bb47d21a76abfdbbb0b40551408574d95f7..93967b8f8c9e1f69420cce5542068c5af3134849 100644 --- a/web/apps/photos/src/components/Sidebar/DebugSection.tsx +++ b/web/apps/photos/src/components/Sidebar/DebugSection.tsx @@ -3,7 +3,7 @@ import { AppContext } from "pages/_app"; import { useContext, useEffect, useState } from "react"; import { Trans } from "react-i18next"; -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { addLogLine } from "@ente/shared/logging"; import { getDebugLogs } from "@ente/shared/logging/web"; import { downloadAsFile } from "@ente/shared/utils"; diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx index f1d6d03ff38ca17907c0b194161d0b67f982de33..b1557c77b7d0db660a99be345f896c5325d0f44a 100644 --- a/web/apps/photos/src/components/Upload/Uploader.tsx +++ b/web/apps/photos/src/components/Upload/Uploader.tsx @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { CustomError } from "@ente/shared/error"; import { addLogLine } from "@ente/shared/logging"; import { logError } from "@ente/shared/sentry"; diff --git a/web/apps/photos/src/components/WatchFolder/index.tsx b/web/apps/photos/src/components/WatchFolder/index.tsx index ee002f3dcdaaa075f06fba53d6d42785a44884aa..9c8d536e003487a25f0422fa8cc2f7e6d6bf9ac6 100644 --- a/web/apps/photos/src/components/WatchFolder/index.tsx +++ b/web/apps/photos/src/components/WatchFolder/index.tsx @@ -6,8 +6,8 @@ import watchFolderService from "services/watchFolder/watchFolderService"; import { WatchMapping } from "types/watchFolder"; import { MappingList } from "./mappingList"; +import ElectronAPIs from "@/next/electron"; import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton"; -import ElectronAPIs from "@ente/shared/electron"; import UploadStrategyChoiceModal from "components/Upload/UploadStrategyChoiceModal"; import { PICKED_UPLOAD_TYPE, UPLOAD_STRATEGY } from "constants/upload"; import isElectron from "is-electron"; diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index b8b289c11dac52d64e6c3149a51797fcb6c91e17..dfcc0536d447b5b34adee08e6ed29b0e493eb71f 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -1,5 +1,7 @@ import { CustomHead } from "@/next/components/Head"; +import ElectronAPIs from "@/next/electron"; import { setupI18n } from "@/next/i18n"; +import { AppUpdateInfo } from "@/next/types/ipc"; import { APPS, APP_TITLES, @@ -20,8 +22,6 @@ import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { MessageContainer } from "@ente/shared/components/MessageContainer"; import AppNavbar from "@ente/shared/components/Navbar/app"; import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages"; -import ElectronAPIs from "@ente/shared/electron"; -import { AppUpdateInfo } from "@ente/shared/electron/types"; import { CustomError } from "@ente/shared/error"; import { Events, eventBus } from "@ente/shared/events"; import { useLocalState } from "@ente/shared/hooks/useLocalState"; diff --git a/web/apps/photos/src/pages/gallery/index.tsx b/web/apps/photos/src/pages/gallery/index.tsx index 5930dd30bedd4b17f9415704328148d856504456..606216afaec4d8b87b4dd541b60d6c2d8c94dc8f 100644 --- a/web/apps/photos/src/pages/gallery/index.tsx +++ b/web/apps/photos/src/pages/gallery/index.tsx @@ -89,9 +89,9 @@ import { splitNormalAndHiddenCollections, } from "utils/collection"; +import ElectronAPIs from "@/next/electron"; import { APPS } from "@ente/shared/apps/constants"; import { CenteredFlex } from "@ente/shared/components/Container"; -import ElectronAPIs from "@ente/shared/electron"; import useFileInput from "@ente/shared/hooks/useFileInput"; import useMemoSingleThreaded from "@ente/shared/hooks/useMemoSingleThreaded"; import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore"; diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx index c789e0ae46cdc63fdb4c118d07cd4e78321df5d0..1b46f199bcf5f95188f6102183a60c3788b48e6f 100644 --- a/web/apps/photos/src/pages/index.tsx +++ b/web/apps/photos/src/pages/index.tsx @@ -1,3 +1,4 @@ +import ElectronAPIs from "@/next/electron"; import Login from "@ente/accounts/components/Login"; import SignUp from "@ente/accounts/components/SignUp"; import { APPS } from "@ente/shared/apps/constants"; @@ -5,7 +6,6 @@ import { EnteLogo } from "@ente/shared/components/EnteLogo"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages"; import { saveKeyInSessionStore } from "@ente/shared/crypto/helpers"; -import ElectronAPIs from "@ente/shared/electron"; import { getAlbumsURL } from "@ente/shared/network/api"; import { logError } from "@ente/shared/sentry"; import localForage from "@ente/shared/storage/localForage"; diff --git a/web/apps/photos/src/services/clipService.ts b/web/apps/photos/src/services/clipService.ts index 71cc17131fa2ab6d9daeebd654adfc86807c8d3b..278c406d7df8a969d044213b8d91ec4ce7433eb9 100644 --- a/web/apps/photos/src/services/clipService.ts +++ b/web/apps/photos/src/services/clipService.ts @@ -1,5 +1,5 @@ +import ElectronAPIs from "@/next/electron"; import ComlinkCryptoWorker from "@ente/shared/crypto"; -import ElectronAPIs from "@ente/shared/electron"; import { CustomError } from "@ente/shared/error"; import { Events, eventBus } from "@ente/shared/events"; import { addLogLine } from "@ente/shared/logging"; diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.ts index 35d23b72afa7a279bec4ed8ea75d1d848a05496b..c1fa2cbe1b02739cf093a71b5b3aa320c8ca44bc 100644 --- a/web/apps/photos/src/services/export/index.ts +++ b/web/apps/photos/src/services/export/index.ts @@ -37,7 +37,7 @@ import { } from "utils/file"; import { decodeLivePhoto } from "../livePhotoService"; -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { CustomError } from "@ente/shared/error"; import { Events, eventBus } from "@ente/shared/events"; import { addLogLine } from "@ente/shared/logging"; diff --git a/web/apps/photos/src/services/ffmpeg/ffmpegFactory.ts b/web/apps/photos/src/services/ffmpeg/ffmpegFactory.ts index 040f15047bff33c3ede752b7bab895c816c4ae01..decd325218b09c3282c16f8f4d9c08006a0b5637 100644 --- a/web/apps/photos/src/services/ffmpeg/ffmpegFactory.ts +++ b/web/apps/photos/src/services/ffmpeg/ffmpegFactory.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import isElectron from "is-electron"; import { ElectronFile } from "types/upload"; import ComlinkFFmpegWorker from "utils/comlink/ComlinkFFmpegWorker"; diff --git a/web/apps/photos/src/services/importService.ts b/web/apps/photos/src/services/importService.ts index c663524b32108a907afb715c8a7db2724ccec5c6..833e1b3e203539d331d01c1c5a2ce92ccd9575cb 100644 --- a/web/apps/photos/src/services/importService.ts +++ b/web/apps/photos/src/services/importService.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { logError } from "@ente/shared/sentry"; import { PICKED_UPLOAD_TYPE } from "constants/upload"; import { Collection } from "types/collection"; diff --git a/web/apps/photos/src/services/upload/thumbnailService.ts b/web/apps/photos/src/services/upload/thumbnailService.ts index 61e42f9e9ca84781560ee61f3c7aec4980046011..788d110ce6e18ca8237085eb5a718d52c8718b6a 100644 --- a/web/apps/photos/src/services/upload/thumbnailService.ts +++ b/web/apps/photos/src/services/upload/thumbnailService.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { CustomError } from "@ente/shared/error"; import { addLogLine } from "@ente/shared/logging"; import { getFileNameSize } from "@ente/shared/logging/web"; diff --git a/web/apps/photos/src/services/watchFolder/watchFolderService.ts b/web/apps/photos/src/services/watchFolder/watchFolderService.ts index 8ebc38afdab5b2852df3b797af19d84ccc0c8485..184ba5256941ca26b68c9fbf16574aeebd2faba9 100644 --- a/web/apps/photos/src/services/watchFolder/watchFolderService.ts +++ b/web/apps/photos/src/services/watchFolder/watchFolderService.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { addLocalLog, addLogLine } from "@ente/shared/logging"; import { logError } from "@ente/shared/sentry"; import { UPLOAD_RESULT, UPLOAD_STRATEGY } from "constants/upload"; diff --git a/web/apps/photos/src/utils/collection/index.ts b/web/apps/photos/src/utils/collection/index.ts index bf9b7face0943fa09692ef8774a8b2332b588c4e..a2f066ac87259f226bf4d807bd9fbe90f37f7a40 100644 --- a/web/apps/photos/src/utils/collection/index.ts +++ b/web/apps/photos/src/utils/collection/index.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { CustomError } from "@ente/shared/error"; import { addLogLine } from "@ente/shared/logging"; import { getAlbumsURL } from "@ente/shared/network/api"; diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts index 2e02794c4058426e260070531fa32277f1a2eeba..b432ab4d5ee20da8ec57d822ca6807b6f1b50570 100644 --- a/web/apps/photos/src/utils/file/index.ts +++ b/web/apps/photos/src/utils/file/index.ts @@ -52,7 +52,7 @@ import { } from "services/fileService"; import { FileTypeInfo } from "types/upload"; -import { default as ElectronAPIs } from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { workerBridge } from "@ente/shared/worker/worker-bridge"; import { t } from "i18next"; import { getFileExportPath, getUniqueFileExportName } from "utils/export"; diff --git a/web/apps/photos/src/utils/ui/index.tsx b/web/apps/photos/src/utils/ui/index.tsx index 75b0cd23dc6fbe7e0bc5ab1d78bab8dc1c0f177c..d193ba960535217068f17a9c03f65a21a3d77abd 100644 --- a/web/apps/photos/src/utils/ui/index.tsx +++ b/web/apps/photos/src/utils/ui/index.tsx @@ -1,7 +1,7 @@ +import ElectronAPIs from "@/next/electron"; +import { AppUpdateInfo } from "@/next/types/ipc"; import { logoutUser } from "@ente/accounts/services/user"; import { DialogBoxAttributes } from "@ente/shared/components/DialogBox/types"; -import ElectronAPIs from "@ente/shared/electron"; -import { AppUpdateInfo } from "@ente/shared/electron/types"; import AutoAwesomeOutlinedIcon from "@mui/icons-material/AutoAwesomeOutlined"; import InfoOutlined from "@mui/icons-material/InfoRounded"; import { Link } from "@mui/material"; diff --git a/web/apps/photos/tests/zip-file-reading.test.ts b/web/apps/photos/tests/zip-file-reading.test.ts index 0152e58972a1dc0e4f2d0c516923d1f21584eec5..afc647634eec05c4428ac95421fcbfc671685ed6 100644 --- a/web/apps/photos/tests/zip-file-reading.test.ts +++ b/web/apps/photos/tests/zip-file-reading.test.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { getFileNameSize } from "@ente/shared/logging/web"; import { FILE_READER_CHUNK_SIZE, PICKED_UPLOAD_TYPE } from "constants/upload"; import isElectron from "is-electron"; diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx index 3ce2a9c274e188a89f3bf8382729771c19170b64..98a78c1b49ce9db5b3ae5a524ae781cb92f5ecf8 100644 --- a/web/packages/accounts/pages/credentials.tsx +++ b/web/packages/accounts/pages/credentials.tsx @@ -24,6 +24,7 @@ import { PAGES } from "../constants/pages"; import { generateSRPSetupAttributes } from "../services/srp"; import { logoutUser } from "../services/user"; +import ElectronAPIs from "@/next/electron"; import { APP_HOMES } from "@ente/shared/apps/constants"; import { PageProps } from "@ente/shared/apps/types"; import { VerticallyCentered } from "@ente/shared/components/Container"; @@ -37,7 +38,6 @@ import VerifyMasterPasswordForm, { } from "@ente/shared/components/VerifyMasterPasswordForm"; import ComlinkCryptoWorker from "@ente/shared/crypto"; import { B64EncryptionResult } from "@ente/shared/crypto/types"; -import ElectronAPIs from "@ente/shared/electron"; import { CustomError } from "@ente/shared/error"; import { addLocalLog } from "@ente/shared/logging"; import { getAccountsURL } from "@ente/shared/network/api"; diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.ts index 4fb56db63406b3352a2c2fd161015ffadbfe3da9..6a2da8521d10ac575d23ca60553e31e09f4cfbb6 100644 --- a/web/packages/accounts/services/user.ts +++ b/web/packages/accounts/services/user.ts @@ -1,4 +1,4 @@ -import ElectronAPIs from "@ente/shared/electron"; +import ElectronAPIs from "@/next/electron"; import { Events, eventBus } from "@ente/shared/events"; import { logError } from "@ente/shared/sentry"; import InMemoryStore from "@ente/shared/storage/InMemoryStore"; diff --git a/web/packages/next/electron.ts b/web/packages/next/electron.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f02bf799735a00f1d8d8694c49d59c10ecc23d4 --- /dev/null +++ b/web/packages/next/electron.ts @@ -0,0 +1,10 @@ +import type { ElectronAPIsType } from "./types/ipc"; + +// TODO (MR): +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const ElectronAPIs = (globalThis as unknown as any)[ + // eslint-disable-next-line @typescript-eslint/dot-notation, @typescript-eslint/no-unsafe-member-access + "ElectronAPIs" +] as ElectronAPIsType; + +export default ElectronAPIs; diff --git a/web/packages/shared/upload/types.ts b/web/packages/next/types/file.ts similarity index 53% rename from web/packages/shared/upload/types.ts rename to web/packages/next/types/file.ts index d9811bef9925f57675378a4c3e93719c5a90ba53..e7d3ced5aa5f38cc8d12166960ce23a7e1a71e15 100644 --- a/web/packages/shared/upload/types.ts +++ b/web/packages/next/types/file.ts @@ -1,3 +1,8 @@ +export enum UPLOAD_STRATEGY { + SINGLE_COLLECTION, + COLLECTION_PER_FOLDER, +} + /* * ElectronFile is a custom interface that is used to represent * any file on disk as a File-like object in the Electron desktop app. @@ -20,3 +25,25 @@ export interface DataStream { stream: ReadableStream; chunkCount: number; } + +export interface WatchMappingSyncedFile { + path: string; + uploadedFileID: number; + collectionID: number; +} + +export interface WatchMapping { + rootFolderName: string; + folderPath: string; + uploadStrategy: UPLOAD_STRATEGY; + syncedFiles: WatchMappingSyncedFile[]; + ignoredFiles: string[]; +} + +export interface EventQueueItem { + type: "upload" | "trash"; + folderPath: string; + collectionName?: string; + paths?: string[]; + files?: ElectronFile[]; +} diff --git a/web/packages/shared/electron/types.ts b/web/packages/next/types/ipc.ts similarity index 96% rename from web/packages/shared/electron/types.ts rename to web/packages/next/types/ipc.ts index b48ab3bd33f34d088f9efe18b6f1d6a406461947..46c4a4293ae8408642607e6ac836b29cd2f9500a 100644 --- a/web/packages/shared/electron/types.ts +++ b/web/packages/next/types/ipc.ts @@ -3,8 +3,7 @@ // // See [Note: types.ts <-> preload.ts <-> ipc.ts] -import type { ElectronFile } from "@ente/shared/upload/types"; -import type { WatchMapping } from "@ente/shared/watchFolder/types"; +import type { ElectronFile, WatchMapping } from "./file"; export interface AppUpdateInfo { autoUpdatable: boolean; @@ -199,9 +198,9 @@ export interface ElectronAPIsType { checkExistsAndCreateDir: (dirPath: string) => Promise; saveStreamToDisk: ( path: string, - fileStream: ReadableStream, + fileStream: ReadableStream, ) => Promise; - saveFileToDisk: (path: string, file: any) => Promise; + saveFileToDisk: (path: string, contents: string) => Promise; readTextFile: (path: string) => Promise; isFolder: (dirPath: string) => Promise; moveFile: (oldPath: string, newPath: string) => Promise; diff --git a/web/packages/shared/components/Directory/index.tsx b/web/packages/shared/components/Directory/index.tsx index a87202771836aaab377f3f71005085737f215347..154db456ec0c8ce722fe22d7853d50c33092b1b2 100644 --- a/web/packages/shared/components/Directory/index.tsx +++ b/web/packages/shared/components/Directory/index.tsx @@ -1,5 +1,5 @@ +import ElectronAPIs from "@/next/electron"; import LinkButton from "@ente/shared/components/LinkButton"; -import ElectronAPIs from "@ente/shared/electron"; import { logError } from "@ente/shared/sentry"; import { Tooltip } from "@mui/material"; import { styled } from "@mui/material/styles"; diff --git a/web/packages/shared/crypto/helpers.ts b/web/packages/shared/crypto/helpers.ts index a29dc465f5b53b6d5f33c1059c803986c9f1ddcf..ba659f9aa890efd2d8500035b266c5d78611ce9e 100644 --- a/web/packages/shared/crypto/helpers.ts +++ b/web/packages/shared/crypto/helpers.ts @@ -7,7 +7,7 @@ import { getActualKey } from "@ente/shared/user"; import { KeyAttributes } from "@ente/shared/user/types"; import isElectron from "is-electron"; import ComlinkCryptoWorker from "."; -import ElectronAPIs from "../electron"; +import ElectronAPIs from "@/next/electron"; import { addLogLine } from "../logging"; const LOGIN_SUB_KEY_LENGTH = 32; diff --git a/web/packages/shared/crypto/types.ts b/web/packages/shared/crypto/types.ts index 2eeea70272426e0236b6d491c53899ecb42d32ec..4cf4c56b1f869a33f1784b81c1be74717c83ebe9 100644 --- a/web/packages/shared/crypto/types.ts +++ b/web/packages/shared/crypto/types.ts @@ -1,4 +1,4 @@ -import { DataStream } from "@ente/shared/upload/types"; +import { DataStream } from "@/next/types/file"; export interface LocalFileAttributes< T extends string | Uint8Array | DataStream, diff --git a/web/packages/shared/electron/index.ts b/web/packages/shared/electron/index.ts deleted file mode 100644 index 38e38e3a40f1ec1f04d03f92b29e649874173ac4..0000000000000000000000000000000000000000 --- a/web/packages/shared/electron/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ElectronAPIsType } from "./types"; - -const ElectronAPIs: ElectronAPIsType = globalThis["ElectronAPIs"]; - -export default ElectronAPIs; diff --git a/web/packages/shared/logging/index.ts b/web/packages/shared/logging/index.ts index db9938300f6c6158dd5fae0cd58d0453a4219bef..961b2d3a0db18966c50e5e2f5da8dcb82903e3fe 100644 --- a/web/packages/shared/logging/index.ts +++ b/web/packages/shared/logging/index.ts @@ -1,7 +1,7 @@ import { inWorker, isDevBuild } from "@/next/env"; import { logError } from "@ente/shared/sentry"; import isElectron from "is-electron"; -import ElectronAPIs from "../electron"; +import ElectronAPIs from "@/next/electron"; import { workerBridge } from "../worker/worker-bridge"; import { formatLog, logWeb } from "./web"; diff --git a/web/packages/shared/logging/web.ts b/web/packages/shared/logging/web.ts index 69e00533e11ef8f3de735df211624428013f61d7..fe54931fc9e396839e6829552ab56d3d06330015 100644 --- a/web/packages/shared/logging/web.ts +++ b/web/packages/shared/logging/web.ts @@ -1,4 +1,5 @@ import { isDevBuild } from "@/next/env"; +import { ElectronFile } from "@/next/types/file"; import { logError } from "@ente/shared/sentry"; import { LS_KEYS, @@ -8,7 +9,6 @@ import { } from "@ente/shared/storage/localStorage"; import { addLogLine } from "."; import { formatDateTimeShort } from "../time/format"; -import { ElectronFile } from "../upload/types"; import type { User } from "../user/types"; import { convertBytesToHumanReadable } from "../utils/size"; diff --git a/web/packages/shared/upload/constants.ts b/web/packages/shared/upload/constants.ts deleted file mode 100644 index aaa7f60d204c1d20de06897bb20e403f23dfa13e..0000000000000000000000000000000000000000 --- a/web/packages/shared/upload/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum UPLOAD_STRATEGY { - SINGLE_COLLECTION, - COLLECTION_PER_FOLDER, -} diff --git a/web/packages/shared/watchFolder/types.ts b/web/packages/shared/watchFolder/types.ts index bea23247ab4ef536a9a138537c7cd319c60ef66b..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/web/packages/shared/watchFolder/types.ts +++ b/web/packages/shared/watchFolder/types.ts @@ -1,24 +0,0 @@ -import { UPLOAD_STRATEGY } from "@ente/shared/upload/constants"; -import { ElectronFile } from "@ente/shared/upload/types"; - -export interface WatchMappingSyncedFile { - path: string; - uploadedFileID: number; - collectionID: number; -} - -export interface WatchMapping { - rootFolderName: string; - folderPath: string; - uploadStrategy: UPLOAD_STRATEGY; - syncedFiles: WatchMappingSyncedFile[]; - ignoredFiles: string[]; -} - -export interface EventQueueItem { - type: "upload" | "trash"; - folderPath: string; - collectionName?: string; - paths?: string[]; - files?: ElectronFile[]; -} diff --git a/web/packages/shared/worker/comlinkWorker.ts b/web/packages/shared/worker/comlinkWorker.ts index f8e72778fdeedf6369eebb1224ff09b199df48c1..b1d9d4fde85d18d1f25a4ca191375315d3ac29a5 100644 --- a/web/packages/shared/worker/comlinkWorker.ts +++ b/web/packages/shared/worker/comlinkWorker.ts @@ -1,6 +1,6 @@ import { addLocalLog, logToDisk } from "@ente/shared/logging"; import { Remote, expose, wrap } from "comlink"; -import ElectronAPIs from "../electron"; +import ElectronAPIs from "@/next/electron"; import { logError } from "../sentry"; export class ComlinkWorker InstanceType> {