From f9a626a858db52b1200080ed42bb6c415091715c Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Fri, 22 May 2026 16:37:05 +0100 Subject: [PATCH 1/3] ### Fixed - No longer the P2P passphrase mismatch causes a server shutdown. - Settings related to P2P synchronisation are now correctly applied on start-up and no longer reverted. ### New features - Diagnostic P2P connection stats are now available. - These stats indicate the number of connection trials, successes, and, failures. --- .../P2PReplicator/P2PServerStatusCard.svelte | 86 +++++++++++++++++++ src/lib | 2 +- src/modules/features/SetupManager.ts | 25 +++++- updates.md | 12 +++ 4 files changed, 120 insertions(+), 5 deletions(-) diff --git a/src/features/P2PSync/P2PReplicator/P2PServerStatusCard.svelte b/src/features/P2PSync/P2PReplicator/P2PServerStatusCard.svelte index 4d53651..0d8aad6 100644 --- a/src/features/P2PSync/P2PReplicator/P2PServerStatusCard.svelte +++ b/src/features/P2PSync/P2PReplicator/P2PServerStatusCard.svelte @@ -24,6 +24,7 @@ let serverInfo = $state(undefined); let replicatorStatus = $state(undefined); let roomSuffix = $state(extractP2PRoomSuffix(core?.services.setting.currentSettings()?.P2P_roomID ?? "")); + let useDiagRTC = $state(core?.services.setting.currentSettings()?.P2P_useDiagRTC ?? false); async function requestServerStatus() { await Promise.resolve(liveSyncReplicator.requestStatus()); @@ -48,6 +49,18 @@ } } + async function toggleDiagRTC() { + if (!core) { + return; + } + const next = !useDiagRTC; + await core.services.setting.updateSettings((settings) => { + settings.P2P_useDiagRTC = next; + return settings; + }, true); + useDiagRTC = next; + } + onMount(() => { const unsubscribe = eventHub.onEvent(EVENT_SERVER_STATUS, (status) => { serverInfo = status; @@ -58,6 +71,7 @@ }); const unsubscribeSettings = eventHub.onEvent(EVENT_SETTING_SAVED, (settings) => { roomSuffix = extractP2PRoomSuffix(settings?.P2P_roomID ?? ""); + useDiagRTC = settings?.P2P_useDiagRTC ?? false; }); fireAndForget(async () => { @@ -131,6 +145,48 @@ {/if} + + {#if core} +
+ + +
+ {/if} + + {#if serverInfo} +
+

Stats

+
+
+ Incoming: + {serverInfo.diag.totalNewConnections} +
+
+ Connected: + {serverInfo.diag.totalSuccessfulConnections} +
+
+ Failed: + {serverInfo.diag.totalFailedConnections} +
+
+ Closed: + {serverInfo.diag.totalClosedConnections} +
+
+
+ {/if} \ No newline at end of file diff --git a/src/lib b/src/lib index b9aaf3c..e97ca58 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit b9aaf3c03a773cf54887da5826e52774239106b9 +Subproject commit e97ca5821c6fd50b22e63acbbc0f936e0ac8391a diff --git a/src/modules/features/SetupManager.ts b/src/modules/features/SetupManager.ts index 1bd40be..3d69968 100644 --- a/src/modules/features/SetupManager.ts +++ b/src/modules/features/SetupManager.ts @@ -7,7 +7,7 @@ import { REMOTE_MINIO, REMOTE_P2P, } from "../../lib/src/common/types.ts"; -import { generatePatchObj, isObjectDifferent } from "../../lib/src/common/utils.ts"; +import { isObjectDifferent } from "@lib/common/utils.ts"; import Intro from "./SetupWizard/dialogs/Intro.svelte"; import SelectMethodNewUser from "./SetupWizard/dialogs/SelectMethodNewUser.svelte"; import SelectMethodExisting from "./SetupWizard/dialogs/SelectMethodExisting.svelte"; @@ -23,6 +23,7 @@ import SetupRemoteP2P from "./SetupWizard/dialogs/SetupRemoteP2P.svelte"; import SetupRemoteE2EE from "./SetupWizard/dialogs/SetupRemoteE2EE.svelte"; import { decodeSettingsFromQRCodeData } from "../../lib/src/API/processSetting.ts"; import { AbstractModule } from "../AbstractModule.ts"; +import { ConnectionStringParser } from "@lib/common/ConnectionString.ts"; /** * User modes for onboarding and setup @@ -194,8 +195,24 @@ export class SetupManager extends AbstractModule { return await this.onOnboard(userMode); } const newSetting = { ...currentSetting, ...p2pConf } as ObsidianLiveSyncSettings; + // Apply remoteConfigurations + if (newSetting.P2P_ActiveRemoteConfigurationId) { + const id = newSetting.P2P_ActiveRemoteConfigurationId; + const merged = { + ...newSetting, + ...p2pConf, + } as ObsidianLiveSyncSettings; + const uri = ConnectionStringParser.serialize({ type: "p2p", settings: merged }); + newSetting.remoteConfigurations[id] = { + ...newSetting.remoteConfigurations[id], + uri, + isEncrypted: false, + }; + newSetting.P2P_ActiveRemoteConfigurationId = id; + } if (activate) { newSetting.remoteType = REMOTE_P2P; + newSetting.activeConfigurationId = newSetting.P2P_ActiveRemoteConfigurationId; } return await this.onConfirmApplySettingsFromWizard(newSetting, userMode, activate); } @@ -285,9 +302,9 @@ export class SetupManager extends AbstractModule { this._log("No changes in settings detected. Skipping applying settings from wizard.", LOG_LEVEL_NOTICE); return true; } - const patch = generatePatchObj(this.settings, newConf); - console.log(`Changes:`); - console.dir(patch); + // const patch = generatePatchObj(this.settings, newConf); + // console.log(`Changes:`); + // console.dir(patch); if (!activate) { extra(); await this.applySetting(newConf, UserMode.ExistingUser); diff --git a/updates.md b/updates.md index 6bedf71..e3d0c62 100644 --- a/updates.md +++ b/updates.md @@ -3,6 +3,18 @@ Since 19th July, 2025 (beta1 in 0.25.0-beta1, 13th July, 2025) The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md). Because 0.25 got a lot of updates, thankfully, compatibility is kept and we do not need breaking changes! In other words, when get enough stabled. The next version will be v1.0.0. Even though it my hope. +## Unreleased + +22nd May, 2026 + +### Fixed +- No longer the P2P passphrase mismatch causes a server shutdown. +- Settings related to P2P synchronisation are now correctly applied on start-up and no longer reverted. + +### New features +- Diagnostic P2P connection stats are now available. + - These stats indicate the number of connection trials, successes, and, failures. + ## 0.25.68 22nd May, 2026 From 148aa8505e6df54d5d742d1e421700c43305f7fb Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Fri, 22 May 2026 16:38:44 +0100 Subject: [PATCH 2/3] bump --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- updates.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 027fd64..09d6480 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-livesync", "name": "Self-hosted LiveSync", - "version": "0.25.68", + "version": "0.25.69", "minAppVersion": "1.7.2", "description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.", "author": "vorotamoroz", diff --git a/package-lock.json b/package-lock.json index bd8f9bd..e707b65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-livesync", - "version": "0.25.68", + "version": "0.25.69", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsidian-livesync", - "version": "0.25.68", + "version": "0.25.69", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.808.0", diff --git a/package.json b/package.json index 057971c..35f4221 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-livesync", - "version": "0.25.68", + "version": "0.25.69", "description": "Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.", "main": "main.js", "type": "module", diff --git a/updates.md b/updates.md index e3d0c62..077be5e 100644 --- a/updates.md +++ b/updates.md @@ -3,7 +3,7 @@ Since 19th July, 2025 (beta1 in 0.25.0-beta1, 13th July, 2025) The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md). Because 0.25 got a lot of updates, thankfully, compatibility is kept and we do not need breaking changes! In other words, when get enough stabled. The next version will be v1.0.0. Even though it my hope. -## Unreleased +## 0.25.69 22nd May, 2026 From caaff618e9e484763247ba0dc9a4f8a786a43e4d Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Fri, 22 May 2026 16:40:40 +0100 Subject: [PATCH 3/3] fix grammar --- updates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updates.md b/updates.md index 077be5e..5b7bef6 100644 --- a/updates.md +++ b/updates.md @@ -8,12 +8,12 @@ The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsid 22nd May, 2026 ### Fixed -- No longer the P2P passphrase mismatch causes a server shutdown. +- No longer does the P2P passphrase mismatch cause a server shutdown. - Settings related to P2P synchronisation are now correctly applied on start-up and no longer reverted. ### New features - Diagnostic P2P connection stats are now available. - - These stats indicate the number of connection trials, successes, and, failures. + - These stats indicate the number of connection trials, successes, and failures. ## 0.25.68