From 29d9fc90a1087ebce814592d12dbd3fae633d1f2 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 25 Sep 2024 23:53:06 +0200 Subject: [PATCH] add cors to server --- Cargo.lock | 3 ++- crates/web3_account_server/Cargo.toml | 3 ++- crates/web3_account_server/src/main.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c679d1c..fef1b726 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4401,8 +4401,9 @@ dependencies = [ [[package]] name = "web3_account_server" -version = "0.4.10" +version = "0.4.11" dependencies = [ + "actix-cors", "actix-web", "actix-web-httpauth", "env_logger", diff --git a/crates/web3_account_server/Cargo.toml b/crates/web3_account_server/Cargo.toml index a2f443f4..b4b07c4f 100644 --- a/crates/web3_account_server/Cargo.toml +++ b/crates/web3_account_server/Cargo.toml @@ -5,9 +5,10 @@ edition = "2021" name = "web3_account_server" license = "MIT" repository = "https://github.com/scx1332/" -version = "0.4.10" +version = "0.4.11" [dependencies] +actix-cors = { workspace = true } actix-web = { workspace = true } actix-web-httpauth = { workspace = true } env_logger = { workspace = true } diff --git a/crates/web3_account_server/src/main.rs b/crates/web3_account_server/src/main.rs index 0f3195d4..a3d9ac53 100644 --- a/crates/web3_account_server/src/main.rs +++ b/crates/web3_account_server/src/main.rs @@ -163,6 +163,7 @@ async fn main() -> std::io::Result<()> { .app_data(web::Data::new(app_state.clone())) .wrap(actix_web::middleware::Logger::default()) .wrap(auth) + .wrap(actix_cors::Cors::permissive()) .route("/count", web::get().to(count)) .route("/add", web::post().to(add_to_queue)) .route("/get", web::get().to(get_from_queue))