mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-28 12:26:52 -06:00
The Share popover is one flow: Online (the file is published to the server in
Preferences and the server names its links with short codes) or Local network
(the app hosts; the code carries its address and the session's secret), one
Start sharing button, the code large with Copy code and Copy link, who is here,
can edit / can view, and Stop sharing. Join with a code is one field in the
popover, on the home screen and in the Join dialog, for a code of either kind
or an invite link.
Protocol (within version 2, new variants last): Resolve / Resolved and Admin
code. The server keeps a stretched hash and the wrapped token, never the code,
and limits wrong codes per address (with a lockout) and for everyone. Older
servers leave the links in place of a code; older apps join by link.
collab.share, collab.join {code}, code and share in collab.peers; the server
preference defaults to the built-in server and can be reset or turned off.
71 lines
2.1 KiB
Rust
71 lines
2.1 KiB
Rust
//! Live sessions over the network for FigCraft (milestone M9, steps 2 and 4
|
|
//! of `docs/collab-protocol.md`): the WebSocket transport, the session host the desktop app embeds,
|
|
//! invite links, and presence relay. It carries the collaboration core's messages
|
|
//! ([`figcraft_collab::message`]) and runs its [`Server`](figcraft_collab::Server) as the host's
|
|
//! authority.
|
|
//!
|
|
//! The app installs a [`NetLink`] into the engine session (`session.live.install(…)`); the
|
|
//! engine's `collab.*` commands drive it and the UI reads the engine's live state. Network
|
|
//! threads wake the UI through a [`Waker`] only when something arrives; nothing polls.
|
|
//!
|
|
//! The browser build's [`NetLink`] joins sessions through the browser's WebSocket API (`web-sys`);
|
|
//! hosting needs the desktop app. Its connection logic (`driver.rs`) is target-independent and
|
|
//! tested natively.
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
|
|
#[cfg(any(target_arch = "wasm32", test))]
|
|
mod driver;
|
|
pub mod inbox;
|
|
pub mod invite;
|
|
mod join;
|
|
pub mod limits;
|
|
mod sessions;
|
|
pub mod throttle;
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod guest;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod host;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod hub;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
mod link;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod links;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod manage;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod net;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod tls;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub mod token;
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
mod web;
|
|
|
|
pub use inbox::{Inbox, Waker};
|
|
pub use invite::{Endpoint, Invite};
|
|
pub use limits::NetLimits;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub use link::{DEFAULT_PORT, NetLink, lan_ip};
|
|
#[cfg(target_arch = "wasm32")]
|
|
pub use web::NetLink;
|
|
|
|
#[cfg(test)]
|
|
mod code_tests;
|
|
#[cfg(test)]
|
|
mod driver_tests;
|
|
#[cfg(test)]
|
|
mod invite_tests;
|
|
#[cfg(test)]
|
|
mod links_tests;
|
|
#[cfg(test)]
|
|
mod loopback_tests;
|
|
#[cfg(test)]
|
|
mod session_tests;
|
|
#[cfg(test)]
|
|
mod sessions_tests;
|
|
#[cfg(test)]
|
|
mod tls_tests;
|