Compare commits
2 Commits
9c54433ada
...
23cfda38c6
| Author | SHA1 | Date | |
|---|---|---|---|
| 23cfda38c6 | |||
| 894dbe033c |
1163
matrixgw_backend/Cargo.lock
generated
1163
matrixgw_backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -4,27 +4,26 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.11.8"
|
env_logger = "0.11.9"
|
||||||
log = "0.4.29"
|
log = "0.4.29"
|
||||||
clap = { version = "4.5.57", features = ["derive", "env"] }
|
clap = { version = "4.5.59", features = ["derive", "env"] }
|
||||||
lazy_static = "1.5.0"
|
|
||||||
anyhow = "1.0.101"
|
anyhow = "1.0.101"
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
tokio = { version = "1.48.0", features = ["full"] }
|
tokio = { version = "1.49.0", features = ["full"] }
|
||||||
actix-web = "4.12.1"
|
actix-web = "4.13.0"
|
||||||
actix-session = { version = "0.11.0", features = ["redis-session"] }
|
actix-session = { version = "0.11.0", features = ["redis-session"] }
|
||||||
actix-remote-ip = "0.1.0"
|
actix-remote-ip = "0.1.0"
|
||||||
actix-cors = "0.7.1"
|
actix-cors = "0.7.1"
|
||||||
light-openid = "1.1.0"
|
light-openid = "1.1.0"
|
||||||
bytes = "1.11.1"
|
bytes = "1.11.1"
|
||||||
sha2 = "0.10.9"
|
sha2 = "0.11.0-rc.5"
|
||||||
base16ct = { version = "0.3.0", features = ["alloc"] }
|
base16ct = { version = "1.0.0", features = ["alloc"] }
|
||||||
futures-util = "0.3.31"
|
futures-util = "0.3.32"
|
||||||
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
|
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
|
||||||
thiserror = "2.0.18"
|
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"] }
|
ipnet = { version = "2.11.0", features = ["serde"] }
|
||||||
rand = "0.9.2"
|
rand = "0.10.0"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
mailchecker = "6.0.19"
|
mailchecker = "6.0.19"
|
||||||
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
|
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
|
||||||
@@ -32,7 +31,7 @@ matrix-sdk-ui = "0.16.0"
|
|||||||
url = "2.5.8"
|
url = "2.5.8"
|
||||||
ractor = "0.15.10"
|
ractor = "0.15.10"
|
||||||
serde_json = "1.0.149"
|
serde_json = "1.0.149"
|
||||||
lazy-regex = "3.5.1"
|
lazy-regex = "3.6.0"
|
||||||
actix-ws = "0.3.1"
|
actix-ws = "0.3.1"
|
||||||
infer = "0.19.0"
|
infer = "0.19.0"
|
||||||
rust-embed = "8.11.0"
|
rust-embed = "8.11.0"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use matrix_sdk::authentication::oauth::registration::{
|
|||||||
ApplicationType, ClientMetadata, Localized, OAuthGrantType,
|
ApplicationType, ClientMetadata, Localized, OAuthGrantType,
|
||||||
};
|
};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::OnceLock;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
/// Matrix gateway backend API
|
/// Matrix gateway backend API
|
||||||
@@ -89,16 +90,12 @@ pub struct AppConfig {
|
|||||||
storage_path: String,
|
storage_path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
static ARGS: OnceLock<AppConfig> = OnceLock::new();
|
||||||
static ref ARGS: AppConfig = {
|
|
||||||
AppConfig::parse()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AppConfig {
|
impl AppConfig {
|
||||||
/// Get parsed command line arguments
|
/// Get parsed command line arguments
|
||||||
pub fn get() -> &'static AppConfig {
|
pub fn get() -> &'static AppConfig {
|
||||||
&ARGS
|
ARGS.get_or_init(AppConfig::parse)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get auto login email (if not empty)
|
/// Get auto login email (if not empty)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::app_config::AppConfig;
|
use crate::app_config::AppConfig;
|
||||||
use crate::broadcast_messages::BroadcastSender;
|
use crate::broadcast_messages::BroadcastSender;
|
||||||
use crate::controllers::{HttpFailure, HttpResult};
|
use crate::controllers::HttpResult;
|
||||||
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
|
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
|
||||||
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
||||||
use crate::extractors::session_extractor::MatrixGWSession;
|
use crate::extractors::session_extractor::MatrixGWSession;
|
||||||
@@ -63,9 +63,7 @@ pub async fn finish_oidc(
|
|||||||
|
|
||||||
let prov = AppConfig::get().openid_provider();
|
let prov = AppConfig::get().openid_provider();
|
||||||
|
|
||||||
let conf = OpenIDConfig::load_from_url(prov.configuration_url)
|
let conf = OpenIDConfig::load_from_url(prov.configuration_url).await?;
|
||||||
.await
|
|
||||||
.map_err(HttpFailure::OpenID)?;
|
|
||||||
|
|
||||||
let (token, _) = conf
|
let (token, _) = conf
|
||||||
.request_token(
|
.request_token(
|
||||||
@@ -74,12 +72,8 @@ pub async fn finish_oidc(
|
|||||||
&req.code,
|
&req.code,
|
||||||
&AppConfig::get().openid_provider().redirect_url,
|
&AppConfig::get().openid_provider().redirect_url,
|
||||||
)
|
)
|
||||||
.await
|
.await?;
|
||||||
.map_err(HttpFailure::OpenID)?;
|
let (user_info, _) = conf.request_user_info(&token).await?;
|
||||||
let (user_info, _) = conf
|
|
||||||
.request_user_info(&token)
|
|
||||||
.await
|
|
||||||
.map_err(HttpFailure::OpenID)?;
|
|
||||||
|
|
||||||
if user_info.email_verified != Some(true) {
|
if user_info.email_verified != Some(true) {
|
||||||
log::error!("Email is not verified!");
|
log::error!("Email is not verified!");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use actix_web::http::StatusCode;
|
use actix_web::http::StatusCode;
|
||||||
use actix_web::{HttpResponse, ResponseError};
|
use actix_web::{HttpResponse, ResponseError};
|
||||||
use std::error::Error;
|
use light_openid::errors::OpenIdError;
|
||||||
|
|
||||||
pub mod auth_controller;
|
pub mod auth_controller;
|
||||||
pub mod matrix;
|
pub mod matrix;
|
||||||
@@ -18,7 +18,7 @@ pub enum HttpFailure {
|
|||||||
#[error("this resource was not found")]
|
#[error("this resource was not found")]
|
||||||
NotFound,
|
NotFound,
|
||||||
#[error("an unspecified open id error occurred: {0}")]
|
#[error("an unspecified open id error occurred: {0}")]
|
||||||
OpenID(Box<dyn Error>),
|
OpenID(#[from] OpenIdError),
|
||||||
#[error("an unspecified internal error occurred: {0}")]
|
#[error("an unspecified internal error occurred: {0}")]
|
||||||
InternalError(#[from] anyhow::Error),
|
InternalError(#[from] anyhow::Error),
|
||||||
#[error("Actix web error: {0}")]
|
#[error("Actix web error: {0}")]
|
||||||
|
|||||||
8
matrixgw_frontend/package-lock.json
generated
8
matrixgw_frontend/package-lock.json
generated
@@ -18,7 +18,7 @@
|
|||||||
"date-and-time": "^4.2.0",
|
"date-and-time": "^4.2.0",
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.19",
|
||||||
"emoji-picker-react": "^4.17.4",
|
"emoji-picker-react": "^4.17.4",
|
||||||
"is-cidr": "^6.0.2",
|
"is-cidr": "^6.0.3",
|
||||||
"qrcode.react": "^4.2.0",
|
"qrcode.react": "^4.2.0",
|
||||||
"react": "^19.2.4",
|
"react": "^19.2.4",
|
||||||
"react-dom": "^19.2.4",
|
"react-dom": "^19.2.4",
|
||||||
@@ -2705,9 +2705,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/is-cidr": {
|
"node_modules/is-cidr": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-6.0.3.tgz",
|
||||||
"integrity": "sha512-a4SY0KixgRXn67zSCooPNO4YRHZd1z6BIxrEBQUVNPteeajzrJLhZKnn81GVQO51uiCljTtGY+J3o6O3/DZpzg==",
|
"integrity": "sha512-tPdsizbDiISrc4PoII6ZfpmAokx0oDKeYqAUp5bXOfznauOFXfEeosKBRrl0o0SriE4xoRR05Czn4YPCFMjSHA==",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cidr-regex": "^5.0.1"
|
"cidr-regex": "^5.0.1"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"date-and-time": "^4.2.0",
|
"date-and-time": "^4.2.0",
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.19",
|
||||||
"emoji-picker-react": "^4.17.4",
|
"emoji-picker-react": "^4.17.4",
|
||||||
"is-cidr": "^6.0.2",
|
"is-cidr": "^6.0.3",
|
||||||
"qrcode.react": "^4.2.0",
|
"qrcode.react": "^4.2.0",
|
||||||
"react": "^19.2.4",
|
"react": "^19.2.4",
|
||||||
"react-dom": "^19.2.4",
|
"react-dom": "^19.2.4",
|
||||||
|
|||||||
Reference in New Issue
Block a user