Milestone 5: canvas for access

The hub now serves a React canvas (web/, embedded at build time):
grant by dragging a vault onto a person, revoke by pulling a ribbon
until it snaps with an 8 s Undo the hub honours before anything reaches
devices, invites (including vaults dropped on invitees), device rename
and removal, Float/Dock, and panels with a button for every gesture.

Sign-in without passwords (SPEC §8): `lunesync open` one-time link or
a pairing code typed on the hub; 30-day HttpOnly session cookie plus an
X-Lune header on every canvas request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 07:56:41 +07:00
parent 4025726083
commit 193cb06f85
27 changed files with 3574 additions and 39 deletions

View File

@@ -88,8 +88,10 @@ enum Command {
#[arg(long)]
vaults_dir: Option<PathBuf>,
},
/// Make a one-time code to add another of your devices
/// Make a one-time code to add another of your devices (or sign in to the canvas on a phone)
Pair,
/// Open the team canvas in your browser, already signed in
Open,
/// Vaults on the hub
Vault {
#[command(subcommand)]
@@ -297,6 +299,13 @@ fn run_cli(cli: Cli) -> Result<()> {
Command::Join { link, name, vaults_dir } => team::join(&mut config, &link, &name, vaults_dir)?,
Command::Login { hub, code, name, vaults_dir } => team::login(&mut config, &hub, &code, &name, vaults_dir)?,
Command::Pair => team::pair(&config)?,
Command::Open => {
let url = team::link(&config)?.web_link()?;
let opener = if cfg!(target_os = "macos") { "open" } else { "xdg-open" };
if std::process::Command::new(opener).arg(&url).status().map(|s| !s.success()).unwrap_or(true) {
println!("Open this link in your browser (it works once, for 2 minutes):\n\n {url}");
}
}
Command::Vault { action: VaultCmd::New { name } } => team::vault_new(&mut config, &name)?,
Command::Vault { action: VaultCmd::Upload { name, fresh } } => team::vault_upload(&mut config, &name, fresh)?,
Command::Invite { person, vaults } => team::invite(&config, &person, &vaults)?,

View File

@@ -48,7 +48,7 @@ pub fn login(config: &mut Config, url: &str, code: &str, label: &str, vaults_dir
pub fn pair(config: &Config) -> Result<()> {
let h = link(config)?;
let code = h.pair()?;
println!("On the new device (code works once, for 10 minutes):\n");
println!("On the new device (or type the code on the canvas sign-in page; works once, for 10 minutes):\n");
println!(" lunesync login --hub {} --code {code} --name <its label>", h.url);
Ok(())
}