π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove legacy desktop watch store migration
Manav Rathi95db50a0859a
diff --git a/desktop/src/main.ts b/desktop/src/main.tsindex 20676fec7a..9994d47fe1 100644--- a/desktop/src/main.ts+++ b/desktop/src/main.ts@@ -37,7 +37,6 @@ import autoLauncher from "./main/services/auto-launcher";import { shouldHideDockIcon } from "./main/services/store";import { createWatcher } from "./main/services/watch";import { userPreferences } from "./main/stores/user-preferences";-import { migrateLegacyWatchStoreIfNeeded } from "./main/stores/watch";import { registerStreamProtocol } from "./main/stream";import { wait } from "./main/utils/common";import { isDev } from "./main/utils/electron";@@ -91,7 +90,6 @@ const main = () => {// The order of the next two calls is importantsetupRendererServer();registerPrivilegedSchemes();- migrateLegacyWatchStoreIfNeeded();/*** Handle an open URL request, but ensuring that we have a mainWindow.diff --git a/desktop/src/main/stores/watch.ts b/desktop/src/main/stores/watch.tsindex 768b9b71a8..784b2ee80e 100644--- a/desktop/src/main/stores/watch.ts+++ b/desktop/src/main/stores/watch.ts@@ -1,27 +1,17 @@import Store, { Schema } from "electron-store";import { type FolderWatch } from "../../types/ipc";-import log from "../log";interface WatchStore {- mappings?: FolderWatchWithLegacyFields[];+ mappings?: FolderWatch[];}-type FolderWatchWithLegacyFields = FolderWatch & {- /** @deprecated Only retained for migration, do not use in other code */- rootFolderName?: string;- /** @deprecated Only retained for migration, do not use in other code */- uploadStrategy?: number;-};-const watchStoreSchema: Schema<WatchStore> = {mappings: {type: "array",items: {type: "object",properties: {- rootFolderName: { type: "string" },collectionMapping: { type: "string" },- uploadStrategy: { type: "number" },folderPath: { type: "string" },syncedFiles: {type: "array",@@ -44,34 +34,3 @@ export const watchStore = new Store({name: "watch-status",schema: watchStoreSchema,});--/**- * Previous versions of the store used to store an integer to indicate the- * collection mapping, migrate these to the new schema if we encounter them.- */-export const migrateLegacyWatchStoreIfNeeded = () => {- let needsUpdate = false;- const updatedWatches = [];- for (const watch of watchStore.get("mappings") ?? []) {- let collectionMapping = watch.collectionMapping;- // The required type defines the latest schema, but before migration- // this'll be undefined, so tell ESLint to calm down.- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition- if (!collectionMapping) {- // eslint-disable-next-line @typescript-eslint/no-deprecated- collectionMapping = watch.uploadStrategy == 1 ? "parent" : "root";- needsUpdate = true;- }- // eslint-disable-next-line @typescript-eslint/no-deprecated- if (watch.rootFolderName) {- // eslint-disable-next-line @typescript-eslint/no-deprecated- delete watch.rootFolderName;- needsUpdate = true;- }- updatedWatches.push({ ...watch, collectionMapping });- }- if (needsUpdate) {- watchStore.set("mappings", updatedWatches);- log.info("Migrated legacy watch store data to new schema");- }-};