mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-20 20:41:17 +02:00
✨: hashtag removal is now optional
This commit is contained in:
@@ -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)]
|
||||
|
@@ -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 can’t strip something
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user