mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-05-21 02:53:56 +00:00
Send deletion thread and updated users revision
This commit is contained in:
parent
46a1a013cd
commit
1fc6c30652
6 changed files with 34 additions and 5 deletions
|
@ -25,6 +25,23 @@ pub fn routes() -> Vec<rocket::Route> {
|
|||
]
|
||||
}
|
||||
|
||||
pub fn start_send_deletion_scheduler(pool: crate::db::DbPool) {
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
if let Ok(conn) = pool.get() {
|
||||
info!("Initiating send deletion");
|
||||
for send in Send::find_all(&conn) {
|
||||
if chrono::Utc::now().naive_utc() >= send.deletion_date {
|
||||
send.delete(&conn).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::thread::sleep(std::time::Duration::from_secs(3600));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct SendData {
|
||||
|
@ -370,10 +387,6 @@ fn delete_send(id: String, headers: Headers, conn: DbConn, nt: Notify) -> EmptyR
|
|||
err!("Send is not owned by user")
|
||||
}
|
||||
|
||||
if send.atype == SendType::File as i32 {
|
||||
std::fs::remove_dir_all(Path::new(&CONFIG.sends_folder()).join(&send.uuid)).ok();
|
||||
}
|
||||
|
||||
send.delete(&conn)?;
|
||||
nt.send_user_update(UpdateType::SyncSendDelete, &headers.user);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue