Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rand = { version = "0.8.5", features = ["small_rng"] }
ahash = "0.8.12"
flexi_logger = { version = "0.29.8", features = ["colors"] }
tokio-stream = { version = "0.1.17", features = ["net"] }
nextcloud-config-parser = "0.15.1"
nextcloud-config-parser = "0.15.2"
url = "2.5.4"
clap = { version = "4.5.43", features = ["derive"] }
sd-notify = { version = "0.4.5", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
};
lib = pkgs.lib;

hostTarget = pkgs.hostPlatform.config;
hostTarget = pkgs.stdenv.hostPlatform.config;
targets = [
"x86_64-unknown-linux-musl"
"i686-unknown-linux-musl"
Expand Down
10 changes: 3 additions & 7 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use sqlx::any::AnyConnectOptions;
use std::convert::{TryFrom, TryInto};
use std::env::var;
use std::fmt::{Debug, Display, Formatter};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::net::{IpAddr, Ipv6Addr, SocketAddr};
use std::path::{Path, PathBuf};
use std::str::FromStr;

Expand Down Expand Up @@ -183,9 +183,7 @@ impl TryFrom<PartialConfig> for Config {
let bind = match config.socket {
Some(socket) => Bind::Unix(socket, socket_permissions),
None => {
let ip = config
.bind
.unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)));
let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED));
let port = config.port.unwrap_or(7867);
Bind::Tcp((ip, port).into())
}
Expand All @@ -194,9 +192,7 @@ impl TryFrom<PartialConfig> for Config {
let metrics_bind = match (config.metrics_socket, config.metrics_port) {
(Some(socket), _) => Some(Bind::Unix(socket, socket_permissions)),
(None, Some(port)) => {
let ip = config
.bind
.unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)));
let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED));
Some(Bind::Tcp((ip, port).into()))
}
_ => None,
Expand Down
7 changes: 5 additions & 2 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ pub async fn handle_user_socket(
// hack while warp only has opaque error types
match formatted.as_str() {
"WebSocket protocol error: Connection reset without closing handshake"
| "Broken pipe (os error 32)"
| "IO error: Connection reset by peer (os error 104)" => {
log::debug!("websocket error: {e:#}")
}
Expand Down Expand Up @@ -262,11 +263,13 @@ async fn socket_auth(
let username_msg = read_socket_auth_message(rx).await?;
let username = username_msg
.to_str()
.map_err(|_| AuthenticationError::InvalidMessage)?;
.map_err(|_| AuthenticationError::InvalidMessage)?
.trim();
let password_msg = read_socket_auth_message(rx).await?;
let password = password_msg
.to_str()
.map_err(|_| AuthenticationError::InvalidMessage)?;
.map_err(|_| AuthenticationError::InvalidMessage)?
.trim();

// cleanup all pre_auth tokens older than 15s
let cutoff = Instant::now() - Duration::from_secs(15);
Expand Down