## 0.24.13

### Fixed
#### General Replication
- No longer unexpected errors occur when the replication is stopped during for some reason (e.g., network disconnection).
#### Peer-to-Peer Synchronisation
- Set-up process will not receive data from unexpected sources.
- No longer resource leaks while enabling the `broadcasting changes`
- Logs are less verbose.
- Received data is now correctly dispatched to other devices.
- `Timeout` error now more informative.
- No longer timeout error occurs for reporting the progress to other devices.
- Decision dialogues for the same thing are not shown multiply at the same time anymore.
- Disconnection of the peer-to-peer synchronisation is now more robust and less error-prone.
#### Webpeer
- Now we can toggle Peers' configuration.
### Refactored
- Cross-platform compatibility layer has been improved.
- Common events are moved to the common library.
- Displaying replication status of the peer-to-peer synchronisation is separated from the main-log-logic.
- Some file names have been changed to be more consistent.
This commit is contained in:
vorotamoroz
2025-02-17 11:33:35 +00:00
parent 90c0ff22b9
commit 405624b51b
10 changed files with 205 additions and 423 deletions

View File

@@ -7,7 +7,7 @@
type CommandShim,
type PeerStatus,
type PluginShim,
} from "./P2PReplicatorPaneCommon";
} from "../../../lib/src/replication/trystero/P2PReplicatorPaneCommon";
import PeerStatusRow from "../P2PReplicator/PeerStatusRow.svelte";
import { EVENT_LAYOUT_READY, eventHub } from "../../../common/events";
import {
@@ -294,7 +294,12 @@
<th> Room ID </th>
<td>
<label class={{ "is-dirty": isRoomIdModified }}>
<input type="text" placeholder="anything-you-like" bind:value={eRoomId} autocomplete="off"/>
<input
type="text"
placeholder="anything-you-like"
bind:value={eRoomId}
autocomplete="off"
/>
<button onclick={() => chooseRandom()}> Use Random Number </button>
</label>
<span>
@@ -320,8 +325,7 @@
<th> This device name </th>
<td>
<label class={{ "is-dirty": isDeviceNameModified }}>
<input type="text" placeholder="iphone-16" bind:value={eDeviceName}
autocomplete="off" />
<input type="text" placeholder="iphone-16" bind:value={eDeviceName} autocomplete="off" />
</label>
</td>
</tr>

View File

@@ -1,58 +0,0 @@
import type { P2PSyncSetting } from "../../../lib/src/common/types";
export const EVENT_P2P_PEER_SHOW_EXTRA_MENU = "p2p-peer-show-extra-menu";
export enum AcceptedStatus {
UNKNOWN = "Unknown",
ACCEPTED = "Accepted",
DENIED = "Denied",
ACCEPTED_IN_SESSION = "Accepted in session",
DENIED_IN_SESSION = "Denied in session",
}
export type PeerExtraMenuEvent = {
peer: PeerStatus;
event: MouseEvent;
};
export enum ConnectionStatus {
CONNECTED = "Connected",
CONNECTED_LIVE = "Connected(live)",
DISCONNECTED = "Disconnected",
}
export type PeerStatus = {
name: string;
peerId: string;
syncOnConnect: boolean;
watchOnConnect: boolean;
syncOnReplicationCommand: boolean;
accepted: AcceptedStatus;
status: ConnectionStatus;
isFetching: boolean;
isSending: boolean;
isWatching: boolean;
};
declare global {
interface LSEvents {
[EVENT_P2P_PEER_SHOW_EXTRA_MENU]: PeerExtraMenuEvent;
// [EVENT_P2P_REPLICATOR_PROGRESS]: P2PReplicationReport;
}
}
export interface PluginShim {
saveSettings: () => Promise<void>;
settings: P2PSyncSetting;
rebuilder: any;
$$scheduleAppReload: () => void;
$$getVaultName: () => string;
// confirm: any;
}
export interface CommandShim {
getConfig(key: string): string | null;
setConfig(key: string, value: string): void;
open(): Promise<void>;
close(): Promise<void>;
enableBroadcastCastings(): void; // cmdSync._replicatorInstance?.enableBroadcastChanges();
disableBroadcastCastings(): void; ///cmdSync._replicatorInstance?.disableBroadcastChanges();
}

View File

@@ -4,11 +4,15 @@ import type ObsidianLiveSyncPlugin from "../../../main.ts";
import { mount } from "svelte";
import { SvelteItemView } from "../../../common/SvelteItemView.ts";
import { eventHub } from "../../../common/events.ts";
import { EVENT_P2P_PEER_SHOW_EXTRA_MENU, type PeerStatus } from "./P2PReplicatorPaneCommon.ts";
import { unique } from "octagonal-wheels/collection";
import { LOG_LEVEL_NOTICE, REMOTE_P2P } from "../../../lib/src/common/types.ts";
import { Logger } from "../../../lib/src/common/logger.ts";
import { P2PReplicator } from "../CmdP2PSync.ts";
import { P2PReplicator } from "../CmdP2PReplicator.ts";
import {
EVENT_P2P_PEER_SHOW_EXTRA_MENU,
type PeerStatus,
} from "../../../lib/src/replication/trystero/P2PReplicatorPaneCommon.ts";
export const VIEW_TYPE_P2P = "p2p-replicator";
function addToList(item: string, list: string) {

View File

@@ -1,9 +1,9 @@
<script lang="ts">
import { getContext } from "svelte";
import { AcceptedStatus, type PeerStatus } from "./P2PReplicatorPaneCommon";
import type { P2PReplicator } from "../CmdP2PSync";
import { AcceptedStatus, type PeerStatus } from "../../../lib/src/replication/trystero/P2PReplicatorPaneCommon";
import type { P2PReplicator } from "../CmdP2PReplicator";
import { eventHub } from "../../../common/events";
import { EVENT_P2P_PEER_SHOW_EXTRA_MENU } from "./P2PReplicatorPaneCommon";
import { EVENT_P2P_PEER_SHOW_EXTRA_MENU } from "../../../lib/src/replication/trystero/P2PReplicatorPaneCommon";
interface Props {
peerStatus: PeerStatus;