diff --git a/Cargo.lock b/Cargo.lock index a7b1074d..b5d8a226 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,15 +4,16 @@ version = 3 [[package]] name = "actix-codec" -version = "0.4.0-beta.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90673465c6187bd0829116b02be465dc0195a74d7719f76ffff0effef934a92e" +checksum = "13895df506faee81e423febbae3a33b27fca71831b96bb3d60adf16ebcfea952" dependencies = [ "bitflags", "bytes", "futures-core", "futures-sink", "log", + "memchr", "pin-project-lite", "tokio", "tokio-util", @@ -20,14 +21,13 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.0.0-beta.4" +version = "3.0.0-beta.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a01f9e0681608afa887d4269a0857ac4226f09ba5ceda25939e8391c9da610a" +checksum = "055b723746f19534fc5c9a210788686542986d6f1b9cb2900a297bb4c6619f3b" dependencies = [ "actix-codec", "actix-rt", "actix-service", - "actix-tls", "actix-utils", "ahash 0.7.2", "base64", @@ -35,8 +35,6 @@ dependencies = [ "brotli2", "bytes", "bytestring", - "cfg-if", - "cookie", "derive_more", "encoding_rs", "flate2", @@ -45,29 +43,26 @@ dependencies = [ "h2", "http", "httparse", + "httpdate 1.0.2", "itoa", "language-tags", + "local-channel", "log", "mime", - "once_cell", "percent-encoding", "pin-project", + "pin-project-lite", "rand 0.8.3", - "regex", - "serde 1.0.124", - "serde_json", - "serde_urlencoded", "sha-1", "smallvec", - "time 0.2.25", - "tokio", + "zstd", ] [[package]] name = "actix-macros" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbcb2b608f0accc2f5bcf3dd872194ce13d94ee45b571487035864cf966b04ef" +checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" dependencies = [ "quote", "syn", @@ -75,11 +70,12 @@ dependencies = [ [[package]] name = "actix-router" -version = "0.2.7" +version = "0.5.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" +checksum = "36b95ce0d76d1aa2f98b681702807475ade0f99bd4552546a6843a966d42ea3d" dependencies = [ "bytestring", + "firestorm", "http", "log", "regex", @@ -88,9 +84,9 @@ dependencies = [ [[package]] name = "actix-rt" -version = "2.1.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b4e57bc1a3915e71526d128baf4323700bd1580bc676239e2298a4c5b001f18" +checksum = "05c2f80ce8d0c990941c7a7a931f69fd0701b76d521f8d36298edf59cd3fbf1f" dependencies = [ "actix-macros", "futures-core", @@ -99,69 +95,48 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.0.0-beta.3" +version = "2.0.0-beta.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99198727204a48f82559c18e4b0ba3197b97d5f4576a32bdbef371f3b4599c1" +checksum = "411dd3296dd317ff5eff50baa13f31923ea40ec855dd7f2d3ed8639948f0195f" dependencies = [ - "actix-codec", "actix-rt", "actix-service", "actix-utils", "futures-core", + "futures-util", "log", "mio", "num_cpus", - "slab", + "socket2 0.4.2", "tokio", ] [[package]] name = "actix-service" -version = "2.0.0-beta.4" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca9756f4d32984ac454ae3155a276f6be69b424197bd3f0ca3c87cde72f41d63" +checksum = "8d3dc6a618b082974a08d7a4781d24d4691cba51500059bfebe6656a61ebfe1e" dependencies = [ "futures-core", + "paste", "pin-project-lite", ] -[[package]] -name = "actix-tls" -version = "3.0.0-beta.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b1455e3f7a26d40cfc1080b571f41e8165e5a88e937ed579f7a4b3d55b0370" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "futures-core", - "http", - "log", - "tokio-util", -] - [[package]] name = "actix-utils" -version = "3.0.0-beta.2" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458795e09a29bc5557604f9ff6f32236fd0ee457d631672e4ec8f6a0103bb292" +checksum = "e491cbaac2e7fc788dfff99ff48ef317e23b3cf63dbaf7aaab6418f40f92aa94" dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "futures-core", - "futures-sink", - "log", + "local-waker", "pin-project-lite", ] [[package]] name = "actix-web" -version = "4.0.0-beta.4" +version = "4.0.0-beta.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d95e50c9e32e8456220b5804867de76e97a86ab8c38b51c9edcccc0f0fddca7" +checksum = "1657eb2ed5e8ef246b6e951bafb38644ca433042a65a44f02e5601083b71b895" dependencies = [ "actix-codec", "actix-http", @@ -173,32 +148,38 @@ dependencies = [ "actix-utils", "actix-web-codegen", "ahash 0.7.2", - "awc", "bytes", + "cfg-if", + "cookie", "derive_more", "either", "encoding_rs", "futures-core", "futures-util", + "itoa", + "language-tags", "log", "mime", - "pin-project", + "once_cell", + "paste", + "pin-project-lite", "regex", "serde 1.0.124", "serde_json", "serde_urlencoded", "smallvec", - "socket2", - "time 0.2.25", + "socket2 0.4.2", + "time 0.3.5", "url", ] [[package]] name = "actix-web-codegen" -version = "0.5.0-beta.2" +version = "0.5.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f138ac357a674c3b480ddb7bbd894b13c1b6e8927d728bc9ea5e17eee2f8fc9" +checksum = "dfe80a8828fa88a0420dc8fdd4c16b8207326c917f17701881b063eadc2a8d3b" dependencies = [ + "actix-router", "proc-macro2", "quote", "syn", @@ -249,9 +230,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] @@ -330,32 +311,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "awc" -version = "3.0.0-beta.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09aecd8728f6491a62b27454ea4b36fb7e50faf32928b0369b644e402c651f4e" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "base64", - "bytes", - "cfg-if", - "derive_more", - "futures-core", - "itoa", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "rand 0.8.3", - "serde 1.0.124", - "serde_json", - "serde_urlencoded", -] - [[package]] name = "babyjubjub-rs" version = "0.0.8" @@ -496,6 +451,9 @@ name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -570,9 +528,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.14.4" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +checksum = "d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d" dependencies = [ "percent-encoding", "time 0.2.25", @@ -788,6 +746,12 @@ dependencies = [ "syn", ] +[[package]] +name = "firestorm" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31586bda1b136406162e381a3185a506cdfc1631708dd40cba2f6628d8634499" + [[package]] name = "fixedbitset" version = "0.2.0" @@ -1067,9 +1031,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ "bytes", "fnv", @@ -1089,9 +1053,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -1099,6 +1063,12 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" @@ -1129,10 +1099,10 @@ dependencies = [ "http", "http-body", "httparse", - "httpdate", + "httpdate 0.3.2", "itoa", "pin-project", - "socket2", + "socket2 0.3.19", "tokio", "tower-service", "tracing", @@ -1196,6 +1166,15 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.48" @@ -1207,9 +1186,9 @@ dependencies = [ [[package]] name = "language-tags" -version = "0.2.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lazy_static" @@ -1232,9 +1211,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.88" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" +checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" [[package]] name = "libz-sys" @@ -1264,6 +1243,24 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "local-channel" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6246c68cf195087205a0512559c97e15eaf95198bf0e206d662092cdcb03fe9f" +dependencies = [ + "futures-core", + "futures-sink", + "futures-util", + "local-waker", +] + +[[package]] +name = "local-waker" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f9a2d3e27ce99ce2c3aad0b09b1a7b916293ea9b2bf624c13fe646fadd8da4" + [[package]] name = "lock_api" version = "0.4.2" @@ -1323,9 +1320,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mime" @@ -1362,7 +1359,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ - "socket2", + "socket2 0.3.19", "winapi", ] @@ -1578,7 +1575,7 @@ dependencies = [ [[package]] name = "paperclip" version = "0.5.0" -source = "git+https://github.com/fluidex/paperclip.git#4522e3436ee7235d4ea81c503cd42b3b09d45a58" +source = "git+https://github.com/fluidex/paperclip.git#0679e494bda71bb4681b720c7032d93036d2ea11" dependencies = [ "anyhow", "itertools", @@ -1599,7 +1596,7 @@ dependencies = [ [[package]] name = "paperclip-actix" version = "0.3.0" -source = "git+https://github.com/fluidex/paperclip.git#4522e3436ee7235d4ea81c503cd42b3b09d45a58" +source = "git+https://github.com/fluidex/paperclip.git#0679e494bda71bb4681b720c7032d93036d2ea11" dependencies = [ "actix-service", "actix-web", @@ -1614,7 +1611,7 @@ dependencies = [ [[package]] name = "paperclip-core" version = "0.3.0" -source = "git+https://github.com/fluidex/paperclip.git#4522e3436ee7235d4ea81c503cd42b3b09d45a58" +source = "git+https://github.com/fluidex/paperclip.git#0679e494bda71bb4681b720c7032d93036d2ea11" dependencies = [ "actix-web", "chrono", @@ -1634,7 +1631,7 @@ dependencies = [ [[package]] name = "paperclip-macros" version = "0.4.0" -source = "git+https://github.com/fluidex/paperclip.git#4522e3436ee7235d4ea81c503cd42b3b09d45a58" +source = "git+https://github.com/fluidex/paperclip.git#0679e494bda71bb4681b720c7032d93036d2ea11" dependencies = [ "heck", "http", @@ -1673,6 +1670,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "paste" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" + [[package]] name = "percent-encoding" version = "2.1.0" @@ -1729,9 +1732,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -2054,14 +2057,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", "regex-syntax", - "thread_local", ] [[package]] @@ -2075,9 +2077,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -2367,6 +2369,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "spin" version = "0.5.2" @@ -2662,6 +2674,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "time" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" +dependencies = [ + "itoa", + "libc", +] + [[package]] name = "time-macros" version = "0.1.1" @@ -2768,7 +2790,7 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "socket2", + "socket2 0.3.19", "tokio", "tokio-util", ] @@ -3238,3 +3260,32 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map 0.5.4", ] + +[[package]] +name = "zstd" +version = "0.9.0+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "4.1.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.6.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" +dependencies = [ + "cc", + "libc", +] diff --git a/Cargo.toml b/Cargo.toml index 1827c9ea..f62fac53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] actix-rt = "2.1.0" -actix-web = "4.0.0-beta.4" +actix-web = "4.0.0-beta.12" anyhow = "1.0.38" arrayref = "0.3.6" bytes = "1.0.1" diff --git a/src/restapi/tradingview.rs b/src/restapi/tradingview.rs index 5a1d3b56..7cf0b0cf 100644 --- a/src/restapi/tradingview.rs +++ b/src/restapi/tradingview.rs @@ -3,7 +3,6 @@ use crate::models::MarketDesc; use crate::restapi::errors::RpcError; use crate::restapi::types::{KlineReq, KlineResult, TickerResult}; use crate::restapi::{mock, state}; -use actix_web::Responder; use humantime::parse_duration; use paperclip::actix::web::{self, HttpRequest, Json}; use paperclip::actix::{api_v2_operation, Apiv2Schema}; @@ -14,7 +13,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; // All APIs here follow https://zlq4863947.gitbook.io/tradingview/3-shu-ju-bang-ding/udf #[api_v2_operation] -pub async fn unix_timestamp(_req: HttpRequest) -> impl Responder { +pub async fn unix_timestamp(_req: HttpRequest) -> String { format!("{}", SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()) } @@ -23,7 +22,7 @@ static DEFAULT_SYMBOL: &str = "tradepair"; static DEFAULT_SESSION: &str = "24x7"; #[api_v2_operation] -pub async fn chart_config(_req: HttpRequest) -> impl Responder { +pub async fn chart_config(_req: HttpRequest) -> String { log::debug!("request config"); let value = json!({ "supports_search": true,