fix: add sync subscription webui and check credential web ui
This commit is contained in:
@@ -9,3 +9,5 @@ quirks_path = { workspace = true }
|
||||
snafu = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_with = { workspace = true }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
pub mod errors;
|
||||
pub mod loose;
|
||||
|
||||
pub use errors::OptDynErr;
|
||||
pub use loose::BooleanLike;
|
||||
|
||||
19
packages/util/src/loose.rs
Normal file
19
packages/util/src/loose.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum BooleanLike {
|
||||
Boolean(bool),
|
||||
String(String),
|
||||
Number(i32),
|
||||
}
|
||||
|
||||
impl BooleanLike {
|
||||
pub fn as_bool(&self) -> bool {
|
||||
match self {
|
||||
BooleanLike::Boolean(b) => *b,
|
||||
BooleanLike::String(s) => s.to_lowercase() == "true",
|
||||
BooleanLike::Number(n) => *n != 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user