v1.3.0: add options to flag all shows or specific shows as 18+

This commit is contained in:
xenofem 2023-07-11 12:20:40 -04:00
parent 1528bf3d9a
commit 4ec1794403
6 changed files with 16 additions and 3 deletions

View file

@ -14,6 +14,7 @@ pub struct Config {
pub cohost_password: String,
pub cohost_page: String,
pub cohost_draft: bool,
pub eighteen_plus: bool,
}
const VAR_PREFIX: &str = "SCREENCAP_BOT_";
@ -44,5 +45,6 @@ pub fn load() -> Config {
cohost_password: expect_var("COHOST_PASSWORD"),
cohost_page: expect_var("COHOST_PAGE"),
cohost_draft: parse_var("COHOST_DRAFT").unwrap_or(false),
eighteen_plus: parse_var("18PLUS").unwrap_or(false),
}
}

View file

@ -138,7 +138,7 @@ async fn post_random_screencap<R: Rng>(
attachments: vec![attachment],
tags,
draft: conf.cohost_draft,
adult_content: false,
adult_content: show.eighteen_plus.unwrap_or(conf.eighteen_plus),
headline: String::new(),
markdown: String::new(),
metadata: None,

View file

@ -22,6 +22,8 @@ pub struct Show {
pub parts: HashMap<u32, String>,
#[serde(default = "default_weight")]
pub weight: f32,
#[serde(default, rename = "18+")]
pub eighteen_plus: Option<bool>,
}
fn default_weight() -> f32 {