mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-09-22 02:27:07 +00:00
Complete Commonlib rc.6 integration and setup workflows
This commit is contained in:
@@ -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