From 4200432e1f00674035589fa8f14381bd6775b17c Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Thu, 5 Oct 2023 00:07:55 -0400 Subject: [PATCH 1/2] Make sure to compress the tar files when bundling for distribution --- dashboard/dist.sh | 2 +- file-service/dist.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboard/dist.sh b/dashboard/dist.sh index 5de8bd4..d7753aa 100755 --- a/dashboard/dist.sh +++ b/dashboard/dist.sh @@ -7,5 +7,5 @@ mkdir -p dist cp dashboard.desktop dist cp ../target/release/dashboard dist strip dist/dashboard -tar -cf dashboard.tgz dist/ +tar -czf dashboard.tgz dist/ diff --git a/file-service/dist.sh b/file-service/dist.sh index 56acf95..ce4609d 100755 --- a/file-service/dist.sh +++ b/file-service/dist.sh @@ -9,5 +9,5 @@ cp ../target/release/file-service dist cp ../target/release/auth-cli dist strip dist/file-service strip dist/auth-cli -tar -cf file-service-${VERSION}.tar.gz dist/ +tar -czf file-service-${VERSION}.tgz dist/ -- 2.44.1 From f9974e79a7528940a95b04d45cb01e9670215db9 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Thu, 5 Oct 2023 00:08:27 -0400 Subject: [PATCH 2/2] Set a maximum upload to 15MB --- file-service/src/main.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/file-service/src/main.rs b/file-service/src/main.rs index 0489779..ffa4ad7 100644 --- a/file-service/src/main.rs +++ b/file-service/src/main.rs @@ -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") -- 2.44.1