add: use RemoteAddr for ip blocks as well
This commit is contained in:
parent
14936b8b90
commit
f5faed7762
12 changed files with 127 additions and 28 deletions
|
@ -11,6 +11,7 @@ use axum::{
|
|||
};
|
||||
use axum_extra::extract::CookieJar;
|
||||
use tetratto_core::model::{
|
||||
addr::RemoteAddr,
|
||||
auth::{AchievementName, FollowResult, IpBlock, Notification, UserBlock, UserFollow},
|
||||
oauth,
|
||||
};
|
||||
|
@ -228,7 +229,10 @@ pub async fn ip_block_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
if let Ok(ipblock) = data.get_ipblock_by_initiator_receiver(user.id, &ip).await {
|
||||
if let Ok(ipblock) = data
|
||||
.get_ipblock_by_initiator_receiver(user.id, &RemoteAddr::from(ip.as_str()))
|
||||
.await
|
||||
{
|
||||
// delete
|
||||
match data.delete_ipblock(ipblock.id, user).await {
|
||||
Ok(_) => Json(ApiReturn {
|
||||
|
@ -335,7 +339,7 @@ pub async fn ip_block_profile_request(
|
|||
for (ip, _, _) in other_user.tokens {
|
||||
// check for an existing ip block
|
||||
if data
|
||||
.get_ipblock_by_initiator_receiver(user.id, &ip)
|
||||
.get_ipblock_by_initiator_receiver(user.id, &RemoteAddr::from(ip.as_str()))
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue