π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove stale 2024 desktop migration code now that 1.6 is gone
Manav Rathi76d9a9c75321
diff --git a/desktop/src/main.ts b/desktop/src/main.tsindex 9961c64364..20676fec7a 100644--- a/desktop/src/main.ts+++ b/desktop/src/main.ts@@ -22,7 +22,6 @@ import {} from "electron/main";import serveNextAt from "next-electron-server";import { existsSync } from "node:fs";-import fs from "node:fs/promises";import os from "node:os";import path from "node:path";import {@@ -157,15 +156,6 @@ const main = () => {Menu.setApplicationMenu(createApplicationMenu(mainWindow));setupTrayItem(mainWindow);setupAutoUpdater(mainWindow);-- try {- await deleteLegacyDiskCacheDirIfExists();- await deleteLegacyKeysStoreIfExists();- } catch (e) {- // Log but otherwise ignore errors during non-critical startup- // actions.- log.error("Ignoring startup error", e);- }})();});@@ -747,67 +737,5 @@ const setupTrayItem = (mainWindow: BrowserWindow) => {}};-/**- * Older versions of our app used to maintain a cache dir using the main- * process. This has been removed in favor of cache on the web layer. Delete the- * old cache dir if it exists.- *- * Added May 2024, v1.7.0. This migration code can be removed after some time- * once most people have upgraded to newer versions (tag: Migration).- */-const deleteLegacyDiskCacheDirIfExists = async () => {- const removeIfExists = async (dirPath: string) => {- if (existsSync(dirPath)) {- log.info(`Removing legacy disk cache from ${dirPath}`);- await fs.rm(dirPath, { recursive: true });- }- };-- // [Note: Getting the cache path]- //- // The existing code was passing "cache" as a parameter to getPath.- //- // However, "cache" is not a valid parameter to getPath. It works (for- // example, on macOS I get `~/Library/Caches`), but it is intentionally not- // documented as part of the public API:- //- // - docs: remove "cache" from app.getPath- // https://github.com/electron/electron/pull/33509- //- // Irrespective, we replicate the original behaviour so that we get back the- // same path that the old code was getting.- //- // @ts-expect-error "cache" works but is not part of the public API.- const cacheDir = path.join(app.getPath("cache"), "ente");- if (process.platform == "win32") {- // On Windows the cache dir is the same as the app data (!). So deleting- // the ente subfolder of the cache dir is equivalent to deleting the- // user data dir.- //- // Obviously, that's not good. So instead of Windows we explicitly- // delete the named cache directories.- await removeIfExists(path.join(cacheDir, "thumbs"));- await removeIfExists(path.join(cacheDir, "files"));- await removeIfExists(path.join(cacheDir, "face-crops"));- } else {- await removeIfExists(cacheDir);- }-};--/**- * Older versions of our app used to keep a keys.json. It is not needed anymore,- * remove it if it exists.- *- * This code was added March 2024, and can be removed after some time once most- * people have upgraded to newer versions.- */-const deleteLegacyKeysStoreIfExists = async () => {- const keysStore = path.join(app.getPath("userData"), "keys.json");- if (existsSync(keysStore)) {- log.info(`Removing legacy keys store at ${keysStore}`);- await fs.rm(keysStore);- }-};-// Go for it.main();diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.tsindex 0cd93bc6e7..192f20d433 100644--- a/desktop/src/main/services/upload.ts+++ b/desktop/src/main/services/upload.ts@@ -62,37 +62,15 @@ export const pathOrZipItemSize = async (}};-export const pendingUploads = async (): Promise<PendingUploads | undefined> => {+export const pendingUploads = (): PendingUploads | undefined => {const collectionName = uploadStatusStore.get("collectionName") ?? undefined;const allFilePaths = uploadStatusStore.get("filePaths") ?? [];const filePaths = allFilePaths.filter((f) => existsSync(f));- const allZipItems = uploadStatusStore.get("zipItems");- let zipItems: ZipItem[] = [];- let skippedFiles: SkippedFile[] = [];-- // Migration code - May 2024. Remove after a bit (tag: Migration).- //- // The older store formats will not have zipItems and instead will have- // zipPaths. If we find such a case, read the zipPaths and enqueue all of- // their files as zipItems in the result.- //- // This potentially can be cause us to try reuploading an already uploaded- // file, but the dedup logic will kick in at that point so no harm will come- // of it.- if (allZipItems === undefined) {- const allZipPaths = uploadStatusStore.get("zipPaths") ?? [];- const zipPaths = allZipPaths.filter((f) => existsSync(f));- for (const zip of zipPaths) {- const result = await listZipItems(zip);- zipItems = zipItems.concat(result.items);- skippedFiles = skippedFiles.concat(result.skippedFiles);- }- } else {- zipItems = allZipItems.filter(([z]) => existsSync(z));- skippedFiles = uploadStatusStore.get("skippedFiles") ?? [];- }+ const allZipItems = uploadStatusStore.get("zipItems") ?? [];+ const zipItems = allZipItems.filter(([z]) => existsSync(z));+ const skippedFiles = uploadStatusStore.get("skippedFiles") ?? [];if (filePaths.length == 0 && zipItems.length == 0) return undefined;