mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
run clippy fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
fn default_true() -> bool {
|
||||
const fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
@@ -106,11 +106,11 @@ pub fn frontend_router<AP: AuthenticationProvider, CS: CalendarStore, AS: Addres
|
||||
|
||||
router = router
|
||||
.layer(AuthenticationLayer::new(auth_provider.clone()))
|
||||
.layer(Extension(auth_provider.clone()))
|
||||
.layer(Extension(cal_store.clone()))
|
||||
.layer(Extension(addr_store.clone()))
|
||||
.layer(Extension(frontend_config.clone()))
|
||||
.layer(Extension(oidc_config.clone()));
|
||||
.layer(Extension(auth_provider))
|
||||
.layer(Extension(cal_store))
|
||||
.layer(Extension(addr_store))
|
||||
.layer(Extension(frontend_config))
|
||||
.layer(Extension(oidc_config));
|
||||
|
||||
Router::new()
|
||||
.nest(prefix, router)
|
||||
|
||||
@@ -58,6 +58,6 @@ pub fn nextcloud_login_router<AP: AuthenticationProvider>(auth_provider: Arc<AP>
|
||||
.route("/", post(post_nextcloud_login))
|
||||
.layer(Extension(nextcloud_flows))
|
||||
.layer(Extension(auth_provider.clone()))
|
||||
.layer(AuthenticationLayer::new(auth_provider.clone()))
|
||||
.layer(AuthenticationLayer::new(auth_provider))
|
||||
.layer(middleware::from_fn(unauthorized_handler))
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use tracing::instrument;
|
||||
|
||||
pub(crate) async fn post_nextcloud_login(
|
||||
pub async fn post_nextcloud_login(
|
||||
Extension(state): Extension<Arc<NextcloudFlows>>,
|
||||
TypedHeader(user_agent): TypedHeader<UserAgent>,
|
||||
Host(host): Host,
|
||||
@@ -35,9 +35,9 @@ pub(crate) async fn post_nextcloud_login(
|
||||
flows.insert(
|
||||
flow_id.clone(),
|
||||
NextcloudFlow {
|
||||
app_name: app_name.to_owned(),
|
||||
app_name: app_name.clone(),
|
||||
created_at: Utc::now(),
|
||||
token: token.to_owned(),
|
||||
token: token.clone(),
|
||||
response: None,
|
||||
},
|
||||
);
|
||||
@@ -52,11 +52,11 @@ pub(crate) async fn post_nextcloud_login(
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub(crate) struct NextcloudPollForm {
|
||||
pub struct NextcloudPollForm {
|
||||
token: String,
|
||||
}
|
||||
|
||||
pub(crate) async fn post_nextcloud_poll<AP: AuthenticationProvider>(
|
||||
pub async fn post_nextcloud_poll<AP: AuthenticationProvider>(
|
||||
Extension(state): Extension<Arc<NextcloudFlows>>,
|
||||
Path(flow_id): Path<String>,
|
||||
Extension(auth_provider): Extension<Arc<AP>>,
|
||||
@@ -75,8 +75,8 @@ pub(crate) async fn post_nextcloud_poll<AP: AuthenticationProvider>(
|
||||
auth_provider
|
||||
.add_app_token(
|
||||
&response.login_name,
|
||||
flow.app_name.to_owned(),
|
||||
response.app_password.to_owned(),
|
||||
flow.app_name.clone(),
|
||||
response.app_password.clone(),
|
||||
)
|
||||
.await?;
|
||||
flows.remove(&flow_id);
|
||||
@@ -98,7 +98,7 @@ struct NextcloudLoginPage {
|
||||
}
|
||||
|
||||
#[instrument(skip(state))]
|
||||
pub(crate) async fn get_nextcloud_flow(
|
||||
pub async fn get_nextcloud_flow(
|
||||
Extension(state): Extension<Arc<NextcloudFlows>>,
|
||||
Path(flow_id): Path<String>,
|
||||
user: Principal,
|
||||
@@ -107,7 +107,7 @@ pub(crate) async fn get_nextcloud_flow(
|
||||
Ok(Html(
|
||||
NextcloudLoginPage {
|
||||
username: user.displayname.unwrap_or(user.id),
|
||||
app_name: flow.app_name.to_owned(),
|
||||
app_name: flow.app_name.clone(),
|
||||
}
|
||||
.render()
|
||||
.unwrap(),
|
||||
@@ -119,7 +119,7 @@ pub(crate) async fn get_nextcloud_flow(
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub(crate) struct NextcloudAuthorizeForm {
|
||||
pub struct NextcloudAuthorizeForm {
|
||||
app_name: String,
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ struct NextcloudLoginSuccessPage {
|
||||
}
|
||||
|
||||
#[instrument(skip(state))]
|
||||
pub(crate) async fn post_nextcloud_flow(
|
||||
pub async fn post_nextcloud_flow(
|
||||
user: Principal,
|
||||
Extension(state): Extension<Arc<NextcloudFlows>>,
|
||||
Path(flow_id): Path<String>,
|
||||
@@ -141,12 +141,12 @@ pub(crate) async fn post_nextcloud_flow(
|
||||
flow.app_name = form.app_name;
|
||||
flow.response = Some(NextcloudSuccessResponse {
|
||||
server: format!("https://{host}"),
|
||||
login_name: user.id.to_owned(),
|
||||
login_name: user.id.clone(),
|
||||
app_password: generate_app_token(),
|
||||
});
|
||||
Ok(Html(
|
||||
NextcloudLoginSuccessPage {
|
||||
app_name: flow.app_name.to_owned(),
|
||||
app_name: flow.app_name.clone(),
|
||||
}
|
||||
.render()
|
||||
.unwrap(),
|
||||
|
||||
@@ -40,7 +40,7 @@ pub struct AppleConfig {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub(crate) struct PostAppTokenForm {
|
||||
pub struct PostAppTokenForm {
|
||||
name: String,
|
||||
#[serde(default)]
|
||||
apple: bool,
|
||||
@@ -57,7 +57,7 @@ pub async fn route_post_app_token<AP: AuthenticationProvider>(
|
||||
assert_eq!(user_id, user.id);
|
||||
let token = generate_app_token();
|
||||
let mut token_id = auth_provider
|
||||
.add_app_token(&user.id, name.to_owned(), token.clone())
|
||||
.add_app_token(&user.id, name.clone(), token.clone())
|
||||
.await?;
|
||||
// Get first 4 characters of token identifier
|
||||
token_id.truncate(4);
|
||||
@@ -70,7 +70,7 @@ pub async fn route_post_app_token<AP: AuthenticationProvider>(
|
||||
hostname: hostname.clone(),
|
||||
caldav_principal_url: format!("https://{hostname}/caldav-compat/principal/{user_id}"),
|
||||
carddav_principal_url: format!("https://{hostname}/carddav/principal/{user_id}"),
|
||||
user: user.id.to_owned(),
|
||||
user: user.id.clone(),
|
||||
token,
|
||||
caldav_profile_uuid: Uuid::new_v4(),
|
||||
carddav_profile_uuid: Uuid::new_v4(),
|
||||
|
||||
Reference in New Issue
Block a user