Keep P2P consumers on the current transport

This commit is contained in:
vorotamoroz
2026-07-20 15:06:05 +00:00
parent 893c08ad2a
commit 6484a43e2f
34 changed files with 731 additions and 73 deletions
@@ -23,13 +23,12 @@
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore";
interface Props {
cmdSync: P2PReplicatorPaneController;
getCmdSync: () => P2PReplicatorPaneController;
core: Pick<LiveSyncBaseCore, "services">;
}
let { cmdSync, core }: Props = $props();
// const cmdSync = plugin.getAddOn<P2PReplicator>("P2PReplicator")!;
setContext("getReplicator", () => cmdSync);
let { getCmdSync, core }: Props = $props();
setContext("getReplicator", () => getCmdSync());
const currentSettings = () => core.services.setting.currentSettings() as P2PSyncSetting;
const initialSettings = { ...currentSettings() } as P2PSyncSetting;
@@ -223,16 +222,16 @@
}
async function openServer() {
await cmdSync.open();
await getCmdSync().open();
}
async function closeServer() {
await cmdSync.close();
await getCmdSync().close();
}
function startBroadcasting() {
void cmdSync.enableBroadcastChanges();
void getCmdSync().enableBroadcastChanges();
}
function stopBroadcasting() {
void cmdSync.disableBroadcastChanges();
void getCmdSync().disableBroadcastChanges();
}
const initialDialogStatusKey = `p2p-dialog-status`;