Refine P2P and manual setup workflows

This commit is contained in:
vorotamoroz
2026-07-23 15:23:47 +00:00
parent cd35858e01
commit 1df034f12a
60 changed files with 1884 additions and 770 deletions
@@ -23,6 +23,10 @@ export type ConfiguredSettings = {
export type CoreReadiness = {
databaseReady: boolean;
appReady: boolean;
configured?: boolean;
remoteType?: string;
settingVersion?: number;
suspended?: boolean;
};
export type ReplicationAttempt = CoreReadiness & {
@@ -348,9 +352,14 @@ export async function waitForLiveSyncCoreReady(
[
"(async()=>{",
"const core=app.plugins.plugins['obsidian-livesync'].core;",
"const settings=core.services.setting.currentSettings();",
"return JSON.stringify({",
"databaseReady:core.services.database.isDatabaseReady(),",
"appReady:core.services.appLifecycle.isReady(),",
"configured:settings?.isConfigured===true,",
"remoteType:settings?.remoteType??'',",
"settingVersion:settings?.settingVersion,",
"suspended:core.services.appLifecycle.isSuspended(),",
"});",
"})()",
].join(""),
+18
View File
@@ -177,16 +177,34 @@ export async function captureAndStartInitialisation(
captures: SetupCaptureNames
): Promise<string> {
const p2pFirstDevice = mode === "new" && captures.guide === "p2p-setup";
const p2pAdditionalDevice = mode === "existing" && captures.guide === "p2p-setup";
const title = p2pFirstDevice
? "Setup Complete: Preparing This P2P Device"
: p2pAdditionalDevice
? "Setup Complete: Preparing to Fetch from Another Device"
: mode === "new"
? "Setup Complete: Preparing to Initialise Server"
: "Setup Complete: Preparing to Fetch Synchronisation Data";
const button = p2pFirstDevice
? "Restart and Prepare This Device"
: p2pAdditionalDevice
? "Restart and Select Source Device"
: mode === "new"
? "Restart and Initialise Server"
: "Restart and Fetch Data";
if (p2pAdditionalDevice) {
await withObsidianPage(port, async (page) => {
const modal = modalByTitle(page, title);
await modal
.getByText("After restarting, select an online source device for the initial Fetch.", {
exact: false,
})
.waitFor({ state: "visible", timeout: uiTimeoutMs });
if ((await modal.getByText("downloaded from the server", { exact: false }).count()) !== 0) {
throw new Error("P2P additional-device setup still describes the initial Fetch as a server download.");
}
});
}
const screenshot = await captureGuideDialogue(
port,
`guide-${captures.guide}-${mode === "new" ? "first-initialise" : "second-fetch"}.png`,