0.1.3: upload a vault to a team from the app, detach first; AGPL-3.0
- The Lune window shows Upload on a vault that isn't on a team, for the team owner and anyone who manages a vault there. The hub now lets those people create vaults too (was owner only); /api/me and the canvas say can_create. - A vault on its own remote (GitHub, GitLab, Gitea…) must be detached first (`lunesync vault detach`, or the Upload sheet's Detach): it shares what's waiting one last time, then lives on this device only. Upload refuses anything else, and a check-in no longer silently moves a same-named vault off its own remote onto the hub. - Upload logic moved from the CLI into core (lune_core::upload). - Canvas: "1 person loses access". - License: AGPL-3.0-only. README and SPEC §8 updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,29 @@ pub fn choose_folder(app: AppHandle) -> Option<String> {
|
||||
.map(|p| p.display().to_string())
|
||||
}
|
||||
|
||||
/// The teams this Mac may put a vault on (team owner, or Manage on one of their vaults), as of the last check-in.
|
||||
#[tauri::command(async)]
|
||||
pub fn upload_teams() -> Vec<String> {
|
||||
lune_core::membership::can_create_on()
|
||||
}
|
||||
|
||||
/// Stops syncing a vault with its own remote, so it can be uploaded to a team.
|
||||
#[tauri::command(async)]
|
||||
pub fn detach_vault(vault: String) -> Answer<String> {
|
||||
let mut config = Config::load().map_err(plain)?;
|
||||
lune_core::upload::detach(&mut config, &vault).map_err(plain)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub fn upload_vault(vault: String, team: String, fresh: bool) -> Answer<String> {
|
||||
let mut config = Config::load().map_err(plain)?;
|
||||
config.use_hub_credentials();
|
||||
let hub = config.hub(&team).cloned().ok_or(format!("this Mac isn't on {team}"))?;
|
||||
let said = lune_core::upload::upload(&mut config, &hub, &vault, fresh).map_err(plain)?;
|
||||
supervisor::CHECK_HUB.store(true, Ordering::Relaxed);
|
||||
Ok(said)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub fn share_now() {
|
||||
supervisor::share_now(&Config::load().unwrap_or_default());
|
||||
|
||||
@@ -348,6 +348,9 @@ fn main() {
|
||||
commands::connect,
|
||||
commands::choose_folder,
|
||||
commands::share_now,
|
||||
commands::upload_teams,
|
||||
commands::detach_vault,
|
||||
commands::upload_vault,
|
||||
commands::held_share,
|
||||
commands::held_undo,
|
||||
commands::secret_pointer,
|
||||
|
||||
Reference in New Issue
Block a user