From 79a24438fd9bc2ab8b3efc66c2b7a427592859f7 Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 22 Dec 2023 15:25:50 +0900 Subject: [PATCH] support DO_NOT_POST=1 for debugging --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 192d9f6..d0a4279 100644 --- a/src/main.rs +++ b/src/main.rs @@ -205,6 +205,7 @@ async fn main() -> Result<(), Box> { let bsky_password = std::env::var("BSKY_PASSWORD")?; let bsky_api_url = std::env::var("BSKY_API_URL").unwrap_or_else(|_| BSKY_API_DEFAULT_URL.into()); + let do_not_post = std::env::var("DO_NOT_POST").is_ok(); let bsky_agent = AtpAgent::new( ReqwestClient::new(bsky_api_url), @@ -219,7 +220,15 @@ async fn main() -> Result<(), Box> { let feed = get_feed(rss_url).await?; let posts = get_bsky_posts(&bsky_agent).await?; let new_entries = find_new_entries(&session, feed, posts).await?; - post_entries(&bsky_agent, &session, new_entries).await?; + + if !do_not_post { + post_entries(&bsky_agent, &session, new_entries).await?; + } else { + println!("Found {} new entries", new_entries.len()); + for entry in new_entries { + println!(" {} {}", entry.title.as_ref().unwrap().content, entry.id); + } + } Ok(()) }