Remove the need for a directory for db export

Plus on import use the context directory.  We can actually write there
just fine.
This commit is contained in:
Floris Bruynooghe
2023-02-16 16:06:41 +01:00
parent dcce6ef50b
commit 490a14c5ef
9 changed files with 48 additions and 48 deletions

View File

@@ -1,5 +1,4 @@
use std::collections::BTreeMap;
use std::path::Path;
use std::sync::Arc;
use std::{collections::HashMap, str::FromStr};
@@ -1351,10 +1350,10 @@ impl CommandApi {
/// This **stops IO**. After completion `start_io` must be called to restart IO.
///
/// Returns the QR code as a rendered SVG image.
async fn provide_backup(&self, account_id: u32, path: String) -> Result<String> {
async fn provide_backup(&self, account_id: u32) -> Result<String> {
let ctx = self.get_context(account_id).await?;
ctx.stop_io().await;
let provider = imex::BackupProvider::prepare(&ctx, Path::new(&path)).await?;
let provider = imex::BackupProvider::prepare(&ctx).await?;
let qr = provider.qr();
let svg = match generate_backup_qr(&ctx, &qr).await {
Ok(svg) => svg,

View File

@@ -129,17 +129,7 @@ impl From<Qr> for QrObject {
}
Qr::FprWithoutAddr { fingerprint } => QrObject::FprWithoutAddr { fingerprint },
Qr::Account { domain } => QrObject::Account { domain },
/// Provides a backup that can be retrieve.
///
/// This contains all the data needed to connect to a device and download a
/// backup from it to configure the receiving device with the same account.
Qr::Backup { ticket } => QrObject::Backup {
/// Printable version of the provider information.
///
/// This is the printable version of a `sendme` ticket, which contains all
/// the information to connect to and authenticate a backup provider.
///
/// The format is somewhat opaque, but `sendme` can deserialise this.
ticket: ticket.to_string(),
},
Qr::WebrtcInstance {