replacement in src/pages/reset_game_pwd.rs at line 4
− use handlebars::Handlebars;
replacement in src/pages/reset_game_pwd.rs at line 6
[4.693]→[4.693:774](∅→∅),
[4.774]→[3.0:56](∅→∅) − pub async fn get_reset_game_pwd(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
− let body = match hb.render("reset-game-pwd", &()) {
+ #[actix_web::get("/reset-game-pwd-{token}.html")]
+ pub async fn get_reset_game_pwd(
+ _token: web::Path<String>,
+ data: web::Data<WebData<'_>>,
+ ) -> HttpResponse {
+ let body = match data.handlebars.render("reset-game-pwd", &()) {
replacement in src/pages/reset_game_pwd.rs at line 21
− pub async fn post_reset_game_pwd() -> HttpResponse {
+ #[actix_web::post("/reset-game-pwd.do")]
+ pub async fn post_reset_game_pwd(_data: web::Data<WebData<'_>>) -> HttpResponse {
edit in src/pages/mod.rs at line 1
+ use handlebars::Handlebars;
+
edit in src/pages/mod.rs at line 5
+
+ pub struct WebData<'a> {
+ pub handlebars: Handlebars<'a>,
+ pub pool_ro: deadpool_postgres::Pool,
+ pub pool_rw: deadpool_postgres::Pool,
+ }
replacement in src/pages/index.rs at line 3
− use handlebars::Handlebars;
replacement in src/pages/index.rs at line 5
[4.167]→[4.167:235](∅→∅),
[4.235]→[3.267:314](∅→∅) − pub async fn index(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
− let body = match hb.render("index", &()) {
+ pub async fn index(data: web::Data<WebData<'_>>) -> HttpResponse {
+ let body = match data.handlebars.render("index", &()) {
replacement in src/main.rs at line 9
− use crate::config::Config;
+ use config::{read_dsn, Config};
edit in src/main.rs at line 15
replacement in src/main.rs at line 37
[4.737]→[4.33:69](∅→∅),
[4.69]→[4.737:779](∅→∅),
[4.737]→[4.737:779](∅→∅) − #[cfg(feature = "actix-files")]
− let Config { http, public } = config;
+ let Config {
+ http,
+ dsn_ro_path,
+ dsn_rw_path,
+ dsn_conn,
+ #[cfg(feature = "actix-files")]
+ public,
+ } = config;
replacement in src/main.rs at line 46
− #[cfg(not(feature = "actix-files"))]
− let Config { http } = config;
+ let pg_ro_config = read_dsn(dsn_ro_path)?;
+ let pg_rw_config = read_dsn(dsn_rw_path)?;
+ let mgr_ro = deadpool_postgres::Manager::from_config(
+ pg_ro_config,
+ tokio_postgres::NoTls,
+ deadpool_postgres::ManagerConfig {
+ recycling_method: deadpool_postgres::RecyclingMethod::Fast,
+ },
+ );
+ let mgr_rw = deadpool_postgres::Manager::from_config(
+ pg_rw_config,
+ tokio_postgres::NoTls,
+ deadpool_postgres::ManagerConfig {
+ recycling_method: deadpool_postgres::RecyclingMethod::Fast,
+ },
+ );
+
+ let pool_ro = deadpool_postgres::Pool::builder(mgr_ro)
+ .max_size(dsn_conn)
+ .build()
+ .expect("Postgresql RO pool");
edit in src/main.rs at line 68
+ let pool_rw = deadpool_postgres::Pool::builder(mgr_rw)
+ .max_size(dsn_conn)
+ .build()
+ .expect("Postgresql RW pool");
+
replacement in src/main.rs at line 84
− let handlebars_ref = web::Data::new(handlebars);
+ let data_ref = web::Data::new(WebData {
+ handlebars,
+ pool_ro,
+ pool_rw,
+ });
replacement in src/main.rs at line 101
[2.284]→[4.555:601](∅→∅),
[4.912]→[4.555:601](∅→∅) − .app_data(handlebars_ref.clone())
+ .app_data(data_ref.clone())
replacement in src/main.rs at line 104
[4.1429]→[4.1429:1641](∅→∅) − .route(
− "/reset-game-pwd-{token}.html",
− web::get().to(get_reset_game_pwd),
− )
− .route("/reset-game-pwd.do", web::post().to(post_reset_game_pwd));
+ .service(get_reset_game_pwd)
+ .service(post_reset_game_pwd);
edit in src/config.rs at line 10
+ pub dsn_ro_path: std::path::PathBuf,
+ pub dsn_rw_path: std::path::PathBuf,
+ pub dsn_conn: usize,
edit in src/config.rs at line 19
[4.1699]→[4.1699:1727](∅→∅) edit in src/config.rs at line 21
edit in src/config.rs at line 27
+
+ pub fn read_dsn<P: AsRef<Path>>(path: P) -> io::Result<tokio_postgres::config::Config> {
+ let mut f = File::open(path)?;
+ let mut buffer = String::new();
+
+ use std::io::Read;
+ f.read_to_string(&mut buffer)?;
+
+ use std::str::FromStr;
+ tokio_postgres::config::Config::from_str(&buffer)
+ .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))
+ }
replacement in Cargo.toml at line 21
+ deadpool-postgres = "0.10"
+ uuid = "0.8"
+
+ [dependencies.tokio-postgres]
+ version = "0.7.5"
+ features = ["with-uuid-0_8"]
edit in Cargo.lock at line 253
+
+ [[package]]
+ name = "async-trait"
+ version = "0.1.52"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
+ dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ ]
replacement in Cargo.lock at line 389
[4.17200]→[4.1346:1365](∅→∅) replacement in Cargo.lock at line 391
[4.17284]→[4.1366:1444](∅→∅) − checksum = "2afefa54b5c7dd40918dc1e09f213a171ab5937aadccab45e804780b238f9f43"
+ checksum = "08799f92c961c7a1cf0cc398a9073da99e21ce388b46372c37f3191f2f3eed3e"
edit in Cargo.lock at line 447
+ name = "deadpool"
+ version = "0.9.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "3bf0c5365c0925c80a838a6810a1bf38d3304ca6b4eb25829e29e33da12de786"
+ dependencies = [
+ "async-trait",
+ "deadpool-runtime",
+ "num_cpus",
+ "tokio",
+ ]
+
+ [[package]]
+ name = "deadpool-postgres"
+ version = "0.10.1"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "46ff1451a33b8b31b15eedcf5401dbbb28606caed4fa94d20487eb3fac2ebd04"
+ dependencies = [
+ "deadpool",
+ "log",
+ "tokio",
+ "tokio-postgres",
+ ]
+
+ [[package]]
+ name = "deadpool-runtime"
+ version = "0.1.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "eaa37046cc0f6c3cc6090fbdbf73ef0b8ef4cfcc37f6befc0020f63e8cf121e1"
+ dependencies = [
+ "tokio",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 510
edit in Cargo.lock at line 542
+ name = "fallible-iterator"
+ version = "0.2.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
+
+ [[package]]
edit in Cargo.lock at line 570
[4.20137]→[4.18:259](∅→∅) −
− [[package]]
− name = "foreign-types"
− version = "0.3.2"
− source = "registry+https://github.com/rust-lang/crates.io-index"
− checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
− dependencies = [
− "foreign-types-shared",
− ]
edit in Cargo.lock at line 572
[4.272]→[4.272:463](∅→∅),
[4.463]→[4.20137:20150](∅→∅),
[4.20137]→[4.20137:20150](∅→∅) − name = "foreign-types-shared"
− version = "0.1.1"
− source = "registry+https://github.com/rust-lang/crates.io-index"
− checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
−
− [[package]]
edit in Cargo.lock at line 588
edit in Cargo.lock at line 592
[3.537]→[4.464:476](∅→∅),
[4.3011]→[4.464:476](∅→∅) edit in Cargo.lock at line 594
edit in Cargo.lock at line 596
+ "uuid",
+ ]
+
+ [[package]]
+ name = "futures"
+ version = "0.3.19"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4"
+ dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
edit in Cargo.lock at line 615
+ name = "futures-channel"
+ version = "0.3.19"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"
+ dependencies = [
+ "futures-core",
+ "futures-sink",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 631
+ name = "futures-executor"
+ version = "0.3.19"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a"
+ dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+ ]
+
+ [[package]]
+ name = "futures-io"
+ version = "0.3.19"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2"
+
+ [[package]]
+ name = "futures-macro"
+ version = "0.3.19"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c"
+ dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 676
edit in Cargo.lock at line 678
+ "futures-io",
+ "futures-macro",
+ "futures-sink",
edit in Cargo.lock at line 682
edit in Cargo.lock at line 685
replacement in Cargo.lock at line 720
[4.22198]→[4.6383:6402](∅→∅) replacement in Cargo.lock at line 722
[4.22281]→[4.6403:6481](∅→∅) − checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689"
+ checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e"
edit in Cargo.lock at line 767
+ name = "hmac"
+ version = "0.12.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "ddca131f3e7f2ce2df364b57949a9d47915cfbd35e46cfee355ccebbf794d6a2"
+ dependencies = [
+ "digest 0.10.1",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 920
+
+ [[package]]
+ name = "md-5"
+ version = "0.10.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "e6a38fc55c8bbc10058782919516f88826e70320db6d206aebc49611d24216ae"
+ dependencies = [
+ "digest 0.10.1",
+ ]
replacement in Cargo.lock at line 1018
[4.1894]→[4.1894:1912](∅→∅) replacement in Cargo.lock at line 1020
[4.1977]→[4.1977:2055](∅→∅) − checksum = "71a1eb3a36534514077c1e079ada2fb170ef30c47d203aa6916138cf882ecd52"
+ checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15"
edit in Cargo.lock at line 1036
[4.3882]→[4.3882:3895](∅→∅),
[4.3895]→[4.477:757](∅→∅) −
− [[package]]
− name = "openssl"
− version = "0.10.38"
− source = "registry+https://github.com/rust-lang/crates.io-index"
− checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
− dependencies = [
− "bitflags",
− "cfg-if",
− "foreign-types",
− "libc",
− "once_cell",
− "openssl-sys",
− ]
edit in Cargo.lock at line 1038
[4.770]→[4.770:1038](∅→∅) − name = "openssl-sys"
− version = "0.9.72"
− source = "registry+https://github.com/rust-lang/crates.io-index"
− checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
− dependencies = [
− "autocfg",
− "cc",
− "libc",
− "pkg-config",
− "vcpkg",
− ]
−
− [[package]]
edit in Cargo.lock at line 1127
+ name = "phf"
+ version = "0.10.1"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
+ dependencies = [
+ "phf_shared",
+ ]
+
+ [[package]]
+ name = "phf_shared"
+ version = "0.10.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
+ dependencies = [
+ "siphasher",
+ ]
+
+ [[package]]
replacement in Cargo.lock at line 1157
[4.29526]→[4.1039:1078](∅→∅) − name = "pkg-config"
− version = "0.3.24"
+ name = "postgres-protocol"
+ version = "0.6.3"
replacement in Cargo.lock at line 1160
[4.1143]→[4.1143:1221](∅→∅) − checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
+ checksum = "79ec03bce71f18b4a27c4c64c6ba2ddf74686d69b91d8714fb32ead3adaed713"
+ dependencies = [
+ "base64",
+ "byteorder",
+ "bytes",
+ "fallible-iterator",
+ "hmac",
+ "md-5",
+ "memchr",
+ "rand",
+ "sha2",
+ "stringprep",
+ ]
+
+ [[package]]
+ name = "postgres-types"
+ version = "0.2.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "04619f94ba0cc80999f4fc7073607cb825bc739a883cb6d20900fc5e009d6b0d"
+ dependencies = [
+ "bytes",
+ "fallible-iterator",
+ "postgres-protocol",
+ "uuid",
+ ]
replacement in Cargo.lock at line 1311
[4.33070]→[4.2172:2192](∅→∅) replacement in Cargo.lock at line 1313
[4.33155]→[4.2193:2271](∅→∅) − checksum = "2cf9235533494ea2ddcdb794665461814781c53f19d87b76e571a1c35acbad2b"
+ checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
replacement in Cargo.lock at line 1320
[4.33304]→[4.2272:2292](∅→∅) replacement in Cargo.lock at line 1322
[4.33389]→[4.2293:2371](∅→∅) − checksum = "8dcde03d87d4c973c04be249e7d8f0b35db1c848c487bd43032808e59dd8328d"
+ checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
edit in Cargo.lock at line 1376
+ name = "sha2"
+ version = "0.10.1"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "99c3bd8169c58782adad9290a9af5939994036b76187f7b4f0e6de91dbbfc0ec"
+ dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest 0.10.1",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 1394
+
+ [[package]]
+ name = "siphasher"
+ version = "0.3.9"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e"
edit in Cargo.lock at line 1424
+ name = "stringprep"
+ version = "0.1.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1"
+ dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+ ]
+
+ [[package]]
edit in Cargo.lock at line 1440
+ name = "subtle"
+ version = "2.4.1"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+
+ [[package]]
replacement in Cargo.lock at line 1473
[4.37867]→[4.2884:2902](∅→∅) replacement in Cargo.lock at line 1475
[4.37951]→[4.2903:2981](∅→∅) − checksum = "c8d54b9298e05179c335de2b9645d061255bcd5155f843b3e328d2cfe0a5b413"
+ checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d"
edit in Cargo.lock at line 1519
+ ]
+
+ [[package]]
+ name = "tokio-postgres"
+ version = "0.7.5"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "4b6c8b33df661b548dcd8f9bf87debb8c56c05657ed291122e1188698c2ece95"
+ dependencies = [
+ "async-trait",
+ "byteorder",
+ "bytes",
+ "fallible-iterator",
+ "futures",
+ "log",
+ "parking_lot",
+ "percent-encoding",
+ "phf",
+ "pin-project-lite",
+ "postgres-protocol",
+ "postgres-types",
+ "socket2",
+ "tokio",
+ "tokio-util",
replacement in Cargo.lock at line 1642
[4.42453]→[4.1235:1269](∅→∅) − name = "vcpkg"
− version = "0.2.15"
+ name = "uuid"
+ version = "0.8.2"
replacement in Cargo.lock at line 1645
[4.1334]→[4.1334:1412](∅→∅) − checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"