main
Elnu 2 years ago
parent 6d01857bd0
commit 0de8921306

@ -22,10 +22,11 @@ pub struct Comment {
} }
fn serialize_gravatar<S>(email: &Option<String>, s: S) -> Result<S::Ok, S::Error> fn serialize_gravatar<S>(email: &Option<String>, s: S) -> Result<S::Ok, S::Error>
where S: Serializer, where
S: Serializer,
{ {
match email { match email {
Some(email) => s.serialize_some(&format!("{:x}", md5::compute(email.to_lowercase()))), Some(email) => s.serialize_some(&format!("{:x}", md5::compute(email.to_lowercase()))),
None => s.serialize_none(), None => s.serialize_none(),
} }
} }

@ -63,7 +63,11 @@ async fn main() -> Result<(), std::io::Error> {
.service(get_comments) .service(get_comments)
.service(post_comment) .service(post_comment)
.app_data(state.clone()) .app_data(state.clone())
.wrap(if testing { Cors::permissive() } else { Cors::default() }) .wrap(if testing {
Cors::permissive()
} else {
Cors::default()
})
}) })
.bind(("127.0.0.1", 8080))? .bind(("127.0.0.1", 8080))?
.run() .run()

Loading…
Cancel
Save