|
|
|
@ -11,7 +11,12 @@ use actix_web::{
|
|
|
|
|
web::{self, Bytes},
|
|
|
|
|
App, Error, FromRequest, HttpRequest, HttpResponse, HttpServer,
|
|
|
|
|
};
|
|
|
|
|
use async_std::{fs, path::PathBuf, sync::Sender, task};
|
|
|
|
|
use async_std::{
|
|
|
|
|
fs,
|
|
|
|
|
path::PathBuf,
|
|
|
|
|
sync::{channel, Sender},
|
|
|
|
|
task,
|
|
|
|
|
};
|
|
|
|
|
use file_kind::FileKind;
|
|
|
|
|
use sqlx::{
|
|
|
|
|
postgres::{PgPool, PgRow},
|
|
|
|
@ -155,8 +160,6 @@ async fn main() -> std::io::Result<()> {
|
|
|
|
|
|
|
|
|
|
let pool: PgPool = setup_db().await;
|
|
|
|
|
|
|
|
|
|
log::info!("omnomnom");
|
|
|
|
|
|
|
|
|
|
let config = Config {
|
|
|
|
|
server_url: env::var("SERVER_URL").unwrap_or_else(|_| "http://localhost:8000".to_owned()),
|
|
|
|
|
files_dir: PathBuf::from(env::var("FILES_DIR").unwrap_or_else(|_| "./files".to_owned())),
|
|
|
|
@ -166,7 +169,9 @@ async fn main() -> std::io::Result<()> {
|
|
|
|
|
.await
|
|
|
|
|
.expect("could not create directory for storing files");
|
|
|
|
|
|
|
|
|
|
let (send, recv) = async_std::sync::channel::<()>(1);
|
|
|
|
|
log::info!("omnomnom");
|
|
|
|
|
|
|
|
|
|
let (send, recv) = channel(1);
|
|
|
|
|
task::spawn(deleter::delete_old_files(
|
|
|
|
|
recv,
|
|
|
|
|
pool.clone(),
|
|
|
|
|