From fce70776e7cb53e25416e4c3b3e18c249611434c Mon Sep 17 00:00:00 2001 From: Vika Date: Tue, 27 Jul 2021 01:45:45 +0300 Subject: Added CORS middleware This prevents Micropub requests fired from web apps on other domains from being blocked by overzealous browsers. --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index d39aa5e..398c3b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ mod frontend; mod indieauth; mod micropub; +use crate::micropub::CORSMiddleware; use crate::indieauth::IndieAuthMiddleware; #[derive(Clone)] @@ -29,6 +30,7 @@ where Storage: database::Storage + Send + Sync + Clone, { app.at("/micropub") + .with(CORSMiddleware {}) .with(IndieAuthMiddleware::new()) .get(micropub::get_handler) .post(micropub::post_handler); -- cgit 1.4.1