Default new CLI and Obsidian environments to NFC path identity

This commit is contained in:
vorotamoroz committed 2026-11-02 04:40:44 +00:00
1 parent ac502b0261
commit 39cc31c2e8
26 files changed
+1466 -61

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import {
REMOTE_COUCHDB,
REMOTE_MINIO,
type ObsidianLiveSyncSettings,
} from "@vrtmrz/livesync-commonlib/compat/common/types";
import type { RemoteConnectionProbe } from "@vrtmrz/livesync-commonlib/replication";
import { resolveInitialPathIdentity } from "@/common/initialPathIdentity";
/** Adopt an existing central remote only for the first explicit Fetch. */
export async function resolveInitialFetchPathIdentity(
settings: ObsidianLiveSyncSettings,
createProbe: () => Promise<RemoteConnectionProbe | undefined>
): Promise<0 | 1 | undefined> {
if (settings.isConfigured) return undefined;
const hasRemote =
(settings.remoteType === REMOTE_COUCHDB && !!settings.couchDB_URI && !!settings.couchDB_DBNAME) ||
(settings.remoteType === REMOTE_MINIO && !!settings.endpoint && !!settings.bucket);
if (!hasRemote) return undefined;
return await resolveInitialPathIdentity(await createProbe(), settings.pathNormalizationVersion);
}