: hashtag removal is now optional

This commit is contained in:
VC
2025-06-21 12:48:59 +02:00
parent e7f0c9c6f5
commit 259032a7b9
4 changed files with 23 additions and 7 deletions

View File

@@ -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)]

View File

@@ -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<megalodon::entities::status::Tag> =
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 cant strip something
};