Conversation
also implement max_registers_per_hour
also remove all instances of impl IntoResponse in endpoint types
also thank you utoipa
|
|
|
Secured access mentions should be removed from |
|
The APISPEC seems to be out of date in general, for example it still has |
|
The plan is to completely remove the apispec in favor of openapi. Also I doubt that the apispec is even 50% correct |
this was done in favor of the new openapi docs
DrVilepis
left a comment
There was a problem hiding this comment.
My preliminary approval now that the pr is starting to be in its final state.
most notably argon2
lajp
left a comment
There was a problem hiding this comment.
This looks almost good to go! I mostly complained about unwrap()s but there's some other comments as well. I did not review tests.
src/api/auth.rs
Outdated
| type Error = TimeError; | ||
| type Future = Pin<Box<dyn Future<Output = actix_web::Result<Self, Self::Error>>>>; | ||
| async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> { | ||
| let auth = parts.extensions.get::<Authentication>().cloned().unwrap(); |
There was a problem hiding this comment.
Should this be a Self::Rejection instead of unwrap
src/api/auth.rs
Outdated
| type Error = TimeError; | ||
| type Future = Pin<Box<dyn Future<Output = actix_web::Result<Self, Self::Error>>>>; | ||
| async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> { | ||
| let auth = parts.extensions.get::<Authentication>().cloned().unwrap(); |
There was a problem hiding this comment.
This probably also shouldn't panic
src/api/auth.rs
Outdated
| type Rejection = TimeError; | ||
|
|
||
| async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> { | ||
| let auth = parts.extensions.get::<Authentication>().cloned().unwrap(); |
|
|
||
| let token = generate_password_reset_token(); | ||
|
|
||
| let message = Message::builder() |
There was a problem hiding this comment.
convert these unwraps to .expect("BUG: <description>") if they are truly infallible
src/api/mod.rs
Outdated
| pub static REGEX: Regex = Regex::new("^[[:word:]]{2,32}$").unwrap(); | ||
| } | ||
| pub static VALID_NAME_REGEX: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new("^[[:word:]]{2,32}$").unwrap()); |
There was a problem hiding this comment.
change this to .expect("BUG: failed to compile name regex") or something like that
| } | ||
|
|
||
| // Wtf is this | ||
| fn project_deserialize<'de, D>(deserializer: D) -> Result<Option<String>, D::Error> |
There was a problem hiding this comment.
should probably be removed :D
src/ratelimiter.rs
Outdated
| let conn_info = req | ||
| .extensions() | ||
| .get::<ConnectInfo<SocketAddr>>() | ||
| .unwrap() |
There was a problem hiding this comment.
.expect("BUG: connection info is always available")
src/ratelimiter.rs
Outdated
| headers.insert( | ||
| HeaderName::from_static("ratelimit-limit"), | ||
| HeaderValue::from_str("a.burst_size().to_string())?, | ||
| HeaderValue::from_str("a.burst_size().to_string()).unwrap(), |
There was a problem hiding this comment.
please .expect all header value creations
src/ratelimiter.rs
Outdated
| Ok(req.into_response(response.map_into_right_body())) | ||
| ) | ||
| .body(Body::empty()) | ||
| .unwrap()) |
src/ratelimiter.rs
Outdated
| Ok(Response::builder() | ||
| .status(StatusCode::INTERNAL_SERVER_ERROR) | ||
| .body(Body::empty()) | ||
| .unwrap()) |
No description provided.