Index: Cargo.lock
==================================================================
--- Cargo.lock
+++ Cargo.lock
@@ -52,13 +52,13 @@
"alloc-no-stdlib",
]
[[package]]
name = "anyhow"
-version = "1.0.45"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7"
+checksum = "38d9ff5d688f1c13395289f67db01d4826b46dd694e7580accdc3e8430f2d98e"
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -73,11 +73,11 @@
"brotli",
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
- "tokio 1.13.0",
+ "tokio 1.14.0",
]
[[package]]
name = "atoi"
version = "0.4.0"
@@ -897,11 +897,11 @@
"futures-sink",
"futures-util",
"http 0.2.5",
"indexmap",
"slab",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tokio-util",
"tracing",
]
[[package]]
@@ -1007,13 +1007,13 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
[[package]]
name = "httpdate"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"
+checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
version = "0.12.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1043,13 +1043,13 @@
"want 0.2.0",
]
[[package]]
name = "hyper"
-version = "0.14.14"
+version = "0.14.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b"
+checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"
dependencies = [
"bytes 1.1.0",
"futures-channel",
"futures-core",
"futures-util",
@@ -1059,11 +1059,11 @@
"httparse",
"httpdate",
"itoa",
"pin-project-lite",
"socket2",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tower-service",
"tracing",
"want 0.3.0",
]
@@ -1085,13 +1085,13 @@
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
"bytes 1.1.0",
- "hyper 0.14.14",
+ "hyper 0.14.15",
"native-tls",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tokio-native-tls",
]
[[package]]
name = "ident_case"
@@ -1528,13 +1528,13 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
[[package]]
name = "openssl-sys"
-version = "0.9.70"
+version = "0.9.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf"
+checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73"
dependencies = [
"autocfg 1.0.1",
"cc",
"libc",
"pkg-config",
@@ -2010,11 +2010,11 @@
"encoding_rs",
"futures-core",
"futures-util",
"http 0.2.5",
"http-body 0.4.4",
- "hyper 0.14.14",
+ "hyper 0.14.15",
"hyper-tls 0.5.0",
"ipnet",
"js-sys",
"lazy_static",
"log",
@@ -2023,11 +2023,11 @@
"percent-encoding 2.1.0",
"pin-project-lite",
"serde 1.0.130",
"serde_json",
"serde_urlencoded 0.7.0",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tokio-native-tls",
"tokio-util",
"url 2.2.2",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -2046,11 +2046,11 @@
"reqwest 0.9.24",
]
[[package]]
name = "rsstg"
-version = "0.2.2"
+version = "0.2.3"
dependencies = [
"anyhow",
"atom_syndication",
"chrono",
"config",
@@ -2061,11 +2061,11 @@
"reqwest 0.11.6",
"rss",
"sedregex",
"sqlx",
"telegram-bot",
- "tokio 1.13.0",
+ "tokio 1.14.0",
]
[[package]]
name = "rust-ini"
version = "0.13.0"
@@ -2204,13 +2204,13 @@
"syn",
]
[[package]]
name = "serde_json"
-version = "1.0.70"
+version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3"
+checksum = "063bf466a64011ac24040a49009724ee60a57da1b437617ceb32e53ad61bfb19"
dependencies = [
"itoa",
"ryu",
"serde 1.0.130",
]
@@ -2392,11 +2392,11 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d1bd069de53442e7a320f525a6d4deb8bb0621ac7a55f7eccbc2b58b57f43d0"
dependencies = [
"native-tls",
"once_cell",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tokio-native-tls",
]
[[package]]
name = "static_assertions"
@@ -2469,15 +2469,15 @@
version = "0.9.0"
source = "git+https://github.com/telegram-rs/telegram-bot#65ad5cfd578e9a1260ce6daac714eb2153c0bec7"
dependencies = [
"bytes 1.1.0",
"futures 0.3.17",
- "hyper 0.14.14",
+ "hyper 0.14.15",
"hyper-tls 0.5.0",
"multipart",
"telegram-bot-raw",
- "tokio 1.13.0",
+ "tokio 1.14.0",
"tracing",
"tracing-futures",
]
[[package]]
@@ -2570,13 +2570,13 @@
"tokio-timer",
]
[[package]]
name = "tokio"
-version = "1.13.0"
+version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"
+checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
dependencies = [
"autocfg 1.0.1",
"bytes 1.1.0",
"libc",
"memchr",
@@ -2629,13 +2629,13 @@
"log",
]
[[package]]
name = "tokio-macros"
-version = "1.5.1"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"
+checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
@@ -2645,11 +2645,11 @@
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
dependencies = [
"native-tls",
- "tokio 1.13.0",
+ "tokio 1.14.0",
]
[[package]]
name = "tokio-reactor"
version = "0.1.12"
@@ -2675,11 +2675,11 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3"
dependencies = [
"futures-core",
"pin-project-lite",
- "tokio 1.13.0",
+ "tokio 1.14.0",
]
[[package]]
name = "tokio-sync"
version = "0.1.8"
@@ -2742,11 +2742,11 @@
"bytes 1.1.0",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
- "tokio 1.13.0",
+ "tokio 1.14.0",
]
[[package]]
name = "toml"
version = "0.5.8"
Index: Cargo.toml
==================================================================
--- Cargo.toml
+++ Cargo.toml
@@ -1,8 +1,8 @@
[package]
name = "rsstg"
-version = "0.2.2"
+version = "0.2.3"
authors = ["arcade"]
edition = "2018"
[dependencies]
anyhow = "*"
Index: src/core.rs
==================================================================
--- src/core.rs
+++ src/core.rs
@@ -150,33 +150,33 @@
}
};
for (date, url) in posts.iter() {
let mut conn = self.pool.acquire().await
.with_context(|| format!("Check post fetch conn:\n{:?}", &self.pool))?;
+ let post_url = match url_re {
+ Some(ref x) => x.execute(url).to_string(),
+ None => url.to_string(),
+ };
let row = sqlx::query("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;")
- .bind(url)
+ .bind(&post_url)
.bind(*id)
.fetch_one(&mut conn).await
.with_context(|| format!("Check post:\n{:?}", &conn))?;
let exists: bool = row.try_get("exists")?;
if ! exists {
if this_fetch == None || *date > this_fetch.unwrap() {
this_fetch = Some(*date);
};
- let post_url = match url_re {
- Some(ref x) => x.execute(url).to_string(),
- None => url.to_string(),
- };
self.tg.send( match iv_hash {
- Some(hash) => telegram_bot::SendMessage::new(destination, format!(" {0}", post_url, hash)),
+ Some(hash) => telegram_bot::SendMessage::new(destination, format!(" {0}", &post_url, hash)),
None => telegram_bot::SendMessage::new(destination, format!("{}", post_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)
- .bind(url)
+ .bind(post_url)
.execute(&mut conn).await
.with_context(|| format!("Record post:\n{:?}", &conn))?;
drop(conn);
tokio::time::sleep(std::time::Duration::new(4, 0)).await;
};