Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package forgejo-guardian for openSUSE:Factory checked in at 2025-02-03 21:43:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/forgejo-guardian (Old) and /work/SRC/openSUSE:Factory/.forgejo-guardian.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "forgejo-guardian" Mon Feb 3 21:43:19 2025 rev:3 rq:1242013 version:0.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/forgejo-guardian/forgejo-guardian.changes 2025-01-29 16:19:02.665032992 +0100 +++ /work/SRC/openSUSE:Factory/.forgejo-guardian.new.2316/forgejo-guardian.changes 2025-02-03 21:43:47.891186930 +0100 @@ -1,0 +2,6 @@ +Sat Feb 1 00:28:12 UTC 2025 - Richard Rahl <rra...@opensuse.org> + +- update to 0.5.1: + * Enhance ban/sus logs to display the location + +------------------------------------------------------------------- Old: ---- forgejo-guardian-0.5.0.obscpio New: ---- forgejo-guardian-0.5.1.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ forgejo-guardian.spec ++++++ --- /var/tmp/diff_new_pack.0XLXIQ/_old 2025-02-03 21:43:49.731262881 +0100 +++ /var/tmp/diff_new_pack.0XLXIQ/_new 2025-02-03 21:43:49.731262881 +0100 @@ -17,7 +17,7 @@ Name: forgejo-guardian -Version: 0.5.0 +Version: 0.5.1 Release: 0 Summary: Simple Forgejo instance guardian License: AGPL-3.0-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.0XLXIQ/_old 2025-02-03 21:43:49.759264037 +0100 +++ /var/tmp/diff_new_pack.0XLXIQ/_new 2025-02-03 21:43:49.759264037 +0100 @@ -3,7 +3,7 @@ <service name="obs_scm" mode="manual"> <param name="scm">git</param> <param name="url">https://git.4rs.nl/awiteb/forgejo-guardian</param> - <param name="revision">refs/tags/v0.5.0</param> + <param name="revision">refs/tags/v0.5.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> </service> ++++++ forgejo-guardian-0.5.0.obscpio -> forgejo-guardian-0.5.1.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/CHANGELOG.md new/forgejo-guardian-0.5.1/CHANGELOG.md --- old/forgejo-guardian-0.5.0/CHANGELOG.md 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/CHANGELOG.md 2025-01-29 10:22:53.000000000 +0100 @@ -6,6 +6,10 @@ ## unreleased ### Added +- Enhance ban/sus logs to display the location ([**#33**](https://git.4rs.nl/awiteb/forgejo-guardian/issues/33)) ([`f39e874`](https://git.4rs.nl/awiteb/forgejo-guardian/commit/f39e874446baf647c3697e5fa8287a604b99b7f5)) + +## [0.5.0](https://git.4rs.nl/awiteb/forgejo-guardian/compare/v0.4.1..v0.5.0) - 2025-01-28 +### Added - Ability to check user tokens and oauth2 apps ([**#25**](https://git.4rs.nl/awiteb/forgejo-guardian/issues/25)) ([`1e90760`](https://git.4rs.nl/awiteb/forgejo-guardian/commit/1e907609cd9fae24e58cbe9eab99cc4b88459cb3)) - **BC**: The minimum value for `inactive.req_limit` changed to 4 - Ability to enter seconds in the interval without `s` suffix ([**#28**](https://git.4rs.nl/awiteb/forgejo-guardian/issues/28)) ([`c9dfc6e`](https://git.4rs.nl/awiteb/forgejo-guardian/commit/c9dfc6e57acdfbdbc2485d729ce24edcab292224)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/Cargo.lock new/forgejo-guardian-0.5.1/Cargo.lock --- old/forgejo-guardian-0.5.0/Cargo.lock 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/Cargo.lock 2025-01-29 10:22:53.000000000 +0100 @@ -332,7 +332,7 @@ [[package]] name = "forgejo-guardian" -version = "0.5.0" +version = "0.5.1" dependencies = [ "chrono", "regex", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/Cargo.toml new/forgejo-guardian-0.5.1/Cargo.toml --- old/forgejo-guardian-0.5.0/Cargo.toml 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/Cargo.toml 2025-01-29 10:22:53.000000000 +0100 @@ -1,7 +1,7 @@ [package] name = "forgejo-guardian" description = "Simple Forgejo instance guardian, banning users and alerting admins based on certain regular expressions" -version = "0.5.0" +version = "0.5.1" edition = "2021" authors = ["Awiteb <a...@4rs.nl>"] repository = "https://git.4rs.nl/awiteb/forgejo-guardian" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/README.md new/forgejo-guardian-0.5.1/README.md --- old/forgejo-guardian-0.5.0/README.md 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/README.md 2025-01-29 10:22:53.000000000 +0100 @@ -320,6 +320,10 @@ If you would like to contribute by adding a new language, you can do that by adding your language file in the `locales` directory, and then add it to `Lang` enum in `src/telegram_bot/mod.rs` file. Then you can use it in the configuration file. +## Mirrors +- [Codeberg](https://codeberg.org/awiteb/forgejo-guardian) +- [GitHub](https://github.com/theawiteb/forgejo-guardian) + ## License This project is licensed under the [AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.html) license. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/docker/Dockerfile new/forgejo-guardian-0.5.1/docker/Dockerfile --- old/forgejo-guardian-0.5.0/docker/Dockerfile 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/docker/Dockerfile 2025-01-29 10:22:53.000000000 +0100 @@ -3,7 +3,7 @@ WORKDIR /app RUN apk add --no-cache curl -RUN curl https://git.4rs.nl/awiteb/forgejo-guardian/releases/download/v0.5.0/forgejo-guardian-v0.5.0-x86_64-linux-musl --output forgejo-guardian +RUN curl https://git.4rs.nl/awiteb/forgejo-guardian/releases/download/v0.5.1/forgejo-guardian-v0.5.1-x86_64-linux-musl --output forgejo-guardian RUN chmod +x forgejo-guardian ENTRYPOINT ["./forgejo-guardian"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/src/config/locations.rs new/forgejo-guardian-0.5.1/src/config/locations.rs --- old/forgejo-guardian-0.5.0/src/config/locations.rs 1970-01-01 01:00:00.000000000 +0100 +++ new/forgejo-guardian-0.5.1/src/config/locations.rs 2025-01-29 10:22:53.000000000 +0100 @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +// Copyright (C) 2024-2025 Awiteb <a...@4rs.nl> + +use std::fmt; + +/// The location where the regex got matched +#[derive(Debug, Clone)] +pub enum Locations { + // This is the location before match it + Unknown, + Username, + FullName, + Biographie, + Email, + Website, + Location, +} + +impl fmt::Display for Locations { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Locations::Unknown => write!(f, "unknown"), + Locations::Username => write!(f, "username"), + Locations::FullName => write!(f, "full name"), + Locations::Biographie => write!(f, "biographie"), + Locations::Email => write!(f, "email"), + Locations::Website => write!(f, "website"), + Locations::Location => write!(f, "location"), + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/src/config/mod.rs new/forgejo-guardian-0.5.1/src/config/mod.rs --- old/forgejo-guardian-0.5.0/src/config/mod.rs 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/src/config/mod.rs 2025-01-29 10:22:53.000000000 +0100 @@ -18,9 +18,12 @@ mod boolean; mod defaults; mod deserializers; +pub mod locations; pub mod parse_invalid; mod utils; +use locations::Locations; + /// Ban action to take when banning a user #[derive(Debug, Deserialize)] #[serde(rename_all = "lowercase")] @@ -126,6 +129,8 @@ pub re_vec: Vec<Regex>, /// Optional reason pub reason: Option<String>, + /// The location where the regex got matched + location: Locations, } /// The expression @@ -246,8 +251,18 @@ impl RegexReason { /// Create a new `RegexReason` instance - fn new(re: Vec<Regex>, reason: Option<String>) -> Self { - Self { re_vec: re, reason } + pub fn new(re: Vec<Regex>, reason: Option<String>) -> Self { + Self { + re_vec: re, + reason, + location: Locations::Unknown, + } + } + + /// Set the location of the regex + pub fn location(mut self, location: Locations) -> Self { + self.location = location; + self } } @@ -263,13 +278,17 @@ impl Display for RegexReason { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - for re in &self.re_vec { - write!(f, "{re} ").ok(); + for (idx, re) in self.re_vec.iter().enumerate() { + if idx == (self.re_vec.len() - 1) { + write!(f, "{re}").ok(); + } else { + write!(f, "{re}, ").ok(); + } } if let Some(ref reason) = self.reason { write!(f, " ({reason})").ok(); }; - Ok(()) + write!(f, " in their {}", self.location) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/src/main.rs new/forgejo-guardian-0.5.1/src/main.rs --- old/forgejo-guardian-0.5.0/src/main.rs 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/src/main.rs 2025-01-29 10:22:53.000000000 +0100 @@ -118,6 +118,17 @@ )); if !config.expressions.only_new_users { + tracing::info!( + config = "expressions", + "Request limit for old users: {}", + config.expressions.req_limit + ); + tracing::info!( + config = "expressions", + "Interval when hitting the limit for old users: {} seconds", + config.expressions.req_interval + ); + tokio::spawn(users_fetcher::old_users( Arc::clone(&config), cancellation_token.clone(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forgejo-guardian-0.5.0/src/traits.rs new/forgejo-guardian-0.5.1/src/traits.rs --- old/forgejo-guardian-0.5.0/src/traits.rs 2025-01-28 20:22:43.000000000 +0100 +++ new/forgejo-guardian-0.5.1/src/traits.rs 2025-01-29 10:22:53.000000000 +0100 @@ -2,7 +2,7 @@ // Copyright (C) 2024-2025 Awiteb <a...@4rs.nl> use crate::{ - config::{Expr, RegexReason}, + config::{locations::Locations, Expr, RegexReason}, forgejo_api::ForgejoUser, }; @@ -29,17 +29,17 @@ exprs .iter() .find(|re_re| re_re.re_vec.iter().all(|re| re.is_match(&hay))) + .cloned() }; [ - one_of(&user.username, &self.usernames), - one_of(&user.full_name, &self.full_names), - one_of(&user.biography, &self.biographies), - one_of(&user.email, &self.emails), - one_of(&user.website, &self.websites), - one_of(&user.location, &self.locations), + one_of(&user.username, &self.usernames).map(|r| r.location(Locations::Username)), + one_of(&user.full_name, &self.full_names).map(|r| r.location(Locations::FullName)), + one_of(&user.biography, &self.biographies).map(|r| r.location(Locations::Biographie)), + one_of(&user.email, &self.emails).map(|r| r.location(Locations::Email)), + one_of(&user.website, &self.websites).map(|r| r.location(Locations::Website)), + one_of(&user.location, &self.locations).map(|r| r.location(Locations::Location)), ] .into_iter() .find_map(|v| v) - .cloned() } } ++++++ forgejo-guardian.obsinfo ++++++ --- /var/tmp/diff_new_pack.0XLXIQ/_old 2025-02-03 21:43:49.899269815 +0100 +++ /var/tmp/diff_new_pack.0XLXIQ/_new 2025-02-03 21:43:49.903269981 +0100 @@ -1,5 +1,5 @@ name: forgejo-guardian -version: 0.5.0 -mtime: 1738092163 -commit: e82f4a1e1f195f0778eb52ee6a87181f4bbc60e4 +version: 0.5.1 +mtime: 1738142573 +commit: 0f98bd6ab090ccd4b22bd89b01af08113347d01f ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/forgejo-guardian/vendor.tar.zst /work/SRC/openSUSE:Factory/.forgejo-guardian.new.2316/vendor.tar.zst differ: char 7, line 1