docs: start work on default development configuration

This commit is contained in:
Paul Makles
2024-09-09 12:49:38 +01:00
parent 2433fa661a
commit 0bbb9e7072
10 changed files with 233 additions and 6 deletions

View File

@@ -22,8 +22,8 @@ async fn main() {
clear_region(None).await;
// Setup a TCP listener to accept WebSocket connections on.
// By default, we bind to port 9000 on all interfaces.
let bind = env::var("HOST").unwrap_or_else(|_| "0.0.0.0:9000".into());
// By default, we bind to port 14703 on all interfaces.
let bind = env::var("HOST").unwrap_or_else(|_| "0.0.0.0:14703".into());
info!("Listening on host {bind}");
let try_socket = TcpListener::bind(bind).await;
let listener = try_socket.expect("Failed to bind");

View File

@@ -90,6 +90,14 @@ max_concurrent_connections = 50
encryption_key = "qcuMA+ssxhMyKaNAKBGFfryfFtUH8NDlamQyDwGW6fU="
# Quality used for lossy WebP previews (set to 100 for lossless)
webp_quality = 80.0
# Mime types that cannot be uploaded or served
#
# Example for Windows executables and Android installation files:
# ["application/vnd.microsoft.portable-executable", "application/vnd.android.package-archive"]
blocked_mime_types = []
# ClamAV service
# hostname:port
clamd_host = ""
[files.limit]
# Minimum image resolution

View File

@@ -146,6 +146,9 @@ pub struct FilesS3 {
pub struct Files {
pub encryption_key: String,
pub webp_quality: f32,
pub blocked_mime_types: Vec<String>,
pub clamd_host: String,
pub limit: FilesLimit,
pub preview: HashMap<String, [usize; 2]>,
pub s3: FilesS3,

View File

@@ -40,7 +40,11 @@ auto_derived!(
/// File contains textual data and should be displayed as such
Text,
/// File is an image with specific dimensions
Image { width: isize, height: isize },
Image {
width: isize,
height: isize,
// animated: bool // TODO: https://docs.rs/image/latest/image/trait.AnimationDecoder.html
},
/// File is a video with specific dimensions
Video { width: isize, height: isize },
/// File is audio

View File

@@ -97,6 +97,7 @@ pub async fn web() -> Rocket<Build> {
.configure(rocket::Config {
limits: rocket::data::Limits::default().limit("string", 5.megabytes()),
address: Ipv4Addr::new(0, 0, 0, 0).into(),
port: 14702,
..Default::default()
})
}

View File

@@ -69,7 +69,7 @@ async fn main() -> Result<(), std::io::Error> {
.with_state(db);
// Configure TCP listener and bind
let address = SocketAddr::from((Ipv4Addr::UNSPECIFIED, 3000));
let address = SocketAddr::from((Ipv4Addr::UNSPECIFIED, 14704));
let listener = TcpListener::bind(&address).await?;
axum::serve(listener, app.into_make_service()).await
}

View File

@@ -65,7 +65,7 @@ async fn main() -> Result<(), std::io::Error> {
.nest("/", api::router().await);
// Configure TCP listener and bind
let address = SocketAddr::from((Ipv4Addr::UNSPECIFIED, 3000));
let address = SocketAddr::from((Ipv4Addr::UNSPECIFIED, 14705));
let listener = TcpListener::bind(&address).await?;
axum::serve(listener, app.into_make_service()).await
}