mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-10-30 03:25:54 +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
2769
Cargo.lock
generated
Normal file
2769
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
27
Cargo.toml
Normal file
27
Cargo.toml
Normal file
|
@ -0,0 +1,27 @@
|
|||
[package]
|
||||
name = "simple-wkd"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "simple-wkd"
|
||||
path = "backend/src/main.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-files = "0.6.2"
|
||||
actix-web = "4.3.1"
|
||||
chrono = "0.4.24"
|
||||
flexi_logger = "0.25.3"
|
||||
lettre = "0.10.4"
|
||||
log = "0.4.17"
|
||||
once_cell = "1.17.1"
|
||||
rand = "0.8.5"
|
||||
sequoia-net = "0.27.0"
|
||||
sequoia-openpgp = { version = "1.14.0", default-features = false, features = ["crypto-openssl"] }
|
||||
serde = { version = "1.0.160", features = ["derive"] }
|
||||
thiserror = "1.0.40"
|
||||
tokio = { version = "1.27.0", features = ["time"] }
|
||||
toml = "0.7.3"
|
||||
url = { version = "2.3.1", features = ["serde"] }
|
|
@ -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…
Reference in a new issue