Allow larger files to be uploaded to the service #74
|
@ -7,5 +7,5 @@ mkdir -p dist
|
||||||
cp dashboard.desktop dist
|
cp dashboard.desktop dist
|
||||||
cp ../target/release/dashboard dist
|
cp ../target/release/dashboard dist
|
||||||
strip dist/dashboard
|
strip dist/dashboard
|
||||||
tar -cf dashboard.tgz dist/
|
tar -czf dashboard.tgz dist/
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,5 @@ cp ../target/release/file-service dist
|
||||||
cp ../target/release/auth-cli dist
|
cp ../target/release/auth-cli dist
|
||||||
strip dist/file-service
|
strip dist/file-service
|
||||||
strip dist/auth-cli
|
strip dist/auth-cli
|
||||||
tar -cf file-service-${VERSION}.tar.gz dist/
|
tar -czf file-service-${VERSION}.tgz dist/
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,24 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
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 cookie::Cookie;
|
||||||
use futures_util::StreamExt;
|
use handlers::{file, handle_auth, handle_upload, thumbnail};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
io::Read,
|
|
||||||
net::{IpAddr, Ipv4Addr, SocketAddr},
|
net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use warp::{filters::multipart::Part, Filter, Rejection};
|
use warp::{Filter, Rejection};
|
||||||
|
|
||||||
mod handlers;
|
mod handlers;
|
||||||
mod html;
|
mod html;
|
||||||
mod pages;
|
mod pages;
|
||||||
|
|
||||||
|
const MAX_UPLOAD: u64 = 15 * 1024 * 1024;
|
||||||
|
|
||||||
pub use file_service::{
|
pub use file_service::{
|
||||||
AuthDB, AuthError, AuthToken, FileHandle, FileId, FileInfo, ReadFileError, SessionToken, Store,
|
AuthDB, AuthError, AuthToken, FileHandle, FileId, FileInfo, ReadFileError, SessionToken, Store,
|
||||||
Username, WriteFileError,
|
Username, WriteFileError,
|
||||||
|
@ -137,7 +133,7 @@ pub async fn main() {
|
||||||
.and(warp::post())
|
.and(warp::post())
|
||||||
.and(with_app(app.clone()))
|
.and(with_app(app.clone()))
|
||||||
.and(with_session())
|
.and(with_session())
|
||||||
.and(warp::multipart::form())
|
.and(warp::multipart::form().max_length(MAX_UPLOAD))
|
||||||
.then(handle_upload);
|
.then(handle_upload);
|
||||||
|
|
||||||
let thumbnail = warp::path!(String / "tn")
|
let thumbnail = warp::path!(String / "tn")
|
||||||
|
|
Loading…
Reference in New Issue