diff --git a/crates/frontend/public/templates/pages/login.html b/crates/frontend/public/templates/pages/login.html index ff9739f..5c40e21 100644 --- a/crates/frontend/public/templates/pages/login.html +++ b/crates/frontend/public/templates/pages/login.html @@ -39,4 +39,5 @@ {% endif %} + {% endblock %} diff --git a/crates/frontend/public/templates/pages/user.html b/crates/frontend/public/templates/pages/user.html index c1e8765..6799119 100644 --- a/crates/frontend/public/templates/pages/user.html +++ b/crates/frontend/public/templates/pages/user.html @@ -54,6 +54,9 @@ + {% if let Some(hostname) = davx5_hostname %} + Configure in DAVx5 + {% endif %}
diff --git a/crates/frontend/src/routes/user.rs b/crates/frontend/src/routes/user.rs index f78c234..8c40b86 100644 --- a/crates/frontend/src/routes/user.rs +++ b/crates/frontend/src/routes/user.rs @@ -7,7 +7,7 @@ use axum::{ extract::Path, response::{IntoResponse, Redirect}, }; -use axum_extra::TypedHeader; +use axum_extra::{TypedHeader, extract::Host}; use headers::UserAgent; use http::StatusCode; use rustical_store::{ @@ -25,6 +25,7 @@ pub struct UserPage { pub addressbooks: Vec, pub deleted_addressbooks: Vec, pub is_apple: bool, + pub davx5_hostname: Option, } pub async fn route_user_named< @@ -37,6 +38,7 @@ pub async fn route_user_named< Extension(addr_store): Extension>, Extension(auth_provider): Extension>, TypedHeader(user_agent): TypedHeader, + Host(host): Host, user: User, ) -> impl IntoResponse { if user_id != user.id { @@ -64,6 +66,7 @@ pub async fn route_user_named< } let is_apple = user_agent.as_str().contains("Apple") || user_agent.as_str().contains("Mac OS"); + let davx5_hostname = user_agent.as_str().contains("Android").then_some(host); UserPage { app_tokens: auth_provider.get_app_tokens(&user.id).await.unwrap(), @@ -73,6 +76,7 @@ pub async fn route_user_named< deleted_addressbooks, user, is_apple, + davx5_hostname, } .into_response() }