2 Commits

Author SHA1 Message Date
88e1bd7aee Update Rust crate clap to 4.5.60
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-20 00:15:58 +00:00
894dbe033c Updated project dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-19 17:57:27 +01:00
5 changed files with 676 additions and 531 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,27 +4,26 @@ version = "0.1.0"
edition = "2024"
[dependencies]
env_logger = "0.11.8"
env_logger = "0.11.9"
log = "0.4.29"
clap = { version = "4.5.59", features = ["derive", "env"] }
lazy_static = "1.5.0"
clap = { version = "4.5.60", features = ["derive", "env"] }
anyhow = "1.0.101"
serde = { version = "1.0.228", features = ["derive"] }
tokio = { version = "1.48.0", features = ["full"] }
actix-web = "4.12.1"
tokio = { version = "1.49.0", features = ["full"] }
actix-web = "4.13.0"
actix-session = { version = "0.11.0", features = ["redis-session"] }
actix-remote-ip = "0.1.0"
actix-cors = "0.7.1"
light-openid = "1.1.0"
bytes = "1.11.1"
sha2 = "0.10.9"
base16ct = { version = "0.3.0", features = ["alloc"] }
futures-util = "0.3.31"
sha2 = "0.11.0-rc.5"
base16ct = { version = "1.0.0", features = ["alloc"] }
futures-util = "0.3.32"
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
thiserror = "2.0.18"
uuid = { version = "1.19.0", features = ["v4", "serde"] }
uuid = { version = "1.21.0", features = ["v4", "serde"] }
ipnet = { version = "2.11.0", features = ["serde"] }
rand = "0.9.2"
rand = "0.10.0"
hex = "0.4.3"
mailchecker = "6.0.19"
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
@@ -32,7 +31,7 @@ matrix-sdk-ui = "0.16.0"
url = "2.5.8"
ractor = "0.15.10"
serde_json = "1.0.149"
lazy-regex = "3.5.1"
lazy-regex = "3.6.0"
actix-ws = "0.3.1"
infer = "0.19.0"
rust-embed = "8.11.0"

View File

@@ -5,6 +5,7 @@ use matrix_sdk::authentication::oauth::registration::{
ApplicationType, ClientMetadata, Localized, OAuthGrantType,
};
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
use url::Url;
/// Matrix gateway backend API
@@ -89,16 +90,12 @@ pub struct AppConfig {
storage_path: String,
}
lazy_static::lazy_static! {
static ref ARGS: AppConfig = {
AppConfig::parse()
};
}
static ARGS: OnceLock<AppConfig> = OnceLock::new();
impl AppConfig {
/// Get parsed command line arguments
pub fn get() -> &'static AppConfig {
&ARGS
ARGS.get_or_init(AppConfig::parse)
}
/// Get auto login email (if not empty)

View File

@@ -1,6 +1,6 @@
use crate::app_config::AppConfig;
use crate::broadcast_messages::BroadcastSender;
use crate::controllers::{HttpFailure, HttpResult};
use crate::controllers::HttpResult;
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
use crate::extractors::session_extractor::MatrixGWSession;
@@ -63,9 +63,7 @@ pub async fn finish_oidc(
let prov = AppConfig::get().openid_provider();
let conf = OpenIDConfig::load_from_url(prov.configuration_url)
.await
.map_err(HttpFailure::OpenID)?;
let conf = OpenIDConfig::load_from_url(prov.configuration_url).await?;
let (token, _) = conf
.request_token(
@@ -74,12 +72,8 @@ pub async fn finish_oidc(
&req.code,
&AppConfig::get().openid_provider().redirect_url,
)
.await
.map_err(HttpFailure::OpenID)?;
let (user_info, _) = conf
.request_user_info(&token)
.await
.map_err(HttpFailure::OpenID)?;
.await?;
let (user_info, _) = conf.request_user_info(&token).await?;
if user_info.email_verified != Some(true) {
log::error!("Email is not verified!");

View File

@@ -1,6 +1,6 @@
use actix_web::http::StatusCode;
use actix_web::{HttpResponse, ResponseError};
use std::error::Error;
use light_openid::errors::OpenIdError;
pub mod auth_controller;
pub mod matrix;
@@ -18,7 +18,7 @@ pub enum HttpFailure {
#[error("this resource was not found")]
NotFound,
#[error("an unspecified open id error occurred: {0}")]
OpenID(Box<dyn Error>),
OpenID(#[from] OpenIdError),
#[error("an unspecified internal error occurred: {0}")]
InternalError(#[from] anyhow::Error),
#[error("Actix web error: {0}")]