mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-15 12:40:12 +00:00
Complete Commonlib rc.6 integration and setup workflows
This commit is contained in:
1 parent
e005f9eb13
commit
1ef8c88139
150 files changed
+31041
-260
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { ConnectionStringParser } from "@vrtmrz/livesync-commonlib/compat/common/ConnectionString";
|
||||
import {
|
||||
REMOTE_P2P,
|
||||
type ObsidianLiveSyncSettings,
|
||||
} from "@vrtmrz/livesync-commonlib/compat/common/types";
|
||||
|
||||
/** Returns whether the selected main remote represents the P2P-only setup. */
|
||||
export function isP2PMainRemote(settings: ObsidianLiveSyncSettings): boolean {
|
||||
if (settings.remoteType === REMOTE_P2P) return true;
|
||||
|
||||
const activeId = settings.activeConfigurationId?.trim();
|
||||
const activeConfiguration = activeId ? settings.remoteConfigurations?.[activeId] : undefined;
|
||||
if (!activeConfiguration) return false;
|
||||
|
||||
try {
|
||||
return ConnectionStringParser.parse(activeConfiguration.uri).type === "p2p";
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user