Fix sync (#95)
The data part of the add history request is actually a string. I don't want to introduce any structure here, and would rather keep it as "just a blob". Even if that blob has structure secretly! My fault for missing this in the last review
This commit is contained in:
parent
de2e34ac50
commit
c16a26cdbf
2 changed files with 4 additions and 5 deletions
|
@ -12,7 +12,7 @@ use atuin_common::api::{
|
||||||
};
|
};
|
||||||
use atuin_common::utils::hash_str;
|
use atuin_common::utils::hash_str;
|
||||||
|
|
||||||
use crate::encryption::{decode_key, decrypt, EncryptedHistory};
|
use crate::encryption::{decode_key, decrypt};
|
||||||
use crate::history::History;
|
use crate::history::History;
|
||||||
|
|
||||||
static APP_USER_AGENT: &str = concat!("atuin/", env!("CARGO_PKG_VERSION"),);
|
static APP_USER_AGENT: &str = concat!("atuin/", env!("CARGO_PKG_VERSION"),);
|
||||||
|
@ -140,10 +140,7 @@ impl<'a> Client<'a> {
|
||||||
Ok(history)
|
Ok(history)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn post_history(
|
pub async fn post_history(&self, history: &[AddHistoryRequest<'_, String>]) -> Result<()> {
|
||||||
&self,
|
|
||||||
history: &[AddHistoryRequest<'_, EncryptedHistory>],
|
|
||||||
) -> Result<()> {
|
|
||||||
let url = format!("{}/history", self.sync_addr);
|
let url = format!("{}/history", self.sync_addr);
|
||||||
let url = Url::parse(url.as_str())?;
|
let url = Url::parse(url.as_str())?;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,8 @@ async fn sync_upload(
|
||||||
|
|
||||||
for i in last {
|
for i in last {
|
||||||
let data = encrypt(&i, &key)?;
|
let data = encrypt(&i, &key)?;
|
||||||
|
let data = serde_json::to_string(&data)?;
|
||||||
|
|
||||||
let add_hist = AddHistoryRequest {
|
let add_hist = AddHistoryRequest {
|
||||||
id: i.id.into(),
|
id: i.id.into(),
|
||||||
timestamp: i.timestamp,
|
timestamp: i.timestamp,
|
||||||
|
|
Loading…
Reference in a new issue