1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Start to extract remote IP address

This commit is contained in:
2021-01-23 08:19:10 +01:00
parent ebc5ebea2a
commit 82fcd95fd3
2 changed files with 13 additions and 3 deletions

View File

@ -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()? {