mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 21:39:21 +00:00
Start to extract remote IP address
This commit is contained in:
parent
ebc5ebea2a
commit
82fcd95fd3
@ -254,7 +254,8 @@ async fn process_request(custom_req: CustomRequest) -> HttpResponse {
|
||||
request.internal_error(e).unwrap_err();
|
||||
}
|
||||
|
||||
println!("{} - {} - {}",
|
||||
println!("{} - {} - {} - {}",
|
||||
request.remote_ip(),
|
||||
request.response_status_code(),
|
||||
request.request_path(),
|
||||
err_msg
|
||||
@ -267,7 +268,11 @@ async fn process_request(custom_req: CustomRequest) -> HttpResponse {
|
||||
request.success("Success").unwrap()
|
||||
}
|
||||
|
||||
println!("{} - {}", request.response_status_code(), request.request_path());
|
||||
println!("{} - {} - {}",
|
||||
request.remote_ip(),
|
||||
request.response_status_code(),
|
||||
request.request_path()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,11 @@ impl HttpRequestHandler {
|
||||
self.client.as_ref().unwrap()
|
||||
}
|
||||
|
||||
/// Get the remote IP address
|
||||
pub fn remote_ip(&self) -> String {
|
||||
self.request.peer_addr().unwrap().ip().to_string()
|
||||
}
|
||||
|
||||
/// Check if a POST parameter was present in the request or not
|
||||
pub fn has_post_parameter(&self, name: &str) -> bool {
|
||||
self.body.contains_key(name)
|
||||
@ -690,7 +695,7 @@ impl HttpRequestHandler {
|
||||
|
||||
let info = self.ok_or_not_found(
|
||||
custom_emojies_helper::get_single(emoji_id),
|
||||
"Requested emoji not found!"
|
||||
"Requested emoji not found!",
|
||||
)?;
|
||||
|
||||
if &info.user_id != self.user_id_ref()? {
|
||||
|
Loading…
Reference in New Issue
Block a user