Overview
Comment: | 0.2.2: finally regex works |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fb629f170b6a5eaa3ff93464ee8d6cda |
User & Date: | arcade on 2021-11-13 21:50:00.869 |
Other Links: | manifest | tags |
Context
2021-11-13
| ||
23:16 | fix list, add "-" for disabled fields, some reordering check-in: c1e27b74ed user: arcade tags: trunk | |
21:50 | 0.2.2: finally regex works check-in: fb629f170b user: arcade tags: trunk | |
20:37 | fix messages, store edit string check-in: 10c25017bb user: arcade tags: trunk | |
Changes
Modified Cargo.lock
from [42d6ae8928]
to [9911509215].
︙ | ︙ | |||
2044 2045 2046 2047 2048 2049 2050 | "derive_builder 0.9.0", "quick-xml 0.17.2", "reqwest 0.9.24", ] [[package]] name = "rsstg" | | | 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | "derive_builder 0.9.0", "quick-xml 0.17.2", "reqwest 0.9.24", ] [[package]] name = "rsstg" version = "0.2.2" dependencies = [ "anyhow", "atom_syndication", "chrono", "config", "futures 0.3.17", "futures-util", |
︙ | ︙ |
Modified Cargo.toml
from [1da50d0627]
to [87c378d1a8].
1 2 | [package] name = "rsstg" | | | 1 2 3 4 5 6 7 8 9 10 | [package] name = "rsstg" version = "0.2.2" authors = ["arcade"] edition = "2018" [dependencies] anyhow = "*" atom_syndication = { version = "*", features = [ "with-serde" ] } chrono = "*" |
︙ | ︙ |
Modified src/core.rs
from [a89bbcb26a]
to [8a3bc181d9].
︙ | ︙ | |||
98 99 100 101 102 103 104 | .bind(*id) .bind(owner) .fetch_one(&mut conn).await .with_context(|| format!("Query source:\n{:?}", &self.pool))?; drop(conn); let channel_id: i64 = row.try_get("channel_id")?; let url: &str = row.try_get("url")?; | < < < < < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | .bind(*id) .bind(owner) .fetch_one(&mut conn).await .with_context(|| format!("Query source:\n{:?}", &self.pool))?; drop(conn); let channel_id: i64 = row.try_get("channel_id")?; let url: &str = row.try_get("url")?; let iv_hash: Option<&str> = row.try_get("iv_hash")?; let url_re = match row.try_get("url_re")? { Some(x) => Some(sedregex::ReplaceCommand::new(x)?), None => None, }; let destination = match real { true => telegram_bot::UserId::new(channel_id), false => telegram_bot::UserId::new(row.try_get("owner")?), |
︙ | ︙ | |||
160 161 162 163 164 165 166 | let exists: bool = row.try_get("exists")?; if ! exists { if this_fetch == None || *date > this_fetch.unwrap() { this_fetch = Some(*date); }; self.tg.send( match iv_hash { Some(hash) => telegram_bot::SendMessage::new(destination, format!("<a href=\"https://t.me/iv?url={}&rhash={}\"> </a>{0}", match url_re { | < | < < | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | let exists: bool = row.try_get("exists")?; if ! exists { if this_fetch == None || *date > this_fetch.unwrap() { this_fetch = Some(*date); }; self.tg.send( match iv_hash { Some(hash) => telegram_bot::SendMessage::new(destination, format!("<a href=\"https://t.me/iv?url={}&rhash={}\"> </a>{0}", match url_re { Some(ref x) => x.execute(url).to_string(), None => url.to_string(), }, hash)), None => telegram_bot::SendMessage::new(destination, format!("{}", url)), }.parse_mode(telegram_bot::types::ParseMode::Html)).await .context("Can't post message:")?; sqlx::query("insert into rsstg_post (source_id, posted, url) values ($1, $2, $3);") .bind(*id) .bind(date) |
︙ | ︙ | |||
315 316 317 318 319 320 321 | let mut queue = sqlx::query("select source_id, next_fetch, owner from rsstg_order natural left join rsstg_source where next_fetch < now() + interval '1 minute';") .fetch_all(&mut conn).await?; for row in queue.iter() { let source_id: i32 = row.try_get("source_id")?; let owner: i64 = row.try_get("owner")?; let next_fetch: DateTime<chrono::Local> = row.try_get("next_fetch")?; if next_fetch < now { | < < | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | let mut queue = sqlx::query("select source_id, next_fetch, owner from rsstg_order natural left join rsstg_source where next_fetch < now() + interval '1 minute';") .fetch_all(&mut conn).await?; for row in queue.iter() { let source_id: i32 = row.try_get("source_id")?; let owner: i64 = row.try_get("owner")?; let next_fetch: DateTime<chrono::Local> = row.try_get("next_fetch")?; if next_fetch < now { let clone = Core { owner_chat: telegram_bot::UserId::new(owner), ..self.clone() }; tokio::spawn(async move { if let Err(err) = clone.check(&source_id, owner, true).await { if let Err(err) = clone.send(&format!("🛑 {:?}", err), None, None) { |
︙ | ︙ |