Set a maximum upload to 15MB

This commit is contained in:
Savanni D'Gerinel 2023-10-05 00:08:27 -04:00
parent 4200432e1f
commit f9974e79a7
1 changed files with 5 additions and 9 deletions

View File

@ -1,28 +1,24 @@
#[macro_use]
extern crate log;
use handlers::{file, handle_auth, handle_upload, thumbnail};
use http::status::StatusCode;
// use mustache::{compile_path, Template};
// use orizentic::{Permissions, ResourceName, Secret};
use bytes::Buf;
use cookie::Cookie;
use futures_util::StreamExt;
use handlers::{file, handle_auth, handle_upload, thumbnail};
use std::{
collections::{HashMap, HashSet},
convert::Infallible,
io::Read,
net::{IpAddr, Ipv4Addr, SocketAddr},
path::PathBuf,
sync::Arc,
};
use tokio::sync::RwLock;
use warp::{filters::multipart::Part, Filter, Rejection};
use warp::{Filter, Rejection};
mod handlers;
mod html;
mod pages;
const MAX_UPLOAD: u64 = 15 * 1024 * 1024;
pub use file_service::{
AuthDB, AuthError, AuthToken, FileHandle, FileId, FileInfo, ReadFileError, SessionToken, Store,
Username, WriteFileError,
@ -137,7 +133,7 @@ pub async fn main() {
.and(warp::post())
.and(with_app(app.clone()))
.and(with_session())
.and(warp::multipart::form())
.and(warp::multipart::form().max_length(MAX_UPLOAD))
.then(handle_upload);
let thumbnail = warp::path!(String / "tn")