client server connection UI

This commit is contained in:
2026-08-06 19:17:13 +08:00
parent eae86c73f7
commit 81e03ba152
5 changed files with 167 additions and 4 deletions
+8
View File
@@ -40,6 +40,9 @@ async updateProfile(displayName: string) : Promise<User> {
},
async getPublicKey() : Promise<string> {
return await TAURI_INVOKE("get_public_key");
},
async listStatuses() : Promise<ConnectionStatus[]> {
return await TAURI_INVOKE("list_statuses");
}
}
@@ -48,10 +51,12 @@ async getPublicKey() : Promise<string> {
export const events = __makeEvents__<{
friendsChanged: FriendsChanged,
networkStatusChanged: NetworkStatusChanged,
profileChanged: ProfileChanged,
remotesChanged: RemotesChanged
}>({
friendsChanged: "friends-changed",
networkStatusChanged: "network-status-changed",
profileChanged: "profile-changed",
remotesChanged: "remotes-changed"
})
@@ -62,7 +67,10 @@ remotesChanged: "remotes-changed"
/** user-defined types **/
export type ConnectionState = "connecting" | "connected" | "disconnected"
export type ConnectionStatus = { remoteId: string; address: string; name: string | null; state: ConnectionState }
export type FriendsChanged = { friends: User[] }
export type NetworkStatusChanged = { statuses: ConnectionStatus[] }
export type ProfileChanged = { profile: User }
export type Remote = { id: string; address: string; name: string | null; port: number | null }
export type RemoteInput = { address: string; name: string | null; port: number | null }