src/backup/manifest.rs: include signature inside the manifest
This is more flexible, because we can choose what fileds we want to sign.
This commit is contained in:
@ -1081,7 +1081,7 @@ async fn create_backup(
|
||||
}
|
||||
|
||||
// create manifest (index.json)
|
||||
let manifest = manifest.into_json();
|
||||
let manifest = manifest.into_json(crypt_config.as_ref().map(Arc::as_ref));
|
||||
|
||||
println!("Upload index.json to '{:?}'", repo);
|
||||
let manifest = serde_json::to_string_pretty(&manifest)?.into();
|
||||
@ -1272,18 +1272,17 @@ async fn restore(param: Value) -> Result<Value, Error> {
|
||||
true,
|
||||
).await?;
|
||||
|
||||
let manifest = client.download_manifest().await?;
|
||||
let (manifest, backup_index_data) = client.download_manifest().await?;
|
||||
|
||||
let (archive_name, archive_type) = parse_archive_type(archive_name);
|
||||
|
||||
if archive_name == MANIFEST_BLOB_NAME {
|
||||
let backup_index_data = manifest.into_json().to_string();
|
||||
if let Some(target) = target {
|
||||
replace_file(target, backup_index_data.as_bytes(), CreateOptions::new())?;
|
||||
replace_file(target, &backup_index_data, CreateOptions::new())?;
|
||||
} else {
|
||||
let stdout = std::io::stdout();
|
||||
let mut writer = stdout.lock();
|
||||
writer.write_all(backup_index_data.as_bytes())
|
||||
writer.write_all(&backup_index_data)
|
||||
.map_err(|err| format_err!("unable to pipe data - {}", err))?;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ async fn dump_catalog(param: Value) -> Result<Value, Error> {
|
||||
true,
|
||||
).await?;
|
||||
|
||||
let manifest = client.download_manifest().await?;
|
||||
let (manifest, _) = client.download_manifest().await?;
|
||||
|
||||
let index = client.download_dynamic_index(&manifest, CATALOG_NAME).await?;
|
||||
|
||||
@ -181,7 +181,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
|
||||
.custom_flags(libc::O_TMPFILE)
|
||||
.open("/tmp")?;
|
||||
|
||||
let manifest = client.download_manifest().await?;
|
||||
let (manifest, _) = client.download_manifest().await?;
|
||||
|
||||
let index = client.download_dynamic_index(&manifest, &server_archive_name).await?;
|
||||
let most_used = index.find_most_used_chunks(8);
|
||||
|
@ -139,7 +139,7 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
|
||||
true,
|
||||
).await?;
|
||||
|
||||
let manifest = client.download_manifest().await?;
|
||||
let (manifest, _) = client.download_manifest().await?;
|
||||
|
||||
if server_archive_name.ends_with(".didx") {
|
||||
let index = client.download_dynamic_index(&manifest, &server_archive_name).await?;
|
||||
|
Reference in New Issue
Block a user