From df184ff9d88ac1c799c94f7fc6257dccb9c31d05 Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:11:08 +0800 Subject: [PATCH] correct way to deal with .obsidian and bookmarks --- pro/src/sync.ts | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/pro/src/sync.ts b/pro/src/sync.ts index d0b15f9..6831b65 100644 --- a/pro/src/sync.ts +++ b/pro/src/sync.ts @@ -203,21 +203,36 @@ export const checkIsSkipItemOrNotByName = ( } } - // we have to check bookmarks.json firstly then check the whole .obsidian folder later - if (isBookmarksFile(key, configDir) && finalIsIgnored === undefined) { - if (syncBookmarks) { - finalIsIgnored = false; - } else { - finalIsIgnored = true; - } - } - - // we have to check bookmarks.json firstly then check the whole .obsidian folder later - if (isInsideObsFolder(key, configDir) && finalIsIgnored === undefined) { + // sync config, not sync bookmarks: sync config and **force syncing bookmarks as well** + // not sync config, sync bookmarks: sync bookmars, not other config + // not sync config, not sync bookmarks: not sync config + if (finalIsIgnored === undefined) { if (syncConfigDir) { - finalIsIgnored = false; + if (isInsideObsFolder(key, configDir)) { + // force sync everything + finalIsIgnored = false; + } else { + // not config files, do not judge now, do nothing + } + } else if (syncBookmarks) { + // not sync config, sync bookmarks + if (isBookmarksFile(key, configDir)) { + // sync everything of bookmarks + finalIsIgnored = false; + } else if (isInsideObsFolder(key, configDir)) { + // not sync any other thing in config + finalIsIgnored = true; + } else { + // not config files, do not judge now, do nothing + } } else { - finalIsIgnored = true; + // not sync config, and not sync bookmarks + if (isInsideObsFolder(key, configDir)) { + // not sync any thing in config + finalIsIgnored = true; + } else { + // not config files, do not judge now, do nothing + } } }