From bf48c61007617ec999a125a9185abeec57dda390 Mon Sep 17 00:00:00 2001 From: Simon Bihel Date: Tue, 8 Feb 2022 10:53:28 +0000 Subject: [PATCH] Update worker-rs --- Cargo.lock | 175 ++++++++++++++++++++++++++------------------------- Cargo.toml | 2 +- src/db/cf.rs | 12 +--- src/lib.rs | 3 +- src/oidc.rs | 2 +- 5 files changed, 96 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a250dee..cbdfcb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -dependencies = [ - "memchr", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -479,12 +470,24 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.4.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1878c18b5b01b9978d5f130fe366d434022004d12fb87c182e8459b427c4a3" +checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" dependencies = [ "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +dependencies = [ "parse-zoneinfo", + "phf", + "phf_codegen", ] [[package]] @@ -1340,9 +1343,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ "wasm-bindgen", ] @@ -1747,11 +1750,11 @@ dependencies = [ [[package]] name = "parse-zoneinfo" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ee19a3656dadae35a33467f9714f1228dd34766dbe49e10e656b5296867aea" +checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" dependencies = [ - "regex 0.2.11", + "regex", ] [[package]] @@ -1802,6 +1805,45 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", + "uncased", +] + [[package]] name = "pin-project" version = "1.0.10" @@ -2061,26 +2103,13 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.5.6", - "thread_local 0.3.6", - "utf8-ranges", -] - [[package]] name = "regex" version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ - "regex-syntax 0.6.25", + "regex-syntax", ] [[package]] @@ -2089,16 +2118,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax 0.6.25", -] - -[[package]] -name = "regex-syntax" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -dependencies = [ - "ucd-util", + "regex-syntax", ] [[package]] @@ -2495,6 +2515,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "siphasher" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e" + [[package]] name = "siwe" version = "0.2.0" @@ -2669,15 +2695,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -dependencies = [ - "lazy_static", -] - [[package]] name = "thread_local" version = "1.1.4" @@ -2950,10 +2967,10 @@ dependencies = [ "ansi_term", "lazy_static", "matchers", - "regex 1.5.4", + "regex", "sharded-slab", "smallvec", - "thread_local 1.1.4", + "thread_local", "tracing", "tracing-core", "tracing-log", @@ -2993,12 +3010,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "ucd-util" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85f514e095d348c279b1e5cd76795082cf15bd59b93207832abe0b1d8fed236" - [[package]] name = "uint" version = "0.9.3" @@ -3081,12 +3092,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utf8-ranges" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" - [[package]] name = "uuid" version = "0.8.2" @@ -3143,9 +3148,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if 1.0.0", "serde", @@ -3155,9 +3160,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", @@ -3170,9 +3175,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.29" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3182,9 +3187,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3192,9 +3197,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -3205,9 +3210,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "wasm-timer" @@ -3226,9 +3231,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ "js-sys", "wasm-bindgen", @@ -3326,9 +3331,9 @@ dependencies = [ [[package]] name = "worker" -version = "0.0.7" +version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853c6353dc1ac5ebfcfa13f6af019e5d095861608c6709e924b5e1f65b6979ea" +checksum = "3848a83f15d6b2908b1654d123d11ae6dadd8b5bd77709847603752a0932dc77" dependencies = [ "async-trait", "chrono", @@ -3349,9 +3354,9 @@ dependencies = [ [[package]] name = "worker-kv" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83eabadf47298f90c67f96f59ee98810c21a6ab73e6b7f430183b4ced240cb2" +checksum = "682cbd728f179cc810b2ab77a2534da817b973e190ab184ab8efe1058b0dba84" dependencies = [ "js-sys", "serde", @@ -3363,9 +3368,9 @@ dependencies = [ [[package]] name = "worker-macros" -version = "0.0.2" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d385ea36c8f210a53d7fda3537f2313358e80df52b3c398b5037385431142d17" +checksum = "6bfb9b32a234ca78c62a3214f8d894eebea4930fb5d8730d79c4a3fbf1537703" dependencies = [ "async-trait", "proc-macro2", @@ -3379,9 +3384,9 @@ dependencies = [ [[package]] name = "worker-sys" -version = "0.0.2" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc21da4e6fea16000e4e88419fae1e0893de6c4811a276dcfbe896ffa7b53ea" +checksum = "0f43ff762466dbaa7a1a8a191882829dea9f2c216bdedf8c40c6cff4a9e6c148" dependencies = [ "cfg-if 0.1.10", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index ded31c5..6ec48d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ matchit = "0.4.2" serde_urlencoded = "0.7.0" uuid = { version = "0.8", features = ["serde", "v4", "wasm-bindgen"] } wee_alloc = { version = "0.4" } -worker = "0.0.7" +worker = "0.0.8" [profile.release] opt-level = "z" diff --git a/src/db/cf.rs b/src/db/cf.rs index 90cf5d1..097602a 100644 --- a/src/db/cf.rs +++ b/src/db/cf.rs @@ -116,20 +116,14 @@ impl DBClient for CFClient { Ok(()) } async fn get_client(&self, client_id: String) -> Result> { - let entry = self + Ok(self .ctx .kv(KV_NAMESPACE) .map_err(|e| anyhow!("Failed to get KV store: {}", e))? .get(&format!("{}/{}", KV_CLIENT_PREFIX, client_id)) + .json() .await - .map_err(|e| anyhow!("Failed to get KV: {}", e))? - .map(|e| e.as_string()); - if let Some(e) = entry { - Ok(serde_json::from_str(&e) - .map_err(|e| anyhow!("Failed to deserialize client entry: {}", e))?) - } else { - Ok(None) - } + .map_err(|e| anyhow!("Failed to get KV: {}", e))?) } async fn set_code(&self, code: String, code_entry: CodeEntry) -> Result<()> { let namespace = self diff --git a/src/lib.rs b/src/lib.rs index f89fd3d..a21cb59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,9 @@ pub mod oidc; mod worker_lib; #[cfg(target_arch = "wasm32")] use worker_lib::main as worker_main; -// pub use worker_lib::main; #[cfg(target_arch = "wasm32")] #[event(fetch)] -pub async fn main(req: Request, env: Env) -> Result { +pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result { worker_main(req, env).await } diff --git a/src/oidc.rs b/src/oidc.rs index a701e4f..4ad69cb 100644 --- a/src/oidc.rs +++ b/src/oidc.rs @@ -173,7 +173,7 @@ async fn resolve_name(eth_provider: Option, address: H160) -> String { } } -async fn resolve_avatar(eth_provider: Option, address: H160) -> Option { +async fn resolve_avatar(_eth_provider: Option, _address: H160) -> Option { None }