include changes as requested
This commit is contained in:
parent
7cd3c91cf1
commit
02c3d6f52d
|
@ -2,7 +2,6 @@
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
use redis::{Client, Commands, AsyncCommands, Connection};
|
use redis::{Client, Commands, AsyncCommands, Connection};
|
||||||
use tokio::task::JoinSet;
|
|
||||||
|
|
||||||
use crate::env::Env;
|
use crate::env::Env;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{collections::HashMap, net::IpAddr};
|
use std::{collections::HashMap, net::IpAddr};
|
||||||
|
|
||||||
|
use serde_json::json;
|
||||||
use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode};
|
use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use warp_real_ip::real_ip;
|
use warp_real_ip::real_ip;
|
||||||
|
@ -106,7 +107,7 @@ pub async fn delete(state: SharedState, body: DeleteFunctionPayload, ip: Option<
|
||||||
|
|
||||||
file.delete(state).await;
|
file.delete(state).await;
|
||||||
|
|
||||||
Ok(Box::new(json(&HashMap::<(), ()>::new())))
|
Ok(Box::new(json(&json!({}))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn delete_f(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
pub fn delete_f(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
||||||
|
|
|
@ -48,7 +48,6 @@ pub async fn get_all(state: SharedState, ip: Option<IpAddr>) -> Result<Box<dyn R
|
||||||
|x| {
|
|x| {
|
||||||
if let Some(owner) = x.uploader_ip {
|
if let Some(owner) = x.uploader_ip {
|
||||||
if let Some(caller) = ip {
|
if let Some(caller) = ip {
|
||||||
println!("{owner} {caller}");
|
|
||||||
return owner == caller
|
return owner == caller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue