mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-12-06 14:52:41 +01:00
Use toml instead of json
This commit is contained in:
parent
9779ec7b8d
commit
192bd9675d
4 changed files with 2799 additions and 3 deletions
|
@ -30,7 +30,7 @@ pub fn confirm_action(token: &str) -> Result<(Action, String), Error> {
|
|||
trace!("Requested token {} isn't a file", token);
|
||||
return Err(Error::MissingPending);
|
||||
};
|
||||
let key = match serde_json::from_str::<Pending>(&content) {
|
||||
let key = match toml::from_str::<Pending>(&content) {
|
||||
Ok(key) => key,
|
||||
Err(_) => {
|
||||
warn!("Error while deserializing token {}!", token);
|
||||
|
|
|
@ -55,7 +55,7 @@ impl Pending {
|
|||
}
|
||||
|
||||
fn store_pending(pending: &Pending, token: &str) -> Result<(), Error> {
|
||||
let serialized = match serde_json::to_string(pending) {
|
||||
let serialized = match toml::to_string(pending) {
|
||||
Ok(serialized) => serialized,
|
||||
Err(_) => return Err(Error::SerializeData),
|
||||
};
|
||||
|
@ -104,7 +104,7 @@ pub fn clean_stale(max_age: i64) {
|
|||
continue;
|
||||
}
|
||||
};
|
||||
let key = match serde_json::from_str::<Pending>(&content) {
|
||||
let key = match toml::from_str::<Pending>(&content) {
|
||||
Ok(key) => key,
|
||||
Err(_) => {
|
||||
warn!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue