Merge branch 'update-deps'

master v0.4.6
Ondřej Hruška 11 hours ago
commit 131a59b3b3
  1. 35
      CHANGELOG.md
  2. 2603
      Cargo.lock
  3. 24
      Cargo.toml
  4. 2
      build.rs
  5. 3
      locales/cs.json
  6. 8
      src/error.rs
  7. 2
      src/group_handler/handle_mention.rs
  8. 18
      src/group_handler/mod.rs
  9. 14
      src/main.rs
  10. 31
      src/store/group_config.rs
  11. 30
      src/store/mod.rs
  12. 2
      src/utils.rs

@ -1,37 +1,40 @@
# Changelog
## v0.4.5
## v0.4.6 [2025-06-15]
- Update dependencies
## v0.4.5 [2022-11-02]
- Ignore #nobot in bio if the user is also a member
## v0.4.4
## v0.4.4 [2021-11-02]
- Fix some failing tests
- Lowercase the domain when normalizing an account
## v0.4.3
## v0.4.3 [2021-10-12]
- Fix hashtag not working in a mention
## v0.4.2
## v0.4.2 [2021-10-12]
- Fix URL fragment detected as hashtag
## v0.4.1
## v0.4.1 [2021-10-10]
- "en" translation fixes
- add `messages.json`
- Config files are now parsed as JSON5 = comments are allowed
## v0.4.0
## v0.4.0 [2021-10-10]
- Add a translation system using the `locales` folder
- Add more trace logging
## v0.3.0
## v0.3.0 [2021-10-05]
- Changed config/storage format to directory-based, removed shared config mutex
- Made more options configurable (timeouts, catch-up limits, etc)
- Changed default log level to Debug, added `-q` to reduce it (opposite of `-v`)
- Code cleaning
## v0.2.8
## v0.2.8 [2021-08-30]
- fix error processing statuses when a misskey poll has infinite run time
## v0.2.7
## v0.2.7 [2021-08-30]
- Fix some wrong responses to admin commands
- Remove automatic announcements from some admin commands
- Send no reply to unauthorized admin commands
@ -39,34 +42,34 @@
- Add `/optout` and `/optin`
- Add `#nobot` checking when using the `/boost` command
## v0.2.6
## v0.2.6 [2021-08-28]
- Allow boosting group hashtags when they are in a reply, except when it is private/DM
or contains actionable commands
- `/follow` and `/unfollow` are now aliases to `/add` and `/remove` (for users and tags)
- Add workaround for pleroma markdown processor eating trailing hashtags
- Command replies are now always DM again so we don't spam timelines
## v0.2.5
## v0.2.5 [2021-08-27]
- Add `/undo` command
- Fix users joining via follow not marked as members
## v0.2.4
## v0.2.4 [2021-08-27]
- make account lookup try harder
## v0.2.3
## v0.2.3 [2021-08-27]
- `/add user` will now try to follow even if already a member
## v0.2.2
## v0.2.2 [2021-08-27]
- All hashtags, server names and handles are now lowercased = case-insensitive
- Prevent the `-a` flag overwriting existing group in the config
- Update the help text
- `/i` now works in hashtag posts
- `/add user` and `/remove user` now correctly follow/unfollow
## v0.2.1
## v0.2.1 [2021-08-27]
- More reliable websocket reconnect, workaround for pleroma socket going silent
## v0.2.0
## v0.2.0 [2021-08-27]
- Add hashtag boosting and back-follow/unfollow
- Add hashtag commands
- Code reorganization

2603
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
[package]
name = "fedigroups"
version = "0.4.5"
version = "0.4.6"
authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
edition = "2018"
publish = false
@ -9,24 +9,20 @@ build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
#elefren = { path = "../elefren22-fork" }
elefren = { git = "https://git.ondrovo.com/MightyPork/elefren-fork.git", rev = "b10e5935ae32f4756b19e9ca58b78a5382f865d1" }
#elefren = { path = "../elefren-fork" }
elefren = { git = "https://git.ondrovo.com/MightyPork/elefren-fork.git", rev = "8aa32c060eddb825e46f777661a93ff6f745659d" }
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.2"
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"

@ -2,7 +2,7 @@ use std::process::Command;
use std::str;
fn main() {
let desc_c = Command::new("git").args(&["describe", "--all", "--long"]).output().unwrap();
let desc_c = Command::new("git").args(["describe", "--all", "--long"]).output().unwrap();
let desc = unsafe { str::from_utf8_unchecked(&desc_c.stdout) };

@ -1,3 +0,0 @@
{
"ping_response": "pong, toto je fedigroups verze {version}"
}

@ -23,7 +23,13 @@ pub enum GroupError {
#[error(transparent)]
Serializer5(#[from] json5::Error),
#[error(transparent)]
Elefren(#[from] elefren::Error),
Elefren(Box<elefren::Error>),
}
impl From<elefren::Error> for GroupError {
fn from(e: elefren::Error) -> Self {
Self::Elefren(Box::new(e))
}
}
// this is for tests

@ -843,7 +843,7 @@ fn smart_split(msg: &str, prefix: Option<String>, limit: usize) -> Vec<String> {
while this_piece.len() > limit {
// line too long, try splitting at the last space, if any
let to_send = if let Some(last_space) = (&this_piece[..=limit]).rfind(' ') {
let to_send = if let Some(last_space) = this_piece[..=limit].rfind(' ') {
// println!("line split at word boundary");
let mut p = this_piece.split_off(last_space + 1);
std::mem::swap(&mut p, &mut this_piece);

@ -34,19 +34,11 @@ pub struct GroupHandle {
pub internal: GroupInternal,
}
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct GroupInternal {
recently_seen_notif_statuses: VecDeque<String>,
}
impl Default for GroupInternal {
fn default() -> Self {
Self {
recently_seen_notif_statuses: VecDeque::new(),
}
}
}
#[macro_export]
macro_rules! grp_debug {
($self:ident, $f:expr) => {
@ -138,11 +130,11 @@ impl GroupHandle {
match self.run_internal().await {
Ok(()) => unreachable!(),
Err(e @ GroupError::BadConfig(_)) => {
grp_error!(self, "ERROR in group handler, aborting! {}", e);
grp_error!(self, "ERROR in group handler, aborting! {:?}", e);
return Err(e);
}
Err(other) => {
grp_error!(self, "ERROR in group handler, will restart! {}", other);
grp_error!(self, "ERROR in group handler, will restart! {:?}", other);
tokio::time::sleep(Duration::from_secs_f64(self.cc.delay_reopen_error_s)).await;
}
}
@ -175,7 +167,7 @@ impl GroupHandle {
grp_debug!(self, "No notifs missed");
}
Err(e) => {
grp_error!(self, "Failed to handle missed notifs: {}", e);
grp_error!(self, "Failed to handle missed notifs: {:?}", e);
}
}
}
@ -189,7 +181,7 @@ impl GroupHandle {
grp_debug!(self, "No statuses missed");
}
Err(e) => {
grp_error!(self, "Failed to handle missed statuses: {}", e);
grp_error!(self, "Failed to handle missed statuses: {:?}", e);
}
}
}

@ -31,26 +31,26 @@ async fn main() -> anyhow::Result<()> {
let args = clap::App::new("groups")
.arg(
Arg::with_name("verbose")
.short("v")
.multiple(true)
.short('v')
.multiple_occurrences(true)
.help("increase logging, can be repeated"),
)
.arg(
Arg::with_name("quiet")
.short("q")
.multiple(true)
.short('q')
.multiple_occurrences(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")

@ -25,7 +25,7 @@ struct FixedConfig {
_path: PathBuf,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
struct MutableConfig {
/// Hashtags the group will auto-boost from it's members
@ -48,7 +48,7 @@ struct MutableConfig {
_path: PathBuf,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
struct StateConfig {
/// Last seen notification timestamp (millis)
@ -94,33 +94,6 @@ impl Default for FixedConfig {
}
}
impl Default for MutableConfig {
fn default() -> Self {
Self {
group_tags: Default::default(),
admin_users: Default::default(),
member_users: Default::default(),
banned_users: Default::default(),
optout_users: Default::default(),
member_only: false,
banned_servers: Default::default(),
_dirty: false,
_path: PathBuf::default(),
}
}
}
impl Default for StateConfig {
fn default() -> Self {
Self {
last_notif_ts: 0,
last_status_ts: 0,
_dirty: false,
_path: PathBuf::default(),
}
}
}
macro_rules! impl_change_tracking {
($struc:ident) => {
impl $struc {

@ -149,7 +149,7 @@ impl ConfigStore {
/// Re-auth an existing group
pub async fn reauth_group(&self, acct: &str) -> Result<(), GroupError> {
let group_dir = self.groups_path.join(&acct);
let group_dir = self.groups_path.join(acct);
let mut config = GroupConfig::from_dir(group_dir, &self.config).await?;
@ -203,21 +203,19 @@ impl ConfigStore {
}
};
for e in entries {
if let Ok(e) = e {
let path = e.path();
if path.is_file() && path.extension().unwrap_or_default().to_string_lossy() == "json" {
let filename = path.file_name().unwrap_or_default().to_string_lossy();
debug!("Loading locale {}", filename);
match tokio::fs::read(&path).await {
Ok(f) => {
let locale_name = path.file_stem().unwrap_or_default().to_string_lossy();
self.load_locale(&locale_name, &String::from_utf8_lossy(&f), false);
}
Err(e) => {
error!("Failed to read locale file {}: {}", path.display(), e);
}
for e in entries.flatten() {
let path = e.path();
if path.is_file() && path.extension().unwrap_or_default().to_string_lossy() == "json" {
let filename = path.file_name().unwrap_or_default().to_string_lossy();
debug!("Loading locale {}", filename);
match tokio::fs::read(&path).await {
Ok(f) => {
let locale_name = path.file_stem().unwrap_or_default().to_string_lossy();
self.load_locale(&locale_name, &String::from_utf8_lossy(&f), false);
}
Err(e) => {
error!("Failed to read locale file {}: {}", path.display(), e);
}
}
}

@ -95,6 +95,8 @@ mod test {
pub trait VisExt: Copy {
/// Check if is private or direct
fn is_private(self) -> bool;
#[allow(unused)]
fn make_unlisted(self) -> Self;
}

Loading…
Cancel
Save