From 259032a7b9a2bf4ebd57e9ba9fc1bfdcdaa90a66 Mon Sep 17 00:00:00 2001 From: VC Date: Sat, 21 Jun 2025 12:48:59 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8:=20hashtag=20removal=20is=20now=20opt?= =?UTF-8?q?ional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- src/config.rs | 11 +++++++++++ src/lib.rs | 7 ++++++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc298e1..2345e11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2037,7 +2037,7 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "oolatoocs" -version = "4.2.3" +version = "4.3.0" dependencies = [ "atrium-api", "bsky-sdk", @@ -2470,9 +2470,9 @@ dependencies = [ [[package]] name = "ravif" -version = "0.11.12" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a5f31fcf7500f9401fea858ea4ab5525c99f2322cfcee732c0e6c74208c0c6" +checksum = "5825c26fddd16ab9f515930d49028a630efec172e903483c94796cfe31893e6b" dependencies = [ "avif-serialize", "imgref", @@ -3066,9 +3066,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.103" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 89d9637..edf3d3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oolatoocs" -version = "4.2.3" +version = "4.3.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/config.rs b/src/config.rs index eda2d70..df304e5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,6 +11,17 @@ pub struct Config { #[derive(Debug, Deserialize)] pub struct OolatoocsConfig { pub db_path: String, + #[serde(default)] + pub remove_hashtags: bool, +} + +impl Default for OolatoocsConfig { + fn default() -> Self { + OolatoocsConfig { + db_path: "/var/lib/oolatoocs/db".to_string(), + remove_hashtags: false, + } + } } #[derive(Debug, Deserialize)] diff --git a/src/lib.rs b/src/lib.rs index 2f77a4a..f044748 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,12 @@ pub async fn run(config: &Config) { } // form tweet_content and strip everything useless in it - let Ok(mut tweet_content) = strip_everything(&toot.content, &toot.tags) else { + let toot_tags: Vec = + match &config.oolatoocs.remove_hashtags { + true => toot.tags.clone(), + false => vec![], + }; + let Ok(mut tweet_content) = strip_everything(&toot.content, &toot_tags) else { continue; // skip in case we can’t strip something };