mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 05:46:29 +03:00
integrate backup sending via iroh into the repl
This commit is contained in:
@@ -335,6 +335,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
||||
continue-key-transfer <msg-id> <setup-code>\n\
|
||||
has-backup\n\
|
||||
export-backup\n\
|
||||
send-backup\n\
|
||||
import-backup <backup-file>\n\
|
||||
export-keys\n\
|
||||
import-keys\n\
|
||||
@@ -477,6 +478,19 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
||||
.await?;
|
||||
println!("Exported to {}.", dir.to_string_lossy());
|
||||
}
|
||||
"send-backup" => {
|
||||
let dir = dirs::home_dir().unwrap_or_default();
|
||||
let (sender, transfer) =
|
||||
send_backup(&context, dir.as_ref(), Some(arg2.to_string())).await?;
|
||||
let ticket_bytes = transfer.ticket().as_bytes();
|
||||
|
||||
println!(
|
||||
"Ticket: {}",
|
||||
multibase::encode(multibase::Base::Base64, &ticket_bytes)
|
||||
);
|
||||
tokio::time::sleep(std::time::Duration::from_secs(100)).await;
|
||||
sender.close().await?;
|
||||
}
|
||||
"import-backup" => {
|
||||
ensure!(!arg1.is_empty(), "Argument <backup-file> missing.");
|
||||
imex(
|
||||
|
||||
Reference in New Issue
Block a user