Overview
| Comment: | v0.2.20: fix bug with sending wrong url in prev build, fix StreamExt, autodisable sources for users who blocked bot |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
3dc9cddd4d641491d9a0db4fe9ca13b9 |
| User & Date: | arcade on 2023-08-04 16:19:21.893 |
| Other Links: | manifest | tags |
Context
|
2023-10-04
| ||
| 07:36 | bump check-in: 58da576b83 user: arcade tags: trunk | |
|
2023-08-04
| ||
| 16:19 | v0.2.20: fix bug with sending wrong url in prev build, fix StreamExt, autodisable sources for users who blocked bot check-in: 3dc9cddd4d user: arcade tags: trunk | |
| 15:41 | bump and rewrite all database access to macros check-in: 9910c2209c user: arcade tags: trunk | |
Changes
Modified Cargo.lock
from [4cf3b2a4c1]
to [a1fc12efc0].
| ︙ | ︙ | |||
2372 2373 2374 2375 2376 2377 2378 | "derive_builder 0.9.0", "quick-xml 0.17.2", "reqwest 0.9.24", ] [[package]] name = "rsstg" | | | | 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | "derive_builder 0.9.0", "quick-xml 0.17.2", "reqwest 0.9.24", ] [[package]] name = "rsstg" version = "0.2.19" dependencies = [ "anyhow", "async-std", "atom_syndication", "chrono", "config", "futures 0.1.31", "futures-util", "lazy_static", "regex", "reqwest 0.11.18", "rss", "sedregex", "sqlx", |
| ︙ | ︙ |
Modified Cargo.toml
from [f0efba3339]
to [7d1e206b5e].
1 2 | [package] name = "rsstg" | | | 1 2 3 4 5 6 7 8 9 10 |
[package]
name = "rsstg"
version = "0.2.20"
authors = ["arcade"]
edition = "2021"
[dependencies]
anyhow = "*"
async-std = { version = "*", features = [ "tokio1" ] }
atom_syndication = { version = "*", features = [ "with-serde" ] }
|
| ︙ | ︙ |
Modified src/core.rs
from [ec9c851bcd]
to [01d7e6c2a7].
| ︙ | ︙ | |||
133 134 135 136 137 138 139 |
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{:#?}\n{:#?}\n", &source.url, err, status)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
| | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{:#?}\n{:#?}\n", &source.url, err, status)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
Some(ref x) => sedregex::ReplaceCommand::new(x)?.execute(url),
None => url.into(),
};
if let Some(exists) = sqlx::query!("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;",
&post_url, *id).fetch_one(&mut self.pool.acquire().await?).await?.exists {
if ! exists {
if this_fetch.is_none() || *date > this_fetch.unwrap() {
this_fetch = Some(*date);
|
| ︙ | ︙ | |||
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
owner_chat: telegram_bot::UserId::new(owner),
..self.clone()
};
task::spawn(async move {
if let Err(err) = clone.check(&source_id, owner, true).await {
if let Err(err) = clone.send(&format!("🛑 {:?}", err), None, None).await {
eprintln!("Check error: {}", err);
};
};
});
}
} else if next_fetch - now < delay {
delay = next_fetch - now;
}
| > | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
owner_chat: telegram_bot::UserId::new(owner),
..self.clone()
};
task::spawn(async move {
if let Err(err) = clone.check(&source_id, owner, true).await {
if let Err(err) = clone.send(&format!("🛑 {:?}", err), None, None).await {
eprintln!("Check error: {}", err);
clone.disable(&source_id, owner).await.unwrap();
};
};
});
}
} else if next_fetch - now < delay {
delay = next_fetch - now;
}
|
| ︙ | ︙ |
Modified src/main.rs
from [18f838c1d7]
to [a5ac45f16b].
1 2 3 4 5 | mod command; mod core; use anyhow::Result; use async_std::task; | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
mod command;
mod core;
use anyhow::Result;
use async_std::task;
use async_std::stream::StreamExt;
fn main() -> Result<()> {
let settings = config::Config::builder()
.add_source(config::File::with_name("rsstg"))
.build()?;
let core = core::Core::new(settings)?;
|
| ︙ | ︙ |