diff --git a/Cargo.lock b/Cargo.lock index ecbaa37..b958525 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -67,9 +67,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -97,9 +97,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -171,18 +171,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -209,16 +209,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "atomic-write-file" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" -dependencies = [ - "nix", - "rand", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -226,10 +216,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "backtrace" -version = "0.3.69" +name = "axum" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.0", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -283,9 +328,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -301,9 +346,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -311,9 +356,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.0" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "bytecount" @@ -323,9 +368,9 @@ checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "bytemuck" -version = "1.14.3" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" @@ -335,9 +380,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "camino" @@ -350,9 +395,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -372,12 +417,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" @@ -387,9 +429,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -397,7 +439,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -513,9 +555,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -597,9 +639,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.6" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -607,27 +649,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.6" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "darling_macro" -version = "0.20.6" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -714,11 +756,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -775,9 +817,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c012a26a7f605efc424dd53697843a72be7dc86ad2d01f7814337794a12231d" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ "anstream", "anstyle", @@ -833,20 +875,20 @@ name = "extract_derive" version = "0.1.0" dependencies = [ "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "figment" -version = "0.10.14" +version = "0.10.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6e5bc7bd59d60d0d45a6ccab6cf0f4ce28698fb4e81e750ddf229c9b824026" +checksum = "7270677e7067213e04f323b55084586195f18308cd7546cfac9f873344ccceb6" dependencies = [ "atomic 0.6.0", "pear", @@ -1001,7 +1043,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -1081,9 +1123,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", "polyval", @@ -1110,7 +1152,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -1127,16 +1169,35 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", "indexmap", "slab", "tokio", @@ -1174,9 +1235,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1213,9 +1274,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1229,7 +1301,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1270,9 +1365,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.25", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1284,6 +1379,27 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.3", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1291,24 +1407,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", - "rustls", + "http 0.2.12", + "hyper 0.14.28", + "rustls 0.21.10", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper", + "http-body-util", + "hyper 1.2.0", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1360,7 +1499,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "same-file", "walkdir", "winapi-util", @@ -1368,9 +1507,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -1446,9 +1585,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1493,7 +1632,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -1552,9 +1691,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "loom" @@ -1580,6 +1719,12 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + [[package]] name = "md-5" version = "0.10.6" @@ -1644,9 +1789,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", @@ -1663,7 +1808,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 0.2.12", "httparse", "log", "memchr", @@ -1692,17 +1837,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nix" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -1728,7 +1862,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crossbeam-channel", "filetime", "fsevent-sys", @@ -1834,9 +1968,9 @@ dependencies = [ "base64 0.13.1", "chrono", "getrandom", - "http", + "http 0.2.12", "rand", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_path_to_error", @@ -1862,9 +1996,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" @@ -1872,7 +2006,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -1889,7 +2023,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -1900,9 +2034,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.100" +version = "0.9.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae94056a791d0e1217d18b6cbdccb02c61e3054fc69893607f4067e3bb0b1fd1" +checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" dependencies = [ "cc", "libc", @@ -1956,9 +2090,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pear" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" +checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" dependencies = [ "inlinable_string", "pear_codegen", @@ -1967,14 +2101,14 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" +checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -1994,9 +2128,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" +checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" dependencies = [ "memchr", "thiserror", @@ -2005,9 +2139,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" +checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026" dependencies = [ "pest", "pest_generator", @@ -2015,22 +2149,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" +checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "pest_meta" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" +checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293" dependencies = [ "once_cell", "pest", @@ -2075,6 +2209,26 @@ dependencies = [ "siphasher", ] +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.55", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -2140,14 +2294,14 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -2155,22 +2309,6 @@ dependencies = [ "universal-hash", ] -[[package]] -name = "postman" -version = "0.1.0" -dependencies = [ - "chrono", - "chrono-tz", - "lazy_static", - "log", - "num-integer", - "regex", - "serde", - "serenity", - "sqlx", - "tokio", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -2185,9 +2323,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -2200,7 +2338,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", "version_check", "yansi", ] @@ -2232,7 +2370,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "memchr", "unicase", ] @@ -2281,7 +2419,7 @@ name = "recordable_derive" version = "0.1.0" dependencies = [ "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -2310,18 +2448,18 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -2336,9 +2474,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -2361,9 +2499,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" name = "reminder-rs" version = "1.7.3" dependencies = [ + "axum", "base64 0.21.7", "chrono", "chrono-tz", + "csv", "dotenv", "env_logger", "extract_derive", @@ -2373,80 +2513,58 @@ dependencies = [ "levenshtein", "log", "num-integer", + "oauth2", "poise", - "postman", + "prometheus", "rand", "recordable_derive", "regex", - "reminder_web", - "reqwest", + "reqwest 0.12.1", "rmp-serde", + "rocket", + "rocket_dyn_templates", "secrecy", "serde", "serde_json", "serde_repr", + "serenity", "sqlx", "tokio", ] -[[package]] -name = "reminder_web" -version = "0.1.8" -dependencies = [ - "base64 0.13.1", - "chrono", - "chrono-tz", - "csv", - "lazy_static", - "log", - "oauth2", - "prometheus", - "rand", - "reqwest", - "rocket", - "rocket_dyn_templates", - "secrecy", - "serde", - "serenity", - "sqlx", -] - [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.25", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-rustls", - "hyper-tls", "ipnet", "js-sys", "log", "mime", "mime_guess", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.10", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", - "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.24.1", "tokio-util", "tower-service", "url", @@ -2454,7 +2572,49 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots", + "webpki-roots 0.25.4", + "winreg", +] + +[[package]] +name = "reqwest" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e333b1eb9fe677f6893a9efcb0d277a2d3edd83f358a236b657c32301dc6e5f6" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.3", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", "winreg", ] @@ -2545,7 +2705,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.50", + "syn 2.0.55", "unicode-xid", "version_check", ] @@ -2572,8 +2732,8 @@ dependencies = [ "cookie", "either", "futures", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "indexmap", "log", "memchr", @@ -2581,7 +2741,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "ref-cast", - "rustls", + "rustls 0.21.10", "rustls-pemfile", "serde", "smallvec", @@ -2589,7 +2749,7 @@ dependencies = [ "state", "time", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", "uncased", ] @@ -2621,11 +2781,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -2640,10 +2800,24 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki 0.102.2", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -2653,6 +2827,12 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pki-types" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "868e20fada228fefaf6b652e00cc73623d54f8171e7352c18bb281571f2d92da" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -2663,6 +2843,17 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -2774,7 +2965,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -2790,9 +2981,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" dependencies = [ "itoa", "serde", @@ -2806,7 +2997,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -2832,14 +3023,14 @@ dependencies = [ [[package]] name = "serenity" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385647faa24a889929028973650a4f158fb1b4272b2fcf94feb9fcc3c009e813" +checksum = "c64da29158bb55d70677cacd4f4f8eab1acef005fb830d9c3bea411b090e96a9" dependencies = [ "arrayvec", "async-trait", "base64 0.21.7", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytes", "chrono", "dashmap", @@ -2849,7 +3040,7 @@ dependencies = [ "mime_guess", "parking_lot", "percent-encoding", - "reqwest", + "reqwest 0.11.27", "secrecy", "serde", "serde_json", @@ -2954,18 +3145,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3006,9 +3197,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3019,9 +3210,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ "ahash", "atoi", @@ -3031,7 +3222,6 @@ dependencies = [ "chrono", "crc", "crossbeam-queue", - "dotenvy", "either", "event-listener", "futures-channel", @@ -3047,7 +3237,7 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rustls", + "rustls 0.21.10", "rustls-pemfile", "serde", "serde_json", @@ -3059,14 +3249,14 @@ dependencies = [ "tokio-stream", "tracing", "url", - "webpki-roots", + "webpki-roots 0.25.4", ] [[package]] name = "sqlx-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" dependencies = [ "proc-macro2", "quote", @@ -3077,11 +3267,10 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ - "atomic-write-file", "dotenvy", "either", "heck", @@ -3104,14 +3293,14 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "bytes", "chrono", @@ -3148,14 +3337,14 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "chrono", "crc", @@ -3178,7 +3367,6 @@ dependencies = [ "rand", "serde", "serde_json", - "sha1", "sha2", "smallvec", "sqlx-core", @@ -3190,9 +3378,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ "atoi", "chrono", @@ -3266,9 +3454,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.50" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -3281,6 +3469,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384595c11a4e2969895cad5a8c4029115f5ab956a9e5ef4de79d11a426e5f20c" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3310,9 +3504,9 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", @@ -3344,29 +3538,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3445,7 +3639,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -3464,15 +3658,26 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.10", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.2", + "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -3481,17 +3686,18 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.22.2", + "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", "tungstenite", - "webpki-roots", + "webpki-roots 0.26.1", ] [[package]] @@ -3510,9 +3716,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", @@ -3531,9 +3737,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap", "serde", @@ -3542,6 +3748,28 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -3568,7 +3796,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -3624,18 +3852,19 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 1.1.0", "httparse", "log", "rand", - "rustls", + "rustls 0.22.2", + "rustls-pki-types", "sha1", "thiserror", "url", @@ -3656,9 +3885,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typesize" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36924509726e38224322c8c90ddfbf4317324338327b7c11b7cf8672cb786da1" +checksum = "ac862de7176a9c24a9c6b8840cb7092ae0ab7ff52cb2f9c71f27efacc7ecaf54" dependencies = [ "chrono", "dashmap", @@ -3680,7 +3909,7 @@ checksum = "0b122284365ba8497be951b9a21491f70c9688eb6fddc582931a0703f6a00ece" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] @@ -3872,9 +4101,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -3896,10 +4125,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasm-bindgen" -version = "0.2.91" +name = "wasite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3907,24 +4142,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -3934,9 +4169,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3944,22 +4179,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-streams" @@ -3976,9 +4211,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -3991,10 +4226,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] -name = "whoami" -version = "1.4.1" +name = "webpki-roots" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whoami" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +dependencies = [ + "redox_syscall", + "wasite", +] [[package]] name = "winapi" @@ -4042,7 +4290,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -4060,7 +4308,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -4080,17 +4328,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -4101,9 +4349,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -4113,9 +4361,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -4125,9 +4373,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -4137,9 +4385,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -4149,9 +4397,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -4161,9 +4409,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -4173,15 +4421,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" -version = "0.6.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -4198,9 +4446,9 @@ dependencies = [ [[package]] name = "yansi" -version = "1.0.0-rc.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" dependencies = [ "is-terminal", ] @@ -4222,7 +4470,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.55", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 73f09f3..f4c1481 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ description = "Reminder Bot for Discord, now in Rust" poise = "0.6.1" dotenv = "0.15" tokio = { version = "1", features = ["process", "full"] } -reqwest = "0.11" +reqwest = { version = "0.12", features = ["json"] } lazy-regex = "3.1" regex = "1.10" log = "0.4" @@ -29,12 +29,13 @@ sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", base64 = "0.21" secrecy = "0.8.0" futures = "0.3.30" - -[dependencies.postman] -path = "postman" - -[dependencies.reminder_web] -path = "web" +prometheus = "0.13.3" +rocket = { version = "0.5.0", features = ["tls", "secrets", "json"] } +rocket_dyn_templates = { version = "0.1.0", features = ["tera"] } +serenity = { version = "0.12", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] } +oauth2 = "4" +csv = "1.2" +axum = "0.7" [dependencies.extract_derive] path = "extract_derive" diff --git a/Rocket.toml b/Rocket.toml index 872f0f4..01a69bd 100644 --- a/Rocket.toml +++ b/Rocket.toml @@ -1,28 +1,28 @@ [default] address = "0.0.0.0" port = 18920 -template_dir = "web/templates" +template_dir = "templates" limits = { json = "10MiB" } [debug] secret_key = "tR8krio5FXTnnyIZNiJDXPondz0kI1v6X6BXZcBGIRY=" [debug.tls] -certs = "web/private/rsa_sha256_cert.pem" -key = "web/private/rsa_sha256_key.pem" +certs = "private/rsa_sha256_cert.pem" +key = "private/rsa_sha256_key.pem" [debug.rsa_sha256.tls] -certs = "web/private/rsa_sha256_cert.pem" -key = "web/private/rsa_sha256_key.pem" +certs = "private/rsa_sha256_cert.pem" +key = "private/rsa_sha256_key.pem" [debug.ecdsa_nistp256_sha256.tls] -certs = "web/private/ecdsa_nistp256_sha256_cert.pem" -key = "web/private/ecdsa_nistp256_sha256_key_pkcs8.pem" +certs = "private/ecdsa_nistp256_sha256_cert.pem" +key = "private/ecdsa_nistp256_sha256_key_pkcs8.pem" [debug.ecdsa_nistp384_sha384.tls] -certs = "web/private/ecdsa_nistp384_sha384_cert.pem" -key = "web/private/ecdsa_nistp384_sha384_key_pkcs8.pem" +certs = "private/ecdsa_nistp384_sha384_cert.pem" +key = "private/ecdsa_nistp384_sha384_key_pkcs8.pem" [debug.ed25519.tls] -certs = "web/private/ed25519_cert.pem" -key = "eb/private/ed25519_key.pem" +certs = "private/ed25519_cert.pem" +key = "private/ed25519_key.pem" diff --git a/nginx/reminder-rs b/nginx/reminder-rs index 5861cdf..0e7bde1 100644 --- a/nginx/reminder-rs +++ b/nginx/reminder-rs @@ -1,41 +1,41 @@ server { - server_name www.reminder-bot.com; + server_name www.reminder-bot.com; - return 301 $scheme://reminder-bot.com$request_uri; + return 301 $scheme://reminder-bot.com$request_uri; } server { - listen 80; - server_name reminder-bot.com; + listen 80; + server_name reminder-bot.com; - return 301 https://reminder-bot.com$request_uri; + return 301 https://reminder-bot.com$request_uri; } server { - listen 443 ssl; - server_name reminder-bot.com; + listen 443 ssl; + server_name reminder-bot.com; - ssl_certificate /etc/letsencrypt/live/reminder-bot.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/reminder-bot.com/privkey.pem; + ssl_certificate /etc/letsencrypt/live/reminder-bot.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/reminder-bot.com/privkey.pem; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; - proxy_buffer_size 128k; - proxy_buffers 4 256k; - proxy_busy_buffers_size 256k; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; - location / { - proxy_pass http://localhost:18920; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } + location / { + proxy_pass http://localhost:18920; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } - location /static { - alias /var/www/reminder-rs/static; - expires 30d; - } + location /static { + alias /var/www/reminder-rs/static; + expires 30d; + } } diff --git a/postman/Cargo.toml b/postman/Cargo.toml deleted file mode 100644 index 344a21c..0000000 --- a/postman/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "postman" -version = "0.1.0" -edition = "2021" - -[dependencies] -tokio = { version = "1", features = ["process", "full"] } -regex = "1.9" -log = "0.4" -chrono = "0.4" -chrono-tz = { version = "0.8", features = ["serde"] } -lazy_static = "1.4" -num-integer = "0.1" -serde = "1.0" -sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "json"]} -serenity = { version = "0.12", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] } diff --git a/web/private/ca_cert.pem b/private/ca_cert.pem similarity index 100% rename from web/private/ca_cert.pem rename to private/ca_cert.pem diff --git a/web/private/ca_key.pem b/private/ca_key.pem similarity index 100% rename from web/private/ca_key.pem rename to private/ca_key.pem diff --git a/web/private/ecdsa_nistp256_sha256_cert.pem b/private/ecdsa_nistp256_sha256_cert.pem similarity index 100% rename from web/private/ecdsa_nistp256_sha256_cert.pem rename to private/ecdsa_nistp256_sha256_cert.pem diff --git a/web/private/ecdsa_nistp256_sha256_key_pkcs8.pem b/private/ecdsa_nistp256_sha256_key_pkcs8.pem similarity index 100% rename from web/private/ecdsa_nistp256_sha256_key_pkcs8.pem rename to private/ecdsa_nistp256_sha256_key_pkcs8.pem diff --git a/web/private/ecdsa_nistp384_sha384_cert.pem b/private/ecdsa_nistp384_sha384_cert.pem similarity index 100% rename from web/private/ecdsa_nistp384_sha384_cert.pem rename to private/ecdsa_nistp384_sha384_cert.pem diff --git a/web/private/ecdsa_nistp384_sha384_key_pkcs8.pem b/private/ecdsa_nistp384_sha384_key_pkcs8.pem similarity index 100% rename from web/private/ecdsa_nistp384_sha384_key_pkcs8.pem rename to private/ecdsa_nistp384_sha384_key_pkcs8.pem diff --git a/web/private/ed25519_cert.pem b/private/ed25519_cert.pem similarity index 100% rename from web/private/ed25519_cert.pem rename to private/ed25519_cert.pem diff --git a/web/private/ed25519_key.pem b/private/ed25519_key.pem similarity index 100% rename from web/private/ed25519_key.pem rename to private/ed25519_key.pem diff --git a/web/private/gen_certs.sh b/private/gen_certs.sh similarity index 100% rename from web/private/gen_certs.sh rename to private/gen_certs.sh diff --git a/web/private/rsa_sha256_cert.pem b/private/rsa_sha256_cert.pem similarity index 100% rename from web/private/rsa_sha256_cert.pem rename to private/rsa_sha256_cert.pem diff --git a/web/private/rsa_sha256_key.pem b/private/rsa_sha256_key.pem similarity index 100% rename from web/private/rsa_sha256_key.pem rename to private/rsa_sha256_key.pem diff --git a/src/commands/pause.rs b/src/commands/pause.rs index 5662c26..c7fa87c 100644 --- a/src/commands/pause.rs +++ b/src/commands/pause.rs @@ -1,4 +1,4 @@ -use chrono::NaiveDateTime; +use chrono::DateTime; use serde::{Deserialize, Serialize}; use crate::{ @@ -24,10 +24,10 @@ impl Recordable for Options { let parsed = natural_parser(&until, &timezone.to_string()).await; if let Some(timestamp) = parsed { - match NaiveDateTime::from_timestamp_opt(timestamp, 0) { + match DateTime::from_timestamp(timestamp, 0) { Some(dt) => { channel.paused = true; - channel.paused_until = Some(dt); + channel.paused_until = Some(dt.naive_utc()); channel.commit_changes(&ctx.data().database).await; diff --git a/src/main.rs b/src/main.rs index d1b05c6..52ebd4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,15 @@ mod event_handlers; #[cfg(not(test))] mod hooks; mod interval_parser; +mod metrics; #[cfg(not(test))] mod models; +mod postman; #[cfg(test)] mod test; mod time_parser; mod utils; +mod web; use std::{ collections::HashMap, @@ -28,7 +31,7 @@ use std::{ }; use chrono_tz::Tz; -use log::{error, warn}; +use log::warn; use poise::serenity_prelude::{ model::{ gateway::GatewayIntents, @@ -39,6 +42,7 @@ use poise::serenity_prelude::{ use sqlx::{MySql, Pool}; use tokio::sync::{broadcast, broadcast::Sender, RwLock}; +use crate::metrics::init_metrics; #[cfg(test)] use crate::test::TestContext; #[cfg(not(test))] @@ -206,6 +210,10 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { ..Default::default() }; + // Start metrics + init_metrics(); + tokio::spawn(async { metrics::serve().await }); + let database = Pool::connect(&env::var("DATABASE_URL").expect("No database URL provided")).await.unwrap(); @@ -249,7 +257,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { match postman::initialize(kill_recv, ctx1, &pool1).await { Ok(_) => {} Err(e) => { - error!("postman exiting: {}", e); + panic!("postman exiting: {}", e); } }; }); @@ -259,7 +267,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { if !run_settings.contains("web") { tokio::spawn(async move { - reminder_web::initialize(kill_tx, ctx2, pool2).await.unwrap(); + web::initialize(kill_tx, ctx2, pool2).await.unwrap(); }); } else { warn!("Not running web"); diff --git a/src/metrics.rs b/src/metrics.rs new file mode 100644 index 0000000..83bef0e --- /dev/null +++ b/src/metrics.rs @@ -0,0 +1,36 @@ +use axum::{routing::get, Router}; +use lazy_static::lazy_static; +use log::warn; +use prometheus::{IntCounterVec, Opts, Registry}; + +lazy_static! { + pub static ref REGISTRY: Registry = Registry::new(); + pub static ref REQUEST_COUNTER: IntCounterVec = + IntCounterVec::new(Opts::new("requests", "Requests"), &["method", "status", "route"]) + .unwrap(); +} + +pub fn init_metrics() { + REGISTRY.register(Box::new(REQUEST_COUNTER.clone())).unwrap(); +} + +pub async fn serve() { + let app = Router::new().route("/metrics", get(metrics)); + + let listener = tokio::net::TcpListener::bind("localhost:31756").await.unwrap(); + axum::serve(listener, app).await.unwrap(); +} + +async fn metrics() -> String { + let encoder = prometheus::TextEncoder::new(); + let res_custom = encoder.encode_to_string(®ISTRY.gather()); + + match res_custom { + Ok(s) => s, + Err(e) => { + warn!("Error encoding metrics: {:?}", e); + + String::new() + } + } +} diff --git a/src/models/reminder/builder.rs b/src/models/reminder/builder.rs index c77540e..cd39a8a 100644 --- a/src/models/reminder/builder.rs +++ b/src/models/reminder/builder.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -use chrono::{Duration, NaiveDateTime, Utc}; +use chrono::{DateTime, NaiveDateTime, TimeDelta, Utc}; use chrono_tz::Tz; use poise::serenity_prelude::{ model::id::{ChannelId, GuildId, UserId}, @@ -73,7 +73,7 @@ impl ReminderBuilder { match queried_time.utc_time { Some(utc_time) => { - if utc_time < (Utc::now() - Duration::seconds(60)).naive_local() { + if utc_time < (Utc::now() - TimeDelta::try_minutes(1).unwrap()).naive_local() { Err(ReminderError::PastTime) } else { sqlx::query!( @@ -165,7 +165,7 @@ impl<'a> MultiReminderBuilder<'a> { } pub fn time>(mut self, time: T) -> Self { - if let Some(utc_time) = NaiveDateTime::from_timestamp_opt(time.into(), 0) { + if let Some(utc_time) = DateTime::from_timestamp(time.into(), 0).map(|d| d.naive_utc()) { self.utc_time = utc_time; } @@ -173,7 +173,8 @@ impl<'a> MultiReminderBuilder<'a> { } pub fn expires>(mut self, time: Option) -> Self { - self.expires = time.map(|t| NaiveDateTime::from_timestamp_opt(t.into(), 0)).flatten(); + self.expires = + time.map(|t| DateTime::from_timestamp(t.into(), 0)).flatten().map(|d| d.naive_utc()); self } diff --git a/src/models/reminder/mod.rs b/src/models/reminder/mod.rs index a5c9439..f36b881 100644 --- a/src/models/reminder/mod.rs +++ b/src/models/reminder/mod.rs @@ -38,6 +38,7 @@ use crate::{ }; #[derive(Debug, Clone)] +#[allow(dead_code)] pub struct Reminder { pub id: u32, pub uid: String, diff --git a/src/models/timer.rs b/src/models/timer.rs index 7802f2a..3e0e58c 100644 --- a/src/models/timer.rs +++ b/src/models/timer.rs @@ -4,6 +4,7 @@ use sqlx::MySqlPool; pub struct Timer { pub name: String, pub start_time: DateTime, + #[allow(dead_code)] pub owner: u64, } diff --git a/src/models/user_data.rs b/src/models/user_data.rs index 9e080ae..e0c7588 100644 --- a/src/models/user_data.rs +++ b/src/models/user_data.rs @@ -7,6 +7,7 @@ use crate::consts::LOCAL_TIMEZONE; pub struct UserData { pub id: u32, + #[allow(dead_code)] pub user: u64, pub dm_channel: u32, pub timezone: String, @@ -22,7 +23,7 @@ impl UserData { match sqlx::query!( " -SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ? + SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ? ", user_id ) diff --git a/src/postman/metrics.rs b/src/postman/metrics.rs new file mode 100644 index 0000000..42a58b9 --- /dev/null +++ b/src/postman/metrics.rs @@ -0,0 +1,40 @@ +use axum::{routing::get, Router}; +use lazy_static; +use log::warn; +use prometheus::{register_int_counter, IntCounter, Registry}; + +lazy_static! { + static ref REGISTRY: Registry = Registry::new(); + pub static ref REMINDERS_SENT: IntCounter = + register_int_counter!("reminders_sent", "Number of reminders sent").unwrap(); + pub static ref REMINDERS_FAILED: IntCounter = + register_int_counter!("reminders_failed", "Number of reminders failed").unwrap(); +} + +pub fn init_metrics() { + REGISTRY.register(Box::new(REMINDERS_SENT.clone())).unwrap(); + REGISTRY.register(Box::new(REMINDERS_FAILED.clone())).unwrap(); +} + +pub async fn serve() { + let app = Router::new().route("/metrics", get(metrics)); + + let metrics_port = std::env("PROMETHEUS_PORT").unwrap(); + let listener = + tokio::net::TcpListener::bind(format!("localhost:{}", metrics_port)).await.unwrap(); + axum::serve(listener, app).await.unwrap(); +} + +async fn metrics() -> String { + let encoder = prometheus::TextEncoder::new(); + let res_custom = encoder.encode_to_string(®ISTRY.gather()); + + match res_custom { + Ok(s) => s, + Err(e) => { + warn!("Error encoding metrics: {:?}", e); + + String::new() + } + } +} diff --git a/postman/src/lib.rs b/src/postman/mod.rs similarity index 96% rename from postman/src/lib.rs rename to src/postman/mod.rs index a378dcf..0a164ae 100644 --- a/postman/src/lib.rs +++ b/src/postman/mod.rs @@ -3,7 +3,7 @@ mod sender; use std::env; use log::{info, warn}; -use serenity::client::Context; +use poise::serenity_prelude::client::Context; use sqlx::{Executor, MySql}; use tokio::{ sync::broadcast::Receiver, diff --git a/postman/src/sender.rs b/src/postman/sender.rs similarity index 97% rename from postman/src/sender.rs rename to src/postman/sender.rs index 6eecba7..5353a5f 100644 --- a/postman/src/sender.rs +++ b/src/postman/sender.rs @@ -1,13 +1,11 @@ use std::env; -use chrono::{DateTime, Days, Duration, Months}; +use chrono::{DateTime, Days, Months, TimeDelta}; use chrono_tz::Tz; use lazy_static::lazy_static; use log::{error, info, warn}; use num_integer::Integer; -use regex::{Captures, Regex}; -use serde::Deserialize; -use serenity::{ +use poise::serenity_prelude::{ all::{CreateAttachment, CreateEmbedFooter}, builder::{CreateEmbed, CreateEmbedAuthor, CreateMessage, ExecuteWebhook}, http::{CacheHttp, Http, HttpError}, @@ -18,6 +16,8 @@ use serenity::{ }, Error, Result, }; +use regex::{Captures, Regex}; +use serde::Deserialize; use sqlx::{ types::{ chrono::{NaiveDateTime, Utc}, @@ -66,15 +66,15 @@ pub fn substitute(string: &str) -> String { let format = caps.name("format").map(|m| m.as_str()); if let (Some(final_time), Some(format)) = (final_time, format) { - match NaiveDateTime::from_timestamp_opt(final_time, 0) { + match DateTime::from_timestamp(final_time, 0) { Some(dt) => { - let now = Utc::now().naive_utc(); + let now = Utc::now(); let difference = { if now < dt { - dt - Utc::now().naive_utc() + dt - Utc::now() } else { - Utc::now().naive_utc() - dt + Utc::now() - dt } }; @@ -397,7 +397,13 @@ impl Reminder { } if let Some(interval) = self.interval_seconds { - updated_reminder_time += Duration::seconds(interval as i64); + updated_reminder_time += TimeDelta::try_seconds(interval as i64) + .unwrap_or_else(|| { + warn!("{}: Could not add {} seconds to a reminder", self.id, interval); + fail_count += 1; + + TimeDelta::zero() + }); } } diff --git a/web/src/catchers.rs b/src/web/catchers.rs similarity index 93% rename from web/src/catchers.rs rename to src/web/catchers.rs index e646edf..b5d00ae 100644 --- a/web/src/catchers.rs +++ b/src/web/catchers.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; -use rocket::serde::json::json; +use rocket::{catch, serde::json::json}; use rocket_dyn_templates::Template; -use crate::JsonValue; +use crate::web::JsonValue; #[catch(403)] pub(crate) async fn forbidden() -> Template { diff --git a/web/src/consts.rs b/src/web/consts.rs similarity index 92% rename from web/src/consts.rs rename to src/web/consts.rs index f2828cb..52da25e 100644 --- a/web/src/consts.rs +++ b/src/web/consts.rs @@ -20,14 +20,14 @@ pub const DAY: usize = 24 * HOUR; pub const CHARACTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; -use std::{collections::HashSet, env, iter::FromIterator}; +use std::{collections::HashSet, env}; use lazy_static::lazy_static; use serenity::builder::CreateAttachment; lazy_static! { pub static ref DEFAULT_AVATAR: CreateAttachment = CreateAttachment::bytes( - include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../assets/webhook.jpg")) as &[u8], + include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/webhook.jpg")) as &[u8], "webhook.jpg", ); pub static ref SUBSCRIPTION_ROLES: HashSet = HashSet::from_iter( diff --git a/web/src/guards/mod.rs b/src/web/guards/mod.rs similarity index 100% rename from web/src/guards/mod.rs rename to src/web/guards/mod.rs diff --git a/web/src/guards/transaction.rs b/src/web/guards/transaction.rs similarity index 98% rename from web/src/guards/transaction.rs rename to src/web/guards/transaction.rs index 06e7189..63a9a72 100644 --- a/web/src/guards/transaction.rs +++ b/src/web/guards/transaction.rs @@ -20,6 +20,7 @@ impl Transaction<'_> { } #[derive(Debug)] +#[allow(dead_code)] pub enum TransactionError { Error(sqlx::Error), Missing, diff --git a/web/src/macros.rs b/src/web/macros.rs similarity index 100% rename from web/src/macros.rs rename to src/web/macros.rs diff --git a/src/web/metrics.rs b/src/web/metrics.rs new file mode 100644 index 0000000..69d9bd2 --- /dev/null +++ b/src/web/metrics.rs @@ -0,0 +1,27 @@ +use rocket::{ + fairing::{Fairing, Info, Kind}, + Request, Response, +}; + +use crate::metrics::REQUEST_COUNTER; + +pub struct MetricProducer; + +#[rocket::async_trait] +impl Fairing for MetricProducer { + fn info(&self) -> Info { + Info { name: "Metrics fairing", kind: Kind::Response } + } + + async fn on_response<'r>(&self, req: &'r Request<'_>, resp: &mut Response<'r>) { + if let Some(route) = req.route() { + REQUEST_COUNTER + .with_label_values(&[ + req.method().as_str(), + &resp.status().code.to_string(), + &route.uri.to_string(), + ]) + .inc(); + } + } +} diff --git a/web/src/lib.rs b/src/web/mod.rs similarity index 95% rename from web/src/lib.rs rename to src/web/mod.rs index aa89132..ea6991f 100644 --- a/web/src/lib.rs +++ b/src/web/mod.rs @@ -1,6 +1,3 @@ -#[macro_use] -extern crate rocket; - mod consts; #[macro_use] mod macros; @@ -11,24 +8,27 @@ mod routes; use std::{env, path::Path}; +use log::{error, info, warn}; use oauth2::{basic::BasicClient, AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl}; -use rocket::{ - fs::FileServer, - http::CookieJar, - serde::json::{json, Value as JsonValue}, - tokio::sync::broadcast::Sender, -}; -use rocket_dyn_templates::Template; -use serenity::{ +use poise::serenity_prelude::{ client::Context, http::CacheHttp, model::id::{GuildId, UserId}, }; +use rocket::{ + catchers, + fs::FileServer, + http::CookieJar, + routes, + serde::json::{json, Value as JsonValue}, + tokio::sync::broadcast::Sender, +}; +use rocket_dyn_templates::Template; use sqlx::{MySql, Pool}; -use crate::{ +use crate::web::{ consts::{CNC_GUILD, DISCORD_OAUTH_AUTHORIZE, DISCORD_OAUTH_TOKEN, SUBSCRIPTION_ROLES}, - metrics::{init_metrics, MetricProducer}, + metrics::MetricProducer, }; type Database = MySql; @@ -68,9 +68,7 @@ pub async fn initialize( let reqwest_client = reqwest::Client::new(); let static_path = - if Path::new("web/static").exists() { "web/static" } else { "/lib/reminder-rs/static" }; - - init_metrics(); + if Path::new("static").exists() { "static" } else { "/lib/reminder-rs/static" }; rocket::build() .attach(MetricProducer) @@ -96,7 +94,6 @@ pub async fn initialize( routes![ routes::cookies, routes::index, - routes::metrics::metrics, routes::privacy, routes::report::report_error, routes::return_to_same_site, @@ -154,7 +151,6 @@ pub async fn initialize( routes::dashboard::export::import_todos, ], ) - .mount("/admin", routes![routes::admin::admin_dashboard_home, routes::admin::bot_data]) .launch() .await?; diff --git a/web/src/routes/dashboard/api/guild/channels.rs b/src/web/routes/dashboard/api/guild/channels.rs similarity index 93% rename from web/src/routes/dashboard/api/guild/channels.rs rename to src/web/routes/dashboard/api/guild/channels.rs index 2be4085..5f8a448 100644 --- a/web/src/routes/dashboard/api/guild/channels.rs +++ b/src/web/routes/dashboard/api/guild/channels.rs @@ -1,4 +1,4 @@ -use rocket::{http::CookieJar, serde::json::json, State}; +use rocket::{get, http::CookieJar, serde::json::json, State}; use serde::Serialize; use serenity::{ client::Context, @@ -8,7 +8,7 @@ use serenity::{ }, }; -use crate::{check_authorization, routes::JsonResult}; +use crate::web::{check_authorization, routes::JsonResult}; #[derive(Serialize)] struct ChannelInfo { diff --git a/web/src/routes/dashboard/api/guild/mod.rs b/src/web/routes/dashboard/api/guild/mod.rs similarity index 90% rename from web/src/routes/dashboard/api/guild/mod.rs rename to src/web/routes/dashboard/api/guild/mod.rs index 1ac553a..07fb133 100644 --- a/web/src/routes/dashboard/api/guild/mod.rs +++ b/src/web/routes/dashboard/api/guild/mod.rs @@ -7,7 +7,7 @@ use std::env; pub use channels::*; pub use reminders::*; -use rocket::{http::CookieJar, serde::json::json, State}; +use rocket::{get, http::CookieJar, serde::json::json, State}; pub use roles::*; use serenity::{ client::Context, @@ -15,7 +15,7 @@ use serenity::{ }; pub use templates::*; -use crate::{check_authorization, routes::JsonResult}; +use crate::web::{check_authorization, routes::JsonResult}; #[get("/api/guild/")] pub async fn get_guild_info(id: u64, cookies: &CookieJar<'_>, ctx: &State) -> JsonResult { diff --git a/web/src/routes/dashboard/api/guild/reminders.rs b/src/web/routes/dashboard/api/guild/reminders.rs similarity index 99% rename from web/src/routes/dashboard/api/guild/reminders.rs rename to src/web/routes/dashboard/api/guild/reminders.rs index 3acd713..3dcf318 100644 --- a/web/src/routes/dashboard/api/guild/reminders.rs +++ b/src/web/routes/dashboard/api/guild/reminders.rs @@ -1,5 +1,8 @@ +use log::warn; use rocket::{ + get, http::CookieJar, + patch, post, serde::json::{json, Json}, State, }; @@ -9,7 +12,7 @@ use serenity::{ }; use sqlx::{MySql, Pool}; -use crate::{ +use crate::web::{ check_authorization, check_guild_subscription, check_subscription, consts::MIN_INTERVAL, guards::transaction::Transaction, diff --git a/web/src/routes/dashboard/api/guild/roles.rs b/src/web/routes/dashboard/api/guild/roles.rs similarity index 86% rename from web/src/routes/dashboard/api/guild/roles.rs rename to src/web/routes/dashboard/api/guild/roles.rs index fdb665f..bf0205b 100644 --- a/web/src/routes/dashboard/api/guild/roles.rs +++ b/src/web/routes/dashboard/api/guild/roles.rs @@ -1,8 +1,9 @@ -use rocket::{http::CookieJar, serde::json::json, State}; +use log::warn; +use rocket::{get, http::CookieJar, serde::json::json, State}; use serde::Serialize; use serenity::client::Context; -use crate::{check_authorization, routes::JsonResult}; +use crate::web::{check_authorization, routes::JsonResult}; #[derive(Serialize)] struct RoleInfo { diff --git a/web/src/routes/dashboard/api/guild/templates.rs b/src/web/routes/dashboard/api/guild/templates.rs similarity index 98% rename from web/src/routes/dashboard/api/guild/templates.rs rename to src/web/routes/dashboard/api/guild/templates.rs index e05aad8..92d61cb 100644 --- a/web/src/routes/dashboard/api/guild/templates.rs +++ b/src/web/routes/dashboard/api/guild/templates.rs @@ -1,12 +1,15 @@ +use log::warn; use rocket::{ + delete, get, http::CookieJar, + post, serde::json::{json, Json}, State, }; use serenity::client::Context; use sqlx::{MySql, Pool}; -use crate::{ +use crate::web::{ check_authorization, consts::{ MAX_CONTENT_LENGTH, MAX_EMBED_AUTHOR_LENGTH, MAX_EMBED_DESCRIPTION_LENGTH, diff --git a/web/src/routes/dashboard/api/mod.rs b/src/web/routes/dashboard/api/mod.rs similarity index 91% rename from web/src/routes/dashboard/api/mod.rs rename to src/web/routes/dashboard/api/mod.rs index bbb59a5..db0fe03 100644 --- a/web/src/routes/dashboard/api/mod.rs +++ b/src/web/routes/dashboard/api/mod.rs @@ -1,14 +1,16 @@ pub mod guild; pub mod user; +use log::warn; use rocket::{ + delete, http::CookieJar, serde::json::{json, Json}, State, }; use sqlx::{MySql, Pool}; -use crate::routes::{dashboard::DeleteReminder, JsonResult}; +use crate::web::routes::{dashboard::DeleteReminder, JsonResult}; #[delete("/api/reminders", data = "")] pub async fn delete_reminder( diff --git a/web/src/routes/dashboard/api/user/guilds.rs b/src/web/routes/dashboard/api/user/guilds.rs similarity index 97% rename from web/src/routes/dashboard/api/user/guilds.rs rename to src/web/routes/dashboard/api/user/guilds.rs index e26a3f0..5016bc3 100644 --- a/web/src/routes/dashboard/api/user/guilds.rs +++ b/src/web/routes/dashboard/api/user/guilds.rs @@ -1,5 +1,7 @@ +use log::warn; use reqwest::Client; use rocket::{ + get, http::CookieJar, serde::json::{json, Value as JsonValue}, State, @@ -7,7 +9,7 @@ use rocket::{ use serde::{Deserialize, Serialize}; use serenity::model::{id::GuildId, permissions::Permissions}; -use crate::consts::DISCORD_API; +use crate::web::consts::DISCORD_API; #[derive(Serialize)] struct GuildInfo { diff --git a/web/src/routes/dashboard/api/user/mod.rs b/src/web/routes/dashboard/api/user/mod.rs similarity index 99% rename from web/src/routes/dashboard/api/user/mod.rs rename to src/web/routes/dashboard/api/user/mod.rs index 5c31ba5..073af07 100644 --- a/web/src/routes/dashboard/api/user/mod.rs +++ b/src/web/routes/dashboard/api/user/mod.rs @@ -8,7 +8,9 @@ use chrono_tz::Tz; pub use guilds::*; pub use reminders::*; use rocket::{ + get, http::CookieJar, + patch, serde::json::{json, Json, Value as JsonValue}, State, }; diff --git a/web/src/routes/dashboard/api/user/models.rs b/src/web/routes/dashboard/api/user/models.rs similarity index 74% rename from web/src/routes/dashboard/api/user/models.rs rename to src/web/routes/dashboard/api/user/models.rs index d86b8b9..1e4d1aa 100644 --- a/web/src/routes/dashboard/api/user/models.rs +++ b/src/web/routes/dashboard/api/user/models.rs @@ -1,11 +1,12 @@ use chrono::{naive::NaiveDateTime, Utc}; use futures::TryFutureExt; +use log::warn; use rocket::serde::json::json; use serde::{Deserialize, Serialize}; -use serenity::{client::Context, futures, model::id::UserId}; +use serenity::{client::Context, model::id::UserId}; use sqlx::types::Json; -use crate::{ +use crate::web::{ check_subscription, consts::{ DAY, MAX_CONTENT_LENGTH, MAX_EMBED_AUTHOR_LENGTH, MAX_EMBED_DESCRIPTION_LENGTH, @@ -15,10 +16,7 @@ use crate::{ }, guards::transaction::Transaction, routes::{ - dashboard::{ - create_database_channel, deserialize_optional_field, generate_uid, interval_default, - name_default, Attachment, EmbedField, Unset, - }, + dashboard::{create_database_channel, generate_uid, name_default, Attachment, EmbedField}, JsonResult, }, Error, @@ -231,60 +229,3 @@ pub async fn create_reminder( } } } - -#[derive(Deserialize)] -pub struct PatchReminder { - pub uid: String, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub attachment: Unset>, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub attachment_name: Unset>, - #[serde(default)] - pub content: Unset, - #[serde(default)] - pub embed_author: Unset, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub embed_author_url: Unset>, - #[serde(default)] - pub embed_color: Unset, - #[serde(default)] - pub embed_description: Unset, - #[serde(default)] - pub embed_footer: Unset, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub embed_footer_url: Unset>, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub embed_image_url: Unset>, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub embed_thumbnail_url: Unset>, - #[serde(default)] - pub embed_title: Unset, - #[serde(default)] - pub embed_fields: Unset>>, - #[serde(default)] - pub enabled: Unset, - #[serde(default)] - #[serde(deserialize_with = "deserialize_optional_field")] - pub expires: Unset>, - #[serde(default = "interval_default")] - #[serde(deserialize_with = "deserialize_optional_field")] - pub interval_seconds: Unset>, - #[serde(default = "interval_default")] - #[serde(deserialize_with = "deserialize_optional_field")] - pub interval_days: Unset>, - #[serde(default = "interval_default")] - #[serde(deserialize_with = "deserialize_optional_field")] - pub interval_months: Unset>, - #[serde(default)] - pub name: Unset, - #[serde(default)] - pub tts: Unset, - #[serde(default)] - pub utc_time: Unset, -} diff --git a/web/src/routes/dashboard/api/user/reminders.rs b/src/web/routes/dashboard/api/user/reminders.rs similarity index 99% rename from web/src/routes/dashboard/api/user/reminders.rs rename to src/web/routes/dashboard/api/user/reminders.rs index def9638..0787374 100644 --- a/web/src/routes/dashboard/api/user/reminders.rs +++ b/src/web/routes/dashboard/api/user/reminders.rs @@ -1,12 +1,15 @@ +use log::warn; use rocket::{ + get, http::CookieJar, + patch, post, serde::json::{json, Json}, State, }; use serenity::{client::Context, model::id::UserId}; use sqlx::{MySql, Pool}; -use crate::{ +use crate::web::{ check_subscription, guards::transaction::Transaction, routes::{ diff --git a/web/src/routes/dashboard/export.rs b/src/web/routes/dashboard/export.rs similarity index 98% rename from web/src/routes/dashboard/export.rs rename to src/web/routes/dashboard/export.rs index f00f9d6..8eac186 100644 --- a/web/src/routes/dashboard/export.rs +++ b/src/web/routes/dashboard/export.rs @@ -1,7 +1,11 @@ +use base64::{prelude::BASE64_STANDARD, Engine}; use csv::{QuoteStyle, WriterBuilder}; +use log::warn; use rocket::{ + get, http::CookieJar, - serde::json::{json, serde_json, Json}, + put, + serde::json::{json, Json}, State, }; use serenity::{ @@ -10,7 +14,7 @@ use serenity::{ }; use sqlx::{MySql, Pool}; -use crate::{ +use crate::web::{ check_authorization, guards::transaction::Transaction, routes::{ @@ -134,7 +138,7 @@ pub(crate) async fn import_reminders( let user_id = cookies.get_private("userid").map(|c| c.value().parse::().ok()).flatten().unwrap(); - match base64::decode(&body.body) { + match BASE64_STANDARD.decode(&body.body) { Ok(body) => { let mut reader = csv::Reader::from_reader(body.as_slice()); let mut count = 0; @@ -292,7 +296,7 @@ pub async fn import_todos( let channels_res = GuildId::new(id).channels(&ctx.inner()).await; match channels_res { - Ok(channels) => match base64::decode(&body.body) { + Ok(channels) => match BASE64_STANDARD.decode(&body.body) { Ok(body) => { let mut reader = csv::Reader::from_reader(body.as_slice()); diff --git a/web/src/routes/dashboard/mod.rs b/src/web/routes/dashboard/mod.rs similarity index 98% rename from web/src/routes/dashboard/mod.rs rename to src/web/routes/dashboard/mod.rs index 3cd4de4..9137abe 100644 --- a/web/src/routes/dashboard/mod.rs +++ b/src/web/routes/dashboard/mod.rs @@ -1,8 +1,12 @@ use std::path::Path; +use base64::{prelude::BASE64_STANDARD, Engine}; use chrono::{naive::NaiveDateTime, Utc}; +use log::warn; use rand::{rngs::OsRng, seq::IteratorRandom}; -use rocket::{fs::NamedFile, http::CookieJar, response::Redirect, serde::json::json}; +use rocket::{ + fs::NamedFile, get, http::CookieJar, response::Redirect, serde::json::json, Responder, +}; use rocket_dyn_templates::Template; use secrecy::ExposeSecret; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; @@ -14,7 +18,7 @@ use serenity::{ }; use sqlx::types::Json; -use crate::{ +use crate::web::{ catchers::internal_server_error, check_guild_subscription, check_subscription, consts::{ @@ -63,7 +67,7 @@ impl<'de> Deserialize<'de> for Attachment { D: Deserializer<'de>, { let string = String::deserialize(deserializer)?; - Ok(Attachment(base64::decode(string).map_err(de::Error::custom)?)) + Ok(Attachment(BASE64_STANDARD.decode(string).map_err(de::Error::custom)?)) } } @@ -72,7 +76,7 @@ impl Serialize for Attachment { where S: Serializer, { - serializer.collect_str(&base64::encode(&self.0)) + serializer.collect_str(&BASE64_STANDARD.encode(&self.0)) } } @@ -595,7 +599,7 @@ async fn create_database_channel( ctx: impl CacheHttp, channel: ChannelId, transaction: &mut Transaction<'_>, -) -> Result { +) -> Result { let row = sqlx::query!( "SELECT webhook_token, webhook_id FROM channels WHERE channel = ?", channel.get() diff --git a/web/src/routes/login.rs b/src/web/routes/login.rs similarity index 99% rename from web/src/routes/login.rs rename to src/web/routes/login.rs index 1c903d9..41ded09 100644 --- a/web/src/routes/login.rs +++ b/src/web/routes/login.rs @@ -5,13 +5,14 @@ use oauth2::{ }; use reqwest::Client; use rocket::{ + get, http::{private::cookie::Expiration, Cookie, CookieJar, SameSite}, response::{Flash, Redirect}, uri, State, }; use serenity::model::user::User; -use crate::{consts::DISCORD_API, routes}; +use crate::web::{consts::DISCORD_API, routes}; #[get("/discord")] pub async fn discord_login( diff --git a/web/src/routes/mod.rs b/src/web/routes/mod.rs similarity index 96% rename from web/src/routes/mod.rs rename to src/web/routes/mod.rs index 568f5f3..8a5ca7c 100644 --- a/web/src/routes/mod.rs +++ b/src/web/routes/mod.rs @@ -1,12 +1,10 @@ -pub mod admin; pub mod dashboard; pub mod login; -pub mod metrics; pub mod report; use std::collections::HashMap; -use rocket::{request::FlashMessage, serde::json::Value as JsonValue}; +use rocket::{get, request::FlashMessage, serde::json::Value as JsonValue}; use rocket_dyn_templates::Template; pub type JsonResult = Result; diff --git a/web/src/routes/report.rs b/src/web/routes/report.rs similarity index 94% rename from web/src/routes/report.rs rename to src/web/routes/report.rs index 8bc20b3..72a7665 100644 --- a/web/src/routes/report.rs +++ b/src/web/routes/report.rs @@ -1,12 +1,14 @@ +use log::error; use rocket::{ http::CookieJar, + post, serde::{ json::{json, Json}, Deserialize, }, }; -use crate::routes::JsonResult; +use crate::web::routes::JsonResult; #[derive(Deserialize)] pub struct ClientError { diff --git a/web/static/assets b/static/assets similarity index 100% rename from web/static/assets rename to static/assets diff --git a/web/static/css/bulma.min.css b/static/css/bulma.min.css similarity index 100% rename from web/static/css/bulma.min.css rename to static/css/bulma.min.css diff --git a/web/static/css/dtsel.css b/static/css/dtsel.css similarity index 100% rename from web/static/css/dtsel.css rename to static/css/dtsel.css diff --git a/web/static/css/fa.css b/static/css/fa.css similarity index 100% rename from web/static/css/fa.css rename to static/css/fa.css diff --git a/web/static/css/font.css b/static/css/font.css similarity index 100% rename from web/static/css/font.css rename to static/css/font.css diff --git a/web/static/css/style.css b/static/css/style.css similarity index 100% rename from web/static/css/style.css rename to static/css/style.css diff --git a/web/static/favicon/android-chrome-192x192.png b/static/favicon/android-chrome-192x192.png similarity index 100% rename from web/static/favicon/android-chrome-192x192.png rename to static/favicon/android-chrome-192x192.png diff --git a/web/static/favicon/android-chrome-512x512.png b/static/favicon/android-chrome-512x512.png similarity index 100% rename from web/static/favicon/android-chrome-512x512.png rename to static/favicon/android-chrome-512x512.png diff --git a/web/static/favicon/apple-touch-icon.png b/static/favicon/apple-touch-icon.png similarity index 100% rename from web/static/favicon/apple-touch-icon.png rename to static/favicon/apple-touch-icon.png diff --git a/web/static/favicon/browserconfig.xml b/static/favicon/browserconfig.xml similarity index 100% rename from web/static/favicon/browserconfig.xml rename to static/favicon/browserconfig.xml diff --git a/web/static/favicon/favicon-16x16.png b/static/favicon/favicon-16x16.png similarity index 100% rename from web/static/favicon/favicon-16x16.png rename to static/favicon/favicon-16x16.png diff --git a/web/static/favicon/favicon-32x32.png b/static/favicon/favicon-32x32.png similarity index 100% rename from web/static/favicon/favicon-32x32.png rename to static/favicon/favicon-32x32.png diff --git a/web/static/favicon/favicon.ico b/static/favicon/favicon.ico similarity index 100% rename from web/static/favicon/favicon.ico rename to static/favicon/favicon.ico diff --git a/web/static/favicon/mstile-150x150.png b/static/favicon/mstile-150x150.png similarity index 100% rename from web/static/favicon/mstile-150x150.png rename to static/favicon/mstile-150x150.png diff --git a/web/static/img/bg.webp b/static/img/bg.webp similarity index 100% rename from web/static/img/bg.webp rename to static/img/bg.webp diff --git a/web/static/img/icon.png b/static/img/icon.png similarity index 100% rename from web/static/img/icon.png rename to static/img/icon.png diff --git a/web/static/img/logo_flat.jpg b/static/img/logo_flat.jpg similarity index 100% rename from web/static/img/logo_flat.jpg rename to static/img/logo_flat.jpg diff --git a/web/static/img/logo_flat.webp b/static/img/logo_flat.webp similarity index 100% rename from web/static/img/logo_flat.webp rename to static/img/logo_flat.webp diff --git a/web/static/img/logo_nobg.webp b/static/img/logo_nobg.webp similarity index 100% rename from web/static/img/logo_nobg.webp rename to static/img/logo_nobg.webp diff --git a/web/static/img/slash-commands.png b/static/img/slash-commands.png similarity index 100% rename from web/static/img/slash-commands.png rename to static/img/slash-commands.png diff --git a/web/static/img/support/delete_reminder/1.png b/static/img/support/delete_reminder/1.png similarity index 100% rename from web/static/img/support/delete_reminder/1.png rename to static/img/support/delete_reminder/1.png diff --git a/web/static/img/support/delete_reminder/2.png b/static/img/support/delete_reminder/2.png similarity index 100% rename from web/static/img/support/delete_reminder/2.png rename to static/img/support/delete_reminder/2.png diff --git a/web/static/img/support/delete_reminder/3.png b/static/img/support/delete_reminder/3.png similarity index 100% rename from web/static/img/support/delete_reminder/3.png rename to static/img/support/delete_reminder/3.png diff --git a/web/static/img/support/delete_reminder/cancel-1.png b/static/img/support/delete_reminder/cancel-1.png similarity index 100% rename from web/static/img/support/delete_reminder/cancel-1.png rename to static/img/support/delete_reminder/cancel-1.png diff --git a/web/static/img/support/delete_reminder/cancel-2.png b/static/img/support/delete_reminder/cancel-2.png similarity index 100% rename from web/static/img/support/delete_reminder/cancel-2.png rename to static/img/support/delete_reminder/cancel-2.png diff --git a/web/static/img/support/delete_reminder/cmd-1.png b/static/img/support/delete_reminder/cmd-1.png similarity index 100% rename from web/static/img/support/delete_reminder/cmd-1.png rename to static/img/support/delete_reminder/cmd-1.png diff --git a/web/static/img/support/delete_reminder/cmd-2.png b/static/img/support/delete_reminder/cmd-2.png similarity index 100% rename from web/static/img/support/delete_reminder/cmd-2.png rename to static/img/support/delete_reminder/cmd-2.png diff --git a/web/static/img/support/iemanager/edit_spreadsheet.png b/static/img/support/iemanager/edit_spreadsheet.png similarity index 100% rename from web/static/img/support/iemanager/edit_spreadsheet.png rename to static/img/support/iemanager/edit_spreadsheet.png diff --git a/web/static/img/support/iemanager/format_text.png b/static/img/support/iemanager/format_text.png similarity index 100% rename from web/static/img/support/iemanager/format_text.png rename to static/img/support/iemanager/format_text.png diff --git a/web/static/img/support/iemanager/import.png b/static/img/support/iemanager/import.png similarity index 100% rename from web/static/img/support/iemanager/import.png rename to static/img/support/iemanager/import.png diff --git a/web/static/img/support/iemanager/select_export.png b/static/img/support/iemanager/select_export.png similarity index 100% rename from web/static/img/support/iemanager/select_export.png rename to static/img/support/iemanager/select_export.png diff --git a/web/static/img/support/iemanager/sheets_settings.png b/static/img/support/iemanager/sheets_settings.png similarity index 100% rename from web/static/img/support/iemanager/sheets_settings.png rename to static/img/support/iemanager/sheets_settings.png diff --git a/web/static/img/tournament-demo.png b/static/img/tournament-demo.png similarity index 100% rename from web/static/img/tournament-demo.png rename to static/img/tournament-demo.png diff --git a/static/index.html b/static/index.html new file mode 120000 index 0000000..af9ba7b --- /dev/null +++ b/static/index.html @@ -0,0 +1 @@ +/home/jude/reminder-bot/reminder-dashboard/dist/index.html \ No newline at end of file diff --git a/web/static/js/admin.js b/static/js/admin.js similarity index 100% rename from web/static/js/admin.js rename to static/js/admin.js diff --git a/web/static/js/chart.js b/static/js/chart.js similarity index 100% rename from web/static/js/chart.js rename to static/js/chart.js diff --git a/web/static/js/chartjs-adapter-luxon.js b/static/js/chartjs-adapter-luxon.js similarity index 100% rename from web/static/js/chartjs-adapter-luxon.js rename to static/js/chartjs-adapter-luxon.js diff --git a/web/static/js/dtsel.js b/static/js/dtsel.js similarity index 100% rename from web/static/js/dtsel.js rename to static/js/dtsel.js diff --git a/web/static/js/expand.js b/static/js/expand.js similarity index 100% rename from web/static/js/expand.js rename to static/js/expand.js diff --git a/web/static/js/interval.js b/static/js/interval.js similarity index 100% rename from web/static/js/interval.js rename to static/js/interval.js diff --git a/web/static/js/iro.js b/static/js/iro.js similarity index 100% rename from web/static/js/iro.js rename to static/js/iro.js diff --git a/web/static/js/js.cookie.min.js b/static/js/js.cookie.min.js similarity index 100% rename from web/static/js/js.cookie.min.js rename to static/js/js.cookie.min.js diff --git a/web/static/js/luxon.min.js b/static/js/luxon.min.js similarity index 100% rename from web/static/js/luxon.min.js rename to static/js/luxon.min.js diff --git a/web/static/js/main.js b/static/js/main.js similarity index 100% rename from web/static/js/main.js rename to static/js/main.js diff --git a/web/static/js/reporter.js b/static/js/reporter.js similarity index 100% rename from web/static/js/reporter.js rename to static/js/reporter.js diff --git a/web/static/js/sort.js b/static/js/sort.js similarity index 100% rename from web/static/js/sort.js rename to static/js/sort.js diff --git a/web/static/js/timezone.js b/static/js/timezone.js similarity index 100% rename from web/static/js/timezone.js rename to static/js/timezone.js diff --git a/web/static/site.webmanifest b/static/site.webmanifest similarity index 100% rename from web/static/site.webmanifest rename to static/site.webmanifest diff --git a/web/static/webfonts/fa-brands-400.eot b/static/webfonts/fa-brands-400.eot similarity index 100% rename from web/static/webfonts/fa-brands-400.eot rename to static/webfonts/fa-brands-400.eot diff --git a/web/static/webfonts/fa-brands-400.svg b/static/webfonts/fa-brands-400.svg similarity index 100% rename from web/static/webfonts/fa-brands-400.svg rename to static/webfonts/fa-brands-400.svg diff --git a/web/static/webfonts/fa-brands-400.ttf b/static/webfonts/fa-brands-400.ttf similarity index 100% rename from web/static/webfonts/fa-brands-400.ttf rename to static/webfonts/fa-brands-400.ttf diff --git a/web/static/webfonts/fa-brands-400.woff b/static/webfonts/fa-brands-400.woff similarity index 100% rename from web/static/webfonts/fa-brands-400.woff rename to static/webfonts/fa-brands-400.woff diff --git a/web/static/webfonts/fa-brands-400.woff2 b/static/webfonts/fa-brands-400.woff2 similarity index 100% rename from web/static/webfonts/fa-brands-400.woff2 rename to static/webfonts/fa-brands-400.woff2 diff --git a/web/static/webfonts/fa-duotone-900.eot b/static/webfonts/fa-duotone-900.eot similarity index 100% rename from web/static/webfonts/fa-duotone-900.eot rename to static/webfonts/fa-duotone-900.eot diff --git a/web/static/webfonts/fa-duotone-900.svg b/static/webfonts/fa-duotone-900.svg similarity index 100% rename from web/static/webfonts/fa-duotone-900.svg rename to static/webfonts/fa-duotone-900.svg diff --git a/web/static/webfonts/fa-duotone-900.ttf b/static/webfonts/fa-duotone-900.ttf similarity index 100% rename from web/static/webfonts/fa-duotone-900.ttf rename to static/webfonts/fa-duotone-900.ttf diff --git a/web/static/webfonts/fa-duotone-900.woff b/static/webfonts/fa-duotone-900.woff similarity index 100% rename from web/static/webfonts/fa-duotone-900.woff rename to static/webfonts/fa-duotone-900.woff diff --git a/web/static/webfonts/fa-duotone-900.woff2 b/static/webfonts/fa-duotone-900.woff2 similarity index 100% rename from web/static/webfonts/fa-duotone-900.woff2 rename to static/webfonts/fa-duotone-900.woff2 diff --git a/web/static/webfonts/fa-light-300.eot b/static/webfonts/fa-light-300.eot similarity index 100% rename from web/static/webfonts/fa-light-300.eot rename to static/webfonts/fa-light-300.eot diff --git a/web/static/webfonts/fa-light-300.svg b/static/webfonts/fa-light-300.svg similarity index 100% rename from web/static/webfonts/fa-light-300.svg rename to static/webfonts/fa-light-300.svg diff --git a/web/static/webfonts/fa-light-300.ttf b/static/webfonts/fa-light-300.ttf similarity index 100% rename from web/static/webfonts/fa-light-300.ttf rename to static/webfonts/fa-light-300.ttf diff --git a/web/static/webfonts/fa-light-300.woff b/static/webfonts/fa-light-300.woff similarity index 100% rename from web/static/webfonts/fa-light-300.woff rename to static/webfonts/fa-light-300.woff diff --git a/web/static/webfonts/fa-light-300.woff2 b/static/webfonts/fa-light-300.woff2 similarity index 100% rename from web/static/webfonts/fa-light-300.woff2 rename to static/webfonts/fa-light-300.woff2 diff --git a/web/static/webfonts/fa-regular-400.eot b/static/webfonts/fa-regular-400.eot similarity index 100% rename from web/static/webfonts/fa-regular-400.eot rename to static/webfonts/fa-regular-400.eot diff --git a/web/static/webfonts/fa-regular-400.svg b/static/webfonts/fa-regular-400.svg similarity index 100% rename from web/static/webfonts/fa-regular-400.svg rename to static/webfonts/fa-regular-400.svg diff --git a/web/static/webfonts/fa-regular-400.ttf b/static/webfonts/fa-regular-400.ttf similarity index 100% rename from web/static/webfonts/fa-regular-400.ttf rename to static/webfonts/fa-regular-400.ttf diff --git a/web/static/webfonts/fa-regular-400.woff b/static/webfonts/fa-regular-400.woff similarity index 100% rename from web/static/webfonts/fa-regular-400.woff rename to static/webfonts/fa-regular-400.woff diff --git a/web/static/webfonts/fa-regular-400.woff2 b/static/webfonts/fa-regular-400.woff2 similarity index 100% rename from web/static/webfonts/fa-regular-400.woff2 rename to static/webfonts/fa-regular-400.woff2 diff --git a/web/static/webfonts/fa-solid-900.eot b/static/webfonts/fa-solid-900.eot similarity index 100% rename from web/static/webfonts/fa-solid-900.eot rename to static/webfonts/fa-solid-900.eot diff --git a/web/static/webfonts/fa-solid-900.svg b/static/webfonts/fa-solid-900.svg similarity index 100% rename from web/static/webfonts/fa-solid-900.svg rename to static/webfonts/fa-solid-900.svg diff --git a/web/static/webfonts/fa-solid-900.ttf b/static/webfonts/fa-solid-900.ttf similarity index 100% rename from web/static/webfonts/fa-solid-900.ttf rename to static/webfonts/fa-solid-900.ttf diff --git a/web/static/webfonts/fa-solid-900.woff b/static/webfonts/fa-solid-900.woff similarity index 100% rename from web/static/webfonts/fa-solid-900.woff rename to static/webfonts/fa-solid-900.woff diff --git a/web/static/webfonts/fa-solid-900.woff2 b/static/webfonts/fa-solid-900.woff2 similarity index 100% rename from web/static/webfonts/fa-solid-900.woff2 rename to static/webfonts/fa-solid-900.woff2 diff --git a/web/templates/admin_dashboard.html.tera b/templates/admin_dashboard.html.tera similarity index 100% rename from web/templates/admin_dashboard.html.tera rename to templates/admin_dashboard.html.tera diff --git a/web/templates/base.html.tera b/templates/base.html.tera similarity index 100% rename from web/templates/base.html.tera rename to templates/base.html.tera diff --git a/web/templates/cookies.html.tera b/templates/cookies.html.tera similarity index 100% rename from web/templates/cookies.html.tera rename to templates/cookies.html.tera diff --git a/web/templates/dashboard.html.tera b/templates/dashboard.html.tera similarity index 100% rename from web/templates/dashboard.html.tera rename to templates/dashboard.html.tera diff --git a/web/templates/errors/401.html.tera b/templates/errors/401.html.tera similarity index 100% rename from web/templates/errors/401.html.tera rename to templates/errors/401.html.tera diff --git a/web/templates/errors/403.html.tera b/templates/errors/403.html.tera similarity index 100% rename from web/templates/errors/403.html.tera rename to templates/errors/403.html.tera diff --git a/web/templates/errors/404.html.tera b/templates/errors/404.html.tera similarity index 100% rename from web/templates/errors/404.html.tera rename to templates/errors/404.html.tera diff --git a/web/templates/errors/500.html.tera b/templates/errors/500.html.tera similarity index 100% rename from web/templates/errors/500.html.tera rename to templates/errors/500.html.tera diff --git a/web/templates/help.html.tera b/templates/help.html.tera similarity index 100% rename from web/templates/help.html.tera rename to templates/help.html.tera diff --git a/web/templates/index.html.tera b/templates/index.html.tera similarity index 100% rename from web/templates/index.html.tera rename to templates/index.html.tera diff --git a/web/templates/privacy.html.tera b/templates/privacy.html.tera similarity index 100% rename from web/templates/privacy.html.tera rename to templates/privacy.html.tera diff --git a/web/templates/reminder_dashboard/guild_error.html.tera b/templates/reminder_dashboard/guild_error.html.tera similarity index 100% rename from web/templates/reminder_dashboard/guild_error.html.tera rename to templates/reminder_dashboard/guild_error.html.tera diff --git a/web/templates/reminder_dashboard/guild_reminder.html.tera b/templates/reminder_dashboard/guild_reminder.html.tera similarity index 100% rename from web/templates/reminder_dashboard/guild_reminder.html.tera rename to templates/reminder_dashboard/guild_reminder.html.tera diff --git a/web/templates/reminder_dashboard/reminder_dashboard.html.tera b/templates/reminder_dashboard/reminder_dashboard.html.tera similarity index 100% rename from web/templates/reminder_dashboard/reminder_dashboard.html.tera rename to templates/reminder_dashboard/reminder_dashboard.html.tera diff --git a/web/templates/reminder_dashboard/reminder_errors.html.tera b/templates/reminder_dashboard/reminder_errors.html.tera similarity index 100% rename from web/templates/reminder_dashboard/reminder_errors.html.tera rename to templates/reminder_dashboard/reminder_errors.html.tera diff --git a/web/templates/reminder_dashboard/user_error.html.tera b/templates/reminder_dashboard/user_error.html.tera similarity index 100% rename from web/templates/reminder_dashboard/user_error.html.tera rename to templates/reminder_dashboard/user_error.html.tera diff --git a/web/templates/return.html.tera b/templates/return.html.tera similarity index 100% rename from web/templates/return.html.tera rename to templates/return.html.tera diff --git a/web/templates/support/create_reminder.html.tera b/templates/support/create_reminder.html.tera similarity index 100% rename from web/templates/support/create_reminder.html.tera rename to templates/support/create_reminder.html.tera diff --git a/web/templates/support/dashboard.html.tera b/templates/support/dashboard.html.tera similarity index 100% rename from web/templates/support/dashboard.html.tera rename to templates/support/dashboard.html.tera diff --git a/web/templates/support/delete_reminder.html.tera b/templates/support/delete_reminder.html.tera similarity index 100% rename from web/templates/support/delete_reminder.html.tera rename to templates/support/delete_reminder.html.tera diff --git a/web/templates/support/iemanager.html.tera b/templates/support/iemanager.html.tera similarity index 100% rename from web/templates/support/iemanager.html.tera rename to templates/support/iemanager.html.tera diff --git a/web/templates/support/intervals.html.tera b/templates/support/intervals.html.tera similarity index 100% rename from web/templates/support/intervals.html.tera rename to templates/support/intervals.html.tera diff --git a/web/templates/support/macros.html.tera b/templates/support/macros.html.tera similarity index 100% rename from web/templates/support/macros.html.tera rename to templates/support/macros.html.tera diff --git a/web/templates/support/timers.html.tera b/templates/support/timers.html.tera similarity index 100% rename from web/templates/support/timers.html.tera rename to templates/support/timers.html.tera diff --git a/web/templates/support/timezone.html.tera b/templates/support/timezone.html.tera similarity index 100% rename from web/templates/support/timezone.html.tera rename to templates/support/timezone.html.tera diff --git a/web/templates/support/todo_lists.html.tera b/templates/support/todo_lists.html.tera similarity index 100% rename from web/templates/support/todo_lists.html.tera rename to templates/support/todo_lists.html.tera diff --git a/web/templates/terms.html.tera b/templates/terms.html.tera similarity index 100% rename from web/templates/terms.html.tera rename to templates/terms.html.tera diff --git a/web/Cargo.toml b/web/Cargo.toml deleted file mode 100644 index 9fd5e96..0000000 --- a/web/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "reminder_web" -version = "0.1.8" -authors = ["jellywx "] -edition = "2018" - -[dependencies] -rocket = { version = "0.5.0", features = ["tls", "secrets", "json"] } -rocket_dyn_templates = { version = "0.1.0", features = ["tera"] } -serenity = { version = "0.12", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] } -oauth2 = "4" -log = "0.4" -reqwest = { version = "0.11", features = ["json"] } -serde = { version = "1.0", features = ["derive"] } -sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", "chrono", "json"] } -chrono = "0.4" -chrono-tz = "0.8" -lazy_static = "1.4.0" -rand = "0.8" -base64 = "0.13" -csv = "1.2" -prometheus = "0.13.3" -secrecy = "0.8.0" diff --git a/web/src/metrics.rs b/web/src/metrics.rs deleted file mode 100644 index 13754ae..0000000 --- a/web/src/metrics.rs +++ /dev/null @@ -1,43 +0,0 @@ -use lazy_static::lazy_static; -use prometheus::{IntCounterVec, Opts, Registry}; -use rocket::{ - fairing::{Fairing, Info, Kind}, - Data, Request, Response, -}; - -lazy_static! { - pub static ref REGISTRY: Registry = Registry::new(); - static ref REQUEST_COUNTER: IntCounterVec = - IntCounterVec::new(Opts::new("requests", "Requests"), &["method", "route"]).unwrap(); - static ref RESPONSE_COUNTER: IntCounterVec = - IntCounterVec::new(Opts::new("responses", "Responses"), &["status", "route"]).unwrap(); -} - -pub fn init_metrics() { - REGISTRY.register(Box::new(REQUEST_COUNTER.clone())).unwrap(); -} - -pub struct MetricProducer; - -#[rocket::async_trait] -impl Fairing for MetricProducer { - fn info(&self) -> Info { - Info { name: "Metrics fairing", kind: Kind::Request } - } - - async fn on_request(&self, req: &mut Request<'_>, _data: &mut Data<'_>) { - if let Some(route) = req.route() { - REQUEST_COUNTER - .with_label_values(&[req.method().as_str(), &route.uri.to_string()]) - .inc(); - } - } - - async fn on_response<'r>(&self, req: &'r Request<'_>, resp: &mut Response<'r>) { - if let Some(route) = req.route() { - RESPONSE_COUNTER - .with_label_values(&[&resp.status().code.to_string(), &route.uri.to_string()]) - .inc(); - } - } -} diff --git a/web/src/routes/admin.rs b/web/src/routes/admin.rs deleted file mode 100644 index 6470874..0000000 --- a/web/src/routes/admin.rs +++ /dev/null @@ -1,182 +0,0 @@ -use std::{collections::HashMap, env}; - -use chrono::{DateTime, Utc}; -use rocket::{ - http::{CookieJar, Status}, - serde::json::json, - State, -}; -use rocket_dyn_templates::Template; -use serde::Serialize; -use sqlx::{MySql, Pool}; - -use crate::routes::JsonResult; - -fn is_admin(cookies: &CookieJar<'_>) -> bool { - cookies - .get_private("userid") - .map_or(false, |cookie| Some(cookie.value().to_string()) == env::var("ADMIN_ID").ok()) -} - -#[get("/")] -pub async fn admin_dashboard_home(cookies: &CookieJar<'_>) -> Result { - if let Some(cookie) = cookies.get_private("userid") { - let map: HashMap<&str, String> = HashMap::new(); - if Some(cookie.value().to_string()) == env::var("ADMIN_ID").ok() { - Ok(Template::render("admin_dashboard", &map)) - } else { - Err(Status::Forbidden) - } - } else { - Err(Status::Unauthorized) - } -} - -#[derive(Serialize)] -struct TimeFrame { - time_key: DateTime, - count: i64, -} - -#[get("/data")] -pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State>) -> JsonResult { - if !is_admin(cookies) { - return json_err!("Not authorized"); - } - - let backlog = sqlx::query!( - "SELECT COUNT(1) AS backlog FROM reminders WHERE `utc_time` < NOW() AND enabled = 1 AND `status` = 'pending'" - ) - .fetch_one(pool.inner()) - .await - .unwrap(); - - let schedule_once = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 300) * 300) AS `time_key`, - COUNT(1) AS `count` - FROM reminders - WHERE - `utc_time` < DATE_ADD(NOW(), INTERVAL 1 DAY) AND - `utc_time` >= NOW() AND - `enabled` = 1 AND - `status` = 'pending' AND - `interval_seconds` IS NULL AND - `interval_months` IS NULL AND - `interval_days` IS NULL - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - - let schedule_interval = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 300) * 300) AS `time_key`, - COUNT(1) AS `count` - FROM reminders - WHERE - `utc_time` < DATE_ADD(NOW(), INTERVAL 1 DAY) AND - `utc_time` >= NOW() AND - `status` = 'pending' AND - `enabled` = 1 AND ( - `interval_seconds` IS NOT NULL OR - `interval_months` IS NOT NULL OR - `interval_days` IS NOT NULL - ) - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - - let schedule_once_long = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 86400) * 86400) AS `time_key`, - COUNT(1) AS `count` - FROM reminders - WHERE - `utc_time` < DATE_ADD(NOW(), INTERVAL 31 DAY) AND - `utc_time` >= NOW() AND - `enabled` = 1 AND - `status` = 'pending' AND - `interval_seconds` IS NULL AND - `interval_months` IS NULL AND - `interval_days` IS NULL - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - - let schedule_interval_long = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 86400) * 86400) AS `time_key`, - COUNT(1) AS `count` - FROM reminders - WHERE - `utc_time` < DATE_ADD(NOW(), INTERVAL 31 DAY) AND - `utc_time` >= NOW() AND - `status` = 'pending' AND - `enabled` = 1 AND ( - `interval_seconds` IS NOT NULL OR - `interval_months` IS NOT NULL OR - `interval_days` IS NOT NULL - ) - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - - let interval_count = sqlx::query!( - "SELECT COUNT(1) AS count - FROM reminders - WHERE - `status` = 'pending' AND ( - `interval_seconds` IS NOT NULL OR - `interval_months` IS NOT NULL OR - `interval_days` IS NOT NULL - )" - ) - .fetch_one(pool.inner()) - .await - .unwrap(); - - let reminder_count = sqlx::query!( - "SELECT COUNT(1) AS count - FROM reminders - WHERE - `status` = 'pending' AND - `interval_seconds` IS NULL AND - `interval_months` IS NULL AND - `interval_days` IS NULL" - ) - .fetch_one(pool.inner()) - .await - .unwrap(); - - Ok(json!({ - "backlog": backlog.backlog, - "scheduleShort": { - "once": schedule_once, - "interval": schedule_interval - }, - "scheduleLong": { - "once": schedule_once_long, - "interval": schedule_interval_long, - }, - "count": { - "reminders": reminder_count.count, - "intervals": interval_count.count, - } - })) -} diff --git a/web/src/routes/metrics.rs b/web/src/routes/metrics.rs deleted file mode 100644 index e81785d..0000000 --- a/web/src/routes/metrics.rs +++ /dev/null @@ -1,16 +0,0 @@ -use crate::metrics::REGISTRY; - -#[get("/metrics")] -pub async fn metrics() -> String { - let encoder = prometheus::TextEncoder::new(); - let res_custom = encoder.encode_to_string(®ISTRY.gather()); - - match res_custom { - Ok(s) => s, - Err(e) => { - warn!("Error encoding metrics: {:?}", e); - - String::new() - } - } -}