Skip to content

Commit 376570a

Browse files
feat: added item count in explorer view
chore: integrated host extractor, updated dependencies
1 parent a101a38 commit 376570a

File tree

23 files changed

+386
-106
lines changed

23 files changed

+386
-106
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ jobs:
2323
name: Build backend with web frontend as docker image and push to docker hub
2424
runs-on: ubuntu-latest
2525
steps:
26+
- name: Free Disk Space (Ubuntu)
27+
uses: jlumbroso/free-disk-space@main
28+
with:
29+
tool-cache: false
30+
android: false
31+
docker-images: false
2632
- name: Code Checkout
2733
uses: actions/checkout@v3
2834
- name: Set up QEMU

.github/workflows/nosetcap-image.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ jobs:
99
name: Build backend with web frontend with no setcap as docker image and push to docker hub
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Free Disk Space (Ubuntu)
13+
uses: jlumbroso/free-disk-space@main
14+
with:
15+
tool-cache: false
16+
android: false
17+
docker-images: false
1218
- name: Code Checkout
1319
uses: actions/checkout@v3
1420
- name: Set up QEMU

.github/workflows/security-audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
- uses: actions-rs/audit-check@v1
2121
with:
2222
token: ${{ secrets.GITHUB_TOKEN }}
23-
- uses: EmbarkStudios/cargo-deny-action@v1
23+
- uses: EmbarkStudios/cargo-deny-action@v2
2424
with:
25-
rust-version: "1.86.0"
25+
rust-version: "1.92.0"

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ ARG RUST_VERSION
77
ARG FLUTTER_VERSION
88

99
# Set up an environnement to cross-compile the app for musl to create a statically-linked binary
10-
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-bookworm AS backend-builder
10+
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-trixie AS backend-builder
1111
ARG TARGETPLATFORM
1212
RUN case "$TARGETPLATFORM" in \
1313
"linux/amd64") echo x86_64-unknown-linux-gnu > /rust_target.txt ;; \
1414
"linux/arm64") echo aarch64-unknown-linux-gnu > /rust_target.txt ;; \
1515
"linux/arm/v7") echo armv7-unknown-linux-gnueabihf > /rust_target.txt ;; \
16-
"linux/arm/v6") echo arm-unknown-linux-musleabihf > /rust_target.txt ;; \
16+
"linux/arm/v6") wget https://github.com/cross-tools/musl-cross/releases/download/20250929/arm-unknown-linux-musleabihf.tar.xz -O - | tar -xJf - -C /opt && echo arm-unknown-linux-musleabihf > /rust_target.txt ;; \
1717
*) exit 1 ;; \
1818
esac
19+
ENV PATH="/opt/arm-unknown-linux-musleabihf/bin:$PATH"
1920
RUN rustup target add $(cat /rust_target.txt)
2021
RUN apt update && apt install -y clang cmake gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf libc6-dev-i386 libcap2-bin libclang-dev musl-dev musl-tools
2122
RUN ln -s /usr/include/asm-generic /usr/include/asm
@@ -66,9 +67,9 @@ RUN flutter build web
6667
# Stage 3 : Final image #
6768
#########################
6869

69-
FROM --platform=linux/amd64 gcr.io/distroless/cc-debian12 AS base-amd64
70-
FROM --platform=linux/arm64 gcr.io/distroless/cc-debian12 AS base-arm64
71-
FROM --platform=linux/arm/v7 gcr.io/distroless/cc-debian12 AS base-armv7
70+
FROM --platform=linux/amd64 gcr.io/distroless/cc-debian13 AS base-amd64
71+
FROM --platform=linux/arm64 gcr.io/distroless/cc-debian13 AS base-arm64
72+
FROM --platform=linux/arm/v7 gcr.io/distroless/cc-debian13 AS base-armv7
7273
FROM --platform=linux/arm/v6 scratch AS base-armv6
7374

7475
FROM base-${TARGETARCH}${TARGETVARIANT}

backend/.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[target.arm-unknown-linux-musleabihf]
2-
linker = "arm-linux-gnueabihf-gcc"
2+
linker = "arm-unknown-linux-musleabihf-gcc"
33

44
[target.armv7-unknown-linux-gnueabihf]
55
linker = "arm-linux-gnueabihf-gcc"

backend/Cargo.toml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ argon2 = { features = ["alloc", "password-hash"], default-features = false, vers
1616
async_zip = { features = ["deflate", "tokio"], default-features = false, version = "0.0.18" }
1717
async-stream = "0.3.6"
1818
async-walkdir = "2.1.0"
19-
aws-lc-rs = { version = "1.15.1", default-features = false, features = ["bindgen"] }
20-
axum = { version = "0.8.7", features = ["http2", "json", "query", "tokio"], default-features = false }
21-
axum-extra = { version = "0.12.2", features = ["cookie-private", "typed-header"], default-features = false }
22-
axum-server = { version = "0.7.3", default-features = false, features = ["tls-rustls"] }
23-
base64ct = { version = "1.8.0", features = ["alloc"] }
19+
aws-lc-rs = { version = "1.15.2", default-features = false, features = ["bindgen"] }
20+
axum = { version = "0.8.8", features = ["http2", "json", "query", "tokio"], default-features = false }
21+
axum-extra = { version = "0.12.5", features = ["cookie-private", "typed-header"], default-features = false }
22+
axum-server = { version = "0.8.0", default-features = false, features = ["tls-rustls"] }
23+
base64ct = { version = "1.8.2", features = ["alloc"] }
2424
chacha20poly1305 = { version = "0.10.1", features = ["stream"], default-features = false }
2525
chrono = { default-features = false, version = "0.4.42" }
2626
filetime = "0.2.26"
@@ -34,29 +34,29 @@ hyper-hickory = { version = "0.8.0", default-features = false, features = ["syst
3434
hyper-rustls = { version = "0.27.7", features = ["aws-lc-rs", "http1", "http2", "tls12", "webpki-tokio"], default-features = false }
3535
hyper-util = { version = "0.1.19", features = ["client-legacy", "http1", "tokio"], default-features = false }
3636
jsonwebtoken = { version = "10.2.0", features = ["aws_lc_rs"], default-features = false }
37-
maxminddb = "0.27.0"
37+
maxminddb = "0.27.1"
3838
mime_guess = { default-features = false, version = "2.0.5" }
3939
oauth2 = { version = "5.0.0", default-features = false }
4040
percent-encoding = { default-features = false, version = "2.3.2" }
4141
quick-xml = "0.38.4"
4242
rand = { default-features = false, version = "0.9.2", features = ["os_rng"] }
43-
rcgen = { version = "0.14.5", default-features = false, optional = true, features = ["aws_lc_rs", "crypto", "pem"] }
43+
rcgen = { version = "0.14.6", default-features = false, optional = true, features = ["aws_lc_rs", "crypto", "pem"] }
4444
rustls = { default-features = false, version = "0.23.35", features = ["aws_lc_rs"] }
45-
rustls-acme = { version = "0.14.1", features = ["aws-lc-rs", "axum", "webpki-roots"], default-features = false }
46-
rustls-pki-types = { version = "1.13.1" }
45+
rustls-acme = { version = "0.15.0", features = ["aws-lc-rs", "axum", "webpki-roots"], default-features = false }
46+
rustls-pki-types = { version = "1.13.2" }
4747
serde = { version = "1.0.228", default-features = false }
48-
serde_json = { default-features = false, version = "1.0.145" }
48+
serde_json = { default-features = false, version = "1.0.148" }
4949
serde_yaml_ng = "0.10.0"
5050
sha2 = { default-features = false, version = "0.10.9" }
5151
sysinfo = { default-features = false, version = "0.37.2", features = ["disk", "system"] }
5252
time = { default-features = false, version = "0.3.44" }
53-
tokio = { version = "1.48.0", features = ["full"], default-features = false }
54-
tokio-stream = { version = "0.1.17", default-features = false }
55-
tokio-util = { version = "0.7.17", default-features = false }
53+
tokio = { version = "1.49.0", features = ["full"], default-features = false }
54+
tokio-stream = { version = "0.1.18", default-features = false }
55+
tokio-util = { version = "0.7.18", default-features = false }
5656
tower = { default-features = false, version = "0.5.2", features = ["util"] }
57-
tower-http = { version = "0.6.7", features = ["fs"], default-features = false }
57+
tower-http = { version = "0.6.8", features = ["fs"], default-features = false }
5858
tower-service = "0.3.3"
59-
tracing = { default-features = false, version = "0.1.43", features = ["attributes"] }
59+
tracing = { default-features = false, version = "0.1.44", features = ["attributes"] }
6060
tracing-appender = "0.2.4"
6161
tracing-subscriber = { version = "0.3.22", features = ["ansi", "env-filter", "local-time"], default-features = false }
6262
trim-in-place = "0.1.7"
@@ -69,8 +69,9 @@ self_signed = ["dep:rcgen"]
6969

7070
[dev-dependencies]
7171
async-tungstenite = { version = "0.32.0", features = ["tokio-runtime"] }
72-
reqwest = { version = "0.12.24", default-features = false, features = ["cookies", "json", "native-tls", "stream"] }
73-
tempfile = "3.23.0"
72+
axum = { version = "0.8.8", features = ["__private"], default-features = false }
73+
reqwest = { version = "0.13.1", default-features = false, features = ["cookies", "json", "native-tls", "stream"] }
74+
tempfile = "3.24.0"
7475
tungstenite = "0.28.0"
7576

7677
[profile.release_optimized]

backend/deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ignore = [
8888
# List of explicitly allowed licenses
8989
# See https://spdx.org/licenses/ for list of possible licenses
9090
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
91-
allow = ["AGPL-3.0", "Apache-2.0", "BSD-3-Clause", "CDLA-Permissive-2.0", "ISC", "MIT", "OpenSSL", "Unicode-3.0"]
91+
allow = ["AGPL-3.0-or-later", "Apache-2.0", "BSD-3-Clause", "CDLA-Permissive-2.0", "ISC", "MIT", "OpenSSL", "Unicode-3.0"]
9292
# The confidence threshold for detecting a license from license text.
9393
# The higher the value, the more closely the license text must be to the
9494
# canonical license text of a valid SPDX license file.

backend/src/apps/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use super::extract::Host;
12
use axum::{
23
Json,
34
body::Body,
@@ -8,7 +9,6 @@ use axum::{
89
},
910
response::IntoResponse,
1011
};
11-
use axum_extra::extract::Host;
1212
use base64ct::Encoding;
1313
use headers::HeaderValue;
1414
use http::{
@@ -128,7 +128,7 @@ pub async fn proxy_handler<S>(
128128
user: Option<UserTokenWithoutXSRFCheck>,
129129
ConnectInfo(addr): ConnectInfo<SocketAddr>,
130130
app: HostType,
131-
Host(hostname): Host,
131+
host: Host,
132132
State(config): State<ConfigState>,
133133
State(client): State<S>,
134134
mut req: Request<Body>,
@@ -137,7 +137,7 @@ where
137137
S: tower_service::Service<Request<Body>, Response = http::Response<hyper::body::Incoming>>,
138138
<S as tower_service::Service<Request<Body>>>::Error: std::fmt::Debug,
139139
{
140-
authorized_or_redirect_to_login(&app, &user, &hostname, &req, &config).map_err(|b| *b)?;
140+
authorized_or_redirect_to_login(&app, &user, host.as_str(), &req, &config).map_err(|b| *b)?;
141141

142142
let app = match app {
143143
HostType::SkipVerifyReverseApp(app) | HostType::ReverseApp(app) => app,
@@ -153,11 +153,11 @@ where
153153
if app.forward_authority.port().is_some() {
154154
req.headers_mut().insert(
155155
"X-Forwarded-Host",
156-
HeaderValue::from_str(&hostname).map_err(ProxyError::from)?,
156+
HeaderValue::from_str(host.as_str()).map_err(ProxyError::from)?,
157157
);
158158
req.headers_mut().insert(
159159
HOST,
160-
HeaderValue::from_str(&hostname).map_err(ProxyError::from)?,
160+
HeaderValue::from_str(host.as_str()).map_err(ProxyError::from)?,
161161
);
162162
req.headers_mut().insert(
163163
"X-Forwarded-Proto",
@@ -224,9 +224,7 @@ where
224224
// if so, replace the target service host with the front service host
225225
let mut parts = location_uri.into_parts();
226226
parts.scheme = Some(app.app_scheme);
227-
if let Ok(authority) = hostname.parse::<Authority>() {
228-
parts.authority = Some(authority);
229-
}
227+
parts.authority = Some(host.into());
230228
if let Ok(uri) = Uri::from_parts(parts)
231229
&& let Ok(uri) = HeaderValue::from_str(&uri.to_string())
232230
{

backend/src/configuration.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::{
33
appstate::{ConfigMap, ConfigState},
44
davs::model::Dav,
55
errors::Error,
6+
extract,
67
oauth2::{RolesMap, openid_configuration},
78
users::User,
89
utils::{is_default, option_string_trim, string_trim},
@@ -366,17 +367,13 @@ where
366367
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
367368
let configmap = ConfigMap::from_ref(state);
368369

369-
let host = <axum_extra::extract::Host as FromRequestParts<S>>::from_request_parts(
370-
parts, state,
371-
)
372-
.await
373-
.map_err(|_| StatusCode::NOT_FOUND)?;
374-
375-
let hostname = host.0.split_once(':').unwrap_or((&host.0, "")).0;
370+
let host = <extract::Host as FromRequestParts<S>>::from_request_parts(parts, state)
371+
.await
372+
.map_err(|_| StatusCode::NOT_FOUND)?;
376373

377374
// Work out where to target to
378375
let target = configmap
379-
.get(hostname)
376+
.get(host.hostname())
380377
.ok_or(())
381378
.map_err(|_| StatusCode::NOT_FOUND)?;
382379
let target = (*target).clone();

backend/src/davs/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub(crate) mod headers;
44
pub mod model;
55
pub(crate) mod webdav_server;
66

7+
use super::extract::Host;
78
use crate::{
89
appstate::MAXMIND_READER,
910
configuration::HostType,
@@ -15,7 +16,6 @@ use axum::{
1516
extract::ConnectInfo,
1617
http::{Request, Response},
1718
};
18-
use axum_extra::extract::Host;
1919
use http::Method;
2020
use std::{net::SocketAddr, sync::LazyLock};
2121
use tracing::info;
@@ -37,7 +37,7 @@ pub async fn webdav_handler(
3737
user: Option<UserToken>,
3838
ConnectInfo(addr): ConnectInfo<SocketAddr>,
3939
dav: HostType,
40-
Host(hostname): Host,
40+
host: Host,
4141
req: Request<Body>,
4242
) -> Response<Body> {
4343
let method = req.method().to_owned();
@@ -49,11 +49,9 @@ pub async fn webdav_handler(
4949
user.as_ref().map_or_else(|| "unknown user", |u| &u.login),
5050
city_from_ip(addr, MAXMIND_READER.get())
5151
);
52-
let domain = hostname.split(':').next().unwrap_or_default();
53-
5452
if method != Method::OPTIONS
5553
&& let Err(access_denied_resp) =
56-
check_authorization(&dav, user.as_ref(), domain, req.uri().path())
54+
check_authorization(&dav, user.as_ref(), host.hostname(), req.uri().path())
5755
{
5856
tokio::spawn(async move {
5957
info!("FILE ACCESS DENIED: {log_str}");

0 commit comments

Comments
 (0)