0
0
Fork 0
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:
Delta1925 2023-04-16 19:08:36 +02:00
parent 9779ec7b8d
commit 192bd9675d
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
4 changed files with 2799 additions and 3 deletions

View file

@ -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);

View file

@ -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!(