Update worker-rs

This commit is contained in:
Simon Bihel
2022-02-08 10:53:28 +00:00
parent 9d42c5a99b
commit bf48c61007
5 changed files with 96 additions and 98 deletions

View File

@@ -116,20 +116,14 @@ impl DBClient for CFClient {
Ok(())
}
async fn get_client(&self, client_id: String) -> Result<Option<ClientEntry>> {
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

View File

@@ -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<Response> {
pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result<Response> {
worker_main(req, env).await
}

View File

@@ -173,7 +173,7 @@ async fn resolve_name(eth_provider: Option<Url>, address: H160) -> String {
}
}
async fn resolve_avatar(eth_provider: Option<Url>, address: H160) -> Option<Url> {
async fn resolve_avatar(_eth_provider: Option<Url>, _address: H160) -> Option<Url> {
None
}