Skip to content

Commit

Permalink
support DO_NOT_POST=1 for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Dec 22, 2023
1 parent a229883 commit 79a2443
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
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),
Expand All @@ -219,7 +220,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
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(())
}

0 comments on commit 79a2443

Please sign in to comment.