Skip to content

Commit

Permalink
fix: updated dependencies, switching from html renderer to default
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Pernoud committed Jan 16, 2025
1 parent ac74be3 commit 8b9c8ea
Show file tree
Hide file tree
Showing 23 changed files with 210 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.24.3"
flutter-version: "3.27.2"
- name: Decode android/key.jks
run: echo "${{ secrets.KEY_JKS }}" | base64 --decode > android/key.jks
- name: Decode android/key.properties
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.83.0"
rust-version: "1.84.0"
10 changes: 6 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"args": [
"--web-hostname",
"atrium.127.0.0.1.nip.io",
"--web-renderer",
"html",
"--web-port",
"3000"
]
Expand All @@ -23,10 +21,14 @@
"request": "launch",
"name": "Debug atrium backend (axum)",
"cargo": {
"args": ["build", "--manifest-path", "backend/Cargo.toml"]
"args": [
"build",
"--manifest-path",
"backend/Cargo.toml"
]
},
"args": [],
"cwd": "${workspaceRoot}/backend"
}
]
}
}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###########################

# Set up an environnement to cross-compile the app for musl to create a statically-linked binary
FROM --platform=$BUILDPLATFORM rust:1.82 AS backend-builder
FROM --platform=$BUILDPLATFORM rust:1.84 AS backend-builder
ARG TARGETPLATFORM
RUN case "$TARGETPLATFORM" in \
"linux/amd64") echo x86_64-unknown-linux-gnu > /rust_target.txt ;; \
Expand Down Expand Up @@ -53,11 +53,11 @@ RUN chown -Rf "${UID}":"${UID}" /myapp
# Stage 2 : Frontend build #
############################

FROM --platform=$BUILDPLATFORM ghcr.io/cirruslabs/flutter:3.24.3 AS frontend-builder
FROM --platform=$BUILDPLATFORM ghcr.io/cirruslabs/flutter:3.27.2 AS frontend-builder
WORKDIR /build
COPY ./frontend .
RUN flutter pub get
RUN flutter build web --csp --web-renderer html
RUN flutter build web

#########################
# Stage 3 : Final image #
Expand Down
34 changes: 17 additions & 17 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ path = "src/main.rs"
name = "atrium"

[dependencies]
anyhow = { default-features = false, version = "1.0.94" }
anyhow = { default-features = false, version = "1.0.95" }
argon2 = { features = ["alloc", "password-hash"], default-features = false, version = "0.5.3" }
async_zip = { features = ["deflate", "tokio"], default-features = false, version = "0.0.17" }
async-stream = "0.3.6"
async-walkdir = "2.0.0"
axum = { version = "0.7.9", features = ["http2", "json", "query", "tokio"], default-features = false }
axum-extra = { version = "0.9.6", features = ["cookie-private", "typed-header"], default-features = false }
axum = { version = "0.8.1", features = ["http2", "json", "query", "tokio"], default-features = false }
axum-extra = { version = "0.10.0", features = ["cookie-private", "typed-header"], default-features = false }
axum-server = "0.7.1"
base64ct = { version = "1.6.0", features = ["alloc"] }
chacha20poly1305 = { version = "0.10.1", features = ["stream"], default-features = false }
Expand All @@ -29,48 +29,48 @@ futures-util = { default-features = false, version = "0.3.31" }
headers = "0.4.0"
http = "1.2.0"
http-body-util = "0.1.2"
hyper = { version = "1.5.1", default-features = false }
hyper = { version = "1.5.2", default-features = false }
hyper-util = { version = "0.1.10", features = ["client-legacy", "http1", "tokio"], default-features = false }
hyper-rustls = { version = "0.27.3", features = ["http1", "http2", "ring", "tls12", "webpki-tokio"], default-features = false }
hyper-rustls = { version = "0.27.5", features = ["http1", "http2", "ring", "tls12", "webpki-tokio"], default-features = false }
hyper-hickory = { version = "0.7.0", default-features = false, features = ["system-config"] }
jsonwebtoken = { version = "9.3.0", default-features = false }
maxminddb = "0.24.0"
mime_guess = { default-features = false, version = "2.0.5" }
# TEMPORARY
oauth2 = { version = "5.0.0-rc.1", default-features = false }
percent-encoding = { default-features = false, version = "2.3.1" }
quick-xml = "0.37.1"
quick-xml = "0.37.2"
rand = { default-features = false, version = "0.8.5" }
rcgen = { version = "0.13.1", default-features = false, optional = true }
rustls = { default-features = false, version = "0.23.19", features = ["ring"] }
rustls-pki-types = { version = "1.10.0" }
rcgen = { version = "0.13.2", default-features = false, optional = true }
rustls = { default-features = false, version = "0.23.21", features = ["ring"] }
rustls-pki-types = { version = "1.10.1" }
rustls-acme = { version = "0.12.1", features = ["axum", "ring"], default-features = false }
serde = { version = "1.0.215", default-features = false }
serde_json = { default-features = false, version = "1.0.133" }
serde = { version = "1.0.217", default-features = false }
serde_json = { default-features = false, version = "1.0.135" }
serde_yml = "0.0.12"
sha2 = { default-features = false, version = "0.10.8" }
sysinfo = { default-features = false, version = "0.33.0", features = ["disk", "system"] }
sysinfo = { default-features = false, version = "0.33.1", features = ["disk", "system"] }
time = { default-features = false, version = "0.3.37" }
tokio = { version = "1.42.0", features = ["full"], default-features = false }
tokio = { version = "1.43.0", features = ["full"], default-features = false }
tokio-stream = { version = "0.1.17", default-features = false }
tokio-util = { version = "0.7.13", default-features = false }
tower = { default-features = false, version = "0.5.1", features = ["util"] }
tower = { default-features = false, version = "0.5.2", features = ["util"] }
tower-http = { version = "0.6.2", features = ["fs"], default-features = false }
tower-service = "0.3.3"
tracing = { default-features = false, version = "0.1.41" }
tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.19", features = ["ansi", "env-filter", "local-time"], default-features = false }
trim-in-place = "0.1.7"
urlencoding = "2.1.3"
uuid = { version = "1.11.0", features = ["fast-rng", "v4"], default-features = false }
uuid = { version = "1.12.0", features = ["fast-rng", "v4"], default-features = false }

[features]
default = ["self_signed"]
self_signed = ["dep:rcgen"]

[dev-dependencies]
async-tungstenite = { version = "0.28.1", features = ["tokio-runtime"] }
reqwest = { version = "0.12.9", default-features = false, features = ["cookies", "json", "rustls-tls", "stream"] }
async-tungstenite = { version = "0.28.2", features = ["tokio-runtime"] }
reqwest = { version = "0.12.12", default-features = false, features = ["cookies", "json", "rustls-tls", "stream"] }
tungstenite = "0.24.0"

[profile.release_optimized]
Expand Down
3 changes: 2 additions & 1 deletion backend/src/apps/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use axum::{
body::Body,
extract::{ConnectInfo, Host, Path, State},
extract::{ConnectInfo, Path, State},
http::{
uri::{Authority, Scheme},
Response,
},
response::IntoResponse,
Json,
};
use axum_extra::extract::Host;
use base64ct::Encoding;
use headers::HeaderValue;
use http::{
Expand Down
29 changes: 22 additions & 7 deletions backend/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ use crate::{
utils::{is_default, option_string_trim, string_trim},
};
use anyhow::Result;
use axum::{
async_trait,
extract::{FromRef, FromRequestParts},
};
use axum::extract::{FromRef, FromRequestParts, OptionalFromRequestParts};
use http::request::Parts;
use hyper::StatusCode;
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, sync::Arc};
use std::{collections::HashMap, convert::Infallible, sync::Arc};

fn http_port() -> u16 {
8080
Expand Down Expand Up @@ -351,7 +348,6 @@ impl HostType {
}
}

#[async_trait]
impl<S> FromRequestParts<S> for HostType
where
S: Send + Sync,
Expand All @@ -362,7 +358,7 @@ where
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
let configmap = ConfigMap::from_ref(state);

let host = axum::extract::Host::from_request_parts(parts, state)
let host = axum_extra::extract::Host::from_request_parts(parts, state)
.await
.map_err(|_| StatusCode::NOT_FOUND)?;

Expand All @@ -379,6 +375,25 @@ where
}
}

impl<S> OptionalFromRequestParts<S> for HostType
where
S: Send + Sync,
ConfigMap: FromRef<S>,
{
type Rejection = Infallible;

async fn from_request_parts(
parts: &mut Parts,
state: &S,
) -> Result<Option<Self>, Self::Rejection> {
Ok(
<HostType as FromRequestParts<S>>::from_request_parts(parts, state)
.await
.ok(),
)
}
}

#[cfg(test)]
mod tests {
use std::fs;
Expand Down
6 changes: 4 additions & 2 deletions backend/src/davs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ use crate::{
};
use axum::{
body::Body,
extract::{ConnectInfo, Host},
extract::ConnectInfo,
http::{Request, Response},
};
use axum_extra::extract::Host;
use http::Method;
use hyper::StatusCode;
use std::{net::SocketAddr, sync::LazyLock};
Expand Down Expand Up @@ -45,7 +46,8 @@ pub async fn webdav_handler(
let query_str = req.uri().query().unwrap_or_default().to_owned();
let dav_host_str = dav.host().to_owned();
let user_str = user
.as_ref().map_or_else(|| "unknown user".to_owned(), |u| u.login.clone());
.as_ref()
.map_or_else(|| "unknown user".to_owned(), |u| u.login.clone());

let domain = hostname.split(':').next().unwrap_or_default();

Expand Down
3 changes: 2 additions & 1 deletion backend/src/dir_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ use crate::{
};
use axum::{
body::Body,
extract::{Host, State},
extract::State,
http::{Request, Response, StatusCode},
response::IntoResponse,
};
use axum_extra::extract::Host;
use tower::util::ServiceExt;
use tower_http::services::ServeDir;

Expand Down
12 changes: 4 additions & 8 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use atrium::{
mocks::{mock_oauth2_server, mock_proxied_server},
server::Server,
};
use axum::{extract::Host, handler::HandlerWithoutStateExt, response::Redirect, BoxError};
use axum::{handler::HandlerWithoutStateExt, response::Redirect, BoxError};
use axum_extra::extract::Host;
use axum_server::Handle;
use http::{StatusCode, Uri};
use rustls::ServerConfig;
Expand Down Expand Up @@ -145,13 +146,8 @@ async fn run() -> Result<()> {
}
#[cfg(feature = "self_signed")]
TlsMode::SelfSigned => {
self_signed::serve_with_self_signed_cert(
ip_bind,
&server.port,
handle,
app,
)
.await?;
self_signed::serve_with_self_signed_cert(ip_bind, &server.port, handle, app)
.await?;
}
_ => {
let addr = format!("{ip_bind}:{}", server.port).parse::<std::net::SocketAddr>()?;
Expand Down
3 changes: 2 additions & 1 deletion backend/src/mocks.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::middlewares::debug_cors_middleware;
use axum::{
extract::{Host, Query},
extract::Query,
middleware,
response::{Html, IntoResponse, Redirect},
routing::{get, post},
Extension, Router,
};
use axum_extra::extract::Host;
use http::{header, HeaderMap, HeaderValue, StatusCode};
use serde::Deserialize;
use tokio::net::TcpListener;
Expand Down
7 changes: 5 additions & 2 deletions backend/src/oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ use crate::{
use anyhow::Result;
use axum::{
body::Body,
extract::{ConnectInfo, Host, Query, State},
extract::{ConnectInfo, Query, State},
response::{IntoResponse, Redirect},
};
use axum_extra::extract::cookie::{Cookie, CookieJar, PrivateCookieJar};
use axum_extra::extract::{
cookie::{Cookie, CookieJar, PrivateCookieJar},
Host,
};
use http::{header::AUTHORIZATION, HeaderValue, Request, StatusCode, Uri};
use http_body_util::BodyExt;
use hyper::body::Buf;
Expand Down
6 changes: 3 additions & 3 deletions backend/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ impl Server {

let admin_router = Router::new()
.route("/api/admin/users", get(get_users).post(add_user))
.route("/api/admin/users/:user_login", delete(delete_user))
.route("/api/admin/users/{user_login}", delete(delete_user))
.route("/api/admin/apps", get(get_apps).post(add_app))
.route("/api/admin/apps/:app_id", delete(delete_app))
.route("/api/admin/apps/{app_id}", delete(delete_app))
.route("/api/admin/davs", get(get_davs).post(add_dav))
.route("/api/admin/davs/:dav_id", delete(delete_dav));
.route("/api/admin/davs/{dav_id}", delete(delete_dav));

let main_router = Router::new()
.route(
Expand Down
Loading

0 comments on commit 8b9c8ea

Please sign in to comment.