Compare commits
4
Commits
v0.4.3
...
86c407c900
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86c407c900 | ||
|
|
92817da738 | ||
|
|
e1ac2777f3 | ||
|
|
900f499932 |
Generated
+1317
-1135
File diff suppressed because it is too large
Load Diff
+7
-11
@@ -12,21 +12,17 @@ build = "build.rs"
|
||||
#elefren = { path = "../elefren22-fork" }
|
||||
elefren = { git = "https://git.ondrovo.com/MightyPork/elefren-fork.git", rev = "b10e5935ae32f4756b19e9ca58b78a5382f865d1" }
|
||||
|
||||
env_logger = "0.9.0"
|
||||
env_logger = "0.11.8"
|
||||
|
||||
log = "0.4.14"
|
||||
log = "0.4.27"
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
anyhow = "1"
|
||||
clap = "2.33.0"
|
||||
clap = "3"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-stream = "0.1.7"
|
||||
thiserror = "1.0.26"
|
||||
thiserror = "2.0.12"
|
||||
futures = "0.3"
|
||||
voca_rs = "1.13.0"
|
||||
regex = "1.5.4"
|
||||
once_cell = "1.8.0"
|
||||
voca_rs = "1.15.2"
|
||||
regex = "1.11.1"
|
||||
once_cell = "1.21.3"
|
||||
json5 = "0.4.1"
|
||||
|
||||
native-tls = "0.2.8"
|
||||
websocket = "0.26.2"
|
||||
|
||||
+5
-5
@@ -31,26 +31,26 @@ async fn main() -> anyhow::Result<()> {
|
||||
let args = clap::App::new("groups")
|
||||
.arg(
|
||||
Arg::with_name("verbose")
|
||||
.short("v")
|
||||
.short('v')
|
||||
.multiple(true)
|
||||
.help("increase logging, can be repeated"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("quiet")
|
||||
.short("q")
|
||||
.short('q')
|
||||
.multiple(true)
|
||||
.help("decrease logging, can be repeated"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("config")
|
||||
.short("c")
|
||||
.short('c')
|
||||
.long("config")
|
||||
.takes_value(true)
|
||||
.help("set custom config directory, defaults to the current folder"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("auth")
|
||||
.short("a")
|
||||
.short('a')
|
||||
.long("auth")
|
||||
.takes_value(true)
|
||||
.value_name("HANDLE")
|
||||
@@ -58,7 +58,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("reauth")
|
||||
.short("A")
|
||||
.short('A')
|
||||
.long("reauth")
|
||||
.takes_value(true)
|
||||
.value_name("HANDLE")
|
||||
|
||||
@@ -666,13 +666,15 @@ mod tests {
|
||||
assert!(!group.is_banned("piggo@piggo.space"), "user not banned by default");
|
||||
|
||||
group.ban_user("piggo@piggo.space", true).unwrap();
|
||||
assert!(group.is_member("piggo@piggo.space"), "still member even if banned");
|
||||
assert!(!group.is_member("piggo@piggo.space"), "banned user is kicked");
|
||||
assert!(group.is_banned("piggo@piggo.space"), "banned user is banned");
|
||||
|
||||
assert!(!group.can_write("piggo@piggo.space"), "banned member can't post");
|
||||
|
||||
// unban
|
||||
group.ban_user("piggo@piggo.space", false).unwrap();
|
||||
assert!(!group.can_write("piggo@piggo.space"), "unbanned member is still kicked");
|
||||
group.set_member("piggo@piggo.space", true).unwrap();
|
||||
assert!(group.can_write("piggo@piggo.space"), "un-ban works");
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -19,8 +19,8 @@ impl<V, E: Error> LogError for Result<V, E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn acct_to_server(acct: &str) -> Option<&str> {
|
||||
acct.trim_start_matches('@').split('@').nth(1)
|
||||
pub(crate) fn acct_to_server(acct: &str) -> Option<String> {
|
||||
acct.trim_start_matches('@').split('@').nth(1).map(|s| s.to_lowercase())
|
||||
}
|
||||
|
||||
pub(crate) fn normalize_acct(acct: &str, group: &str) -> Result<String, GroupError> {
|
||||
@@ -45,8 +45,8 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_acct_to_server() {
|
||||
assert_eq!(Some("novak"), acct_to_server("pepa@novak"));
|
||||
assert_eq!(Some("banana.co.uk"), acct_to_server("@pepa@banana.co.uk"));
|
||||
assert_eq!(Some("novak".to_string()), acct_to_server("pepa@novak"));
|
||||
assert_eq!(Some("banana.co.uk".to_string()), acct_to_server("@pepa@banana.co.uk"));
|
||||
assert_eq!(None, acct_to_server("probably_local"));
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ mod test {
|
||||
);
|
||||
assert_eq!(
|
||||
Ok("piggo@piggo.space".into()),
|
||||
normalize_acct("piGGgo@pIggo.spaCe", "uhh")
|
||||
normalize_acct("piGGo@pIggo.spaCe", "uhh")
|
||||
);
|
||||
assert_eq!(
|
||||
Ok("piggo@banana.nana".into()),
|
||||
normalize_acct("piGGgo", "foo@baNANA.nana")
|
||||
normalize_acct("piGGo", "foo@baNANA.nana")
|
||||
);
|
||||
assert_eq!(Err(GroupError::BadConfig("_".into())), normalize_acct("piggo", "uhh"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user