Move nextcloud_login to frontend crate

This commit is contained in:
Lennart
2025-04-13 19:00:51 +02:00
parent a60d8deacc
commit 14e5533b6f
14 changed files with 18 additions and 75 deletions

22
Cargo.lock generated
View File

@@ -3012,7 +3012,6 @@ dependencies = [
"rustical_carddav",
"rustical_dav",
"rustical_frontend",
"rustical_nextcloud_login",
"rustical_store",
"rustical_store_sqlite",
"serde",
@@ -3105,30 +3104,13 @@ dependencies = [
"actix-web",
"askama",
"askama_web",
"futures-core",
"hex",
"mime_guess",
"openidconnect",
"reqwest",
"rust-embed",
"rustical_store",
"serde",
"thiserror 2.0.12",
"tokio",
]
[[package]]
name = "rustical_nextcloud_login"
version = "0.1.0"
dependencies = [
"actix-session",
"actix-web",
"askama",
"chrono",
"futures-core",
"hex",
"mime_guess",
"openidconnect",
"rand 0.8.5",
"reqwest",
"rust-embed",
"rustical_store",
"serde",

View File

@@ -94,7 +94,6 @@ rustical_caldav = { path = "./crates/caldav/" }
rustical_carddav = { path = "./crates/carddav/" }
rustical_frontend = { path = "./crates/frontend/" }
rustical_xml = { path = "./crates/xml/" }
rustical_nextcloud_login = { path = "./crates/nextcloud_login/" }
chrono-tz = "0.10"
rand = "0.8"
argon2 = "0.5"
@@ -152,5 +151,4 @@ pbkdf2.workspace = true
password-hash.workspace = true
reqwest.workspace = true
rustical_dav.workspace = true
rustical_nextcloud_login.workspace = true
quick-xml.workspace = true

View File

@@ -21,3 +21,6 @@ futures-core.workspace = true
hex.workspace = true
mime_guess.workspace = true
reqwest.workspace = true
rand.workspace = true
chrono.workspace = true
uuid.workspace = true

View File

@@ -17,6 +17,6 @@
{% if let Some(OidcProviderData {name, redirect_url}) = oidc_data %}
<a href="{{ redirect_url }}">Login with {{ name }}</a>
{% endif %}
{% endblock %}
</div>
{% endblock %}

View File

@@ -26,6 +26,7 @@ use std::sync::Arc;
mod assets;
mod config;
pub mod nextcloud_login;
mod oidc;
mod routes;

View File

@@ -1,11 +1,11 @@
use actix_web::{
HttpRequest, HttpResponse, Responder,
http::header::{self},
web::{self, Data, Form, Html, Json, Path, ServiceConfig},
HttpRequest, HttpResponse, Responder,
};
use askama::Template;
use chrono::{DateTime, Duration, Utc};
use rand::{distributions::Alphanumeric, Rng};
use rand::{Rng, distributions::Alphanumeric};
use rustical_store::auth::{AuthenticationMiddleware, AuthenticationProvider, User};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, sync::Arc};
@@ -141,7 +141,7 @@ fn generate_app_token() -> String {
}
#[derive(Template)]
#[template(path = "pages/nextcloud_login_form.html")]
#[template(path = "pages/nextcloud_login/form.html")]
struct NextcloudLoginPage {
username: String,
app_name: String,
@@ -176,7 +176,7 @@ struct NextcloudAuthorizeForm {
}
#[derive(Template)]
#[template(path = "pages/nextcloud_login_success.html")]
#[template(path = "pages/nextcloud_login/success.html")]
struct NextcloudLoginSuccessPage {
app_name: String,
}

View File

@@ -1,23 +0,0 @@
[package]
name = "rustical_nextcloud_login"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
publish = false
[dependencies]
askama.workspace = true
actix-session = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
actix-web = { workspace = true }
rustical_store = { workspace = true }
rust-embed.workspace = true
futures-core.workspace = true
hex.workspace = true
mime_guess.workspace = true
rand.workspace = true
uuid.workspace = true
chrono.workspace = true

View File

@@ -1,2 +0,0 @@
[general]
dirs = ["public/templates"]

View File

@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}RustiCal{% endblock %}</title>
{% block imports %}{% endblock %}
</head>
<body>
<div id="app">
{% block content %}<p>Placeholder</p>{% endblock %}
</div>
</body>
</html>

View File

@@ -1,4 +1,4 @@
use super::{AuthenticationProvider, User};
use super::AuthenticationProvider;
use actix_session::Session;
use actix_web::{
FromRequest, HttpMessage,

View File

@@ -1,11 +1,11 @@
use actix_web::body::MessageBody;
use actix_web::dev::{ServiceFactory, ServiceRequest, ServiceResponse};
use actix_web::middleware::NormalizePath;
use actix_web::{web, App};
use actix_web::{App, web};
use rustical_caldav::caldav_service;
use rustical_carddav::carddav_service;
use rustical_frontend::{configure_frontend, FrontendConfig};
use rustical_nextcloud_login::{configure_nextcloud_login, NextcloudFlows};
use rustical_frontend::nextcloud_login::{NextcloudFlows, configure_nextcloud_login};
use rustical_frontend::{FrontendConfig, configure_frontend};
use rustical_store::auth::AuthenticationProvider;
use rustical_store::{AddressbookStore, CalendarStore, SubscriptionStore};
use std::sync::Arc;

View File

@@ -9,7 +9,7 @@ use config::{DataStoreConfig, SqliteDataStoreConfig};
use figment::Figment;
use figment::providers::{Env, Format, Toml};
use rustical_dav::push::push_notifier;
use rustical_nextcloud_login::NextcloudFlows;
use rustical_frontend::nextcloud_login::NextcloudFlows;
use rustical_store::auth::TomlPrincipalStore;
use rustical_store::{AddressbookStore, CalendarStore, CollectionOperation, SubscriptionStore};
use rustical_store_sqlite::addressbook_store::SqliteAddressbookStore;
@@ -131,7 +131,7 @@ mod tests {
use anyhow::anyhow;
use async_trait::async_trait;
use rustical_frontend::FrontendConfig;
use rustical_nextcloud_login::NextcloudFlows;
use rustical_frontend::nextcloud_login::NextcloudFlows;
use rustical_store::auth::AuthenticationProvider;
use std::sync::Arc;