Move config parser to mitra-config crate

This commit is contained in:
silverpill 2023-02-18 23:52:48 +00:00
parent 7d3c558ede
commit 10f2596830
82 changed files with 177 additions and 87 deletions

19
Cargo.lock generated
View file

@ -1709,12 +1709,12 @@ dependencies = [
"chrono",
"deadpool",
"deadpool-postgres",
"dotenv",
"ed25519",
"ed25519-dalek",
"env_logger",
"hex",
"log",
"mitra-config",
"mitra-utils",
"monero-rpc",
"num_cpus",
@ -1729,7 +1729,6 @@ dependencies = [
"secp256k1",
"serde",
"serde_json",
"serde_yaml",
"serial_test",
"sha2 0.9.9",
"siwe",
@ -1749,11 +1748,27 @@ dependencies = [
"clap",
"log",
"mitra",
"mitra-config",
"mitra-utils",
"tokio",
"uuid",
]
[[package]]
name = "mitra-config"
version = "1.13.1"
dependencies = [
"dotenv",
"log",
"mitra-utils",
"regex",
"rsa",
"serde",
"serde_yaml",
"thiserror",
"url 2.2.2",
]
[[package]]
name = "mitra-utils"
version = "1.13.1"

View file

@ -12,8 +12,9 @@ default-run = "mitra"
[workspace]
members = [
".",
"mitra-utils",
"mitra-cli",
"mitra-config",
"mitra-utils",
]
default-members = [
".",
@ -21,6 +22,7 @@ default-members = [
]
[dependencies]
mitra-config = { path = "mitra-config" }
mitra-utils = { path = "mitra-utils" }
# Used to handle incoming HTTP requests
@ -37,12 +39,10 @@ chrono = { version = "0.4.23", default-features = false, features = ["std", "ser
# Used for pooling database connections
deadpool = "0.9.2"
deadpool-postgres = { version = "0.10.2", default-features = false }
# Used to read .env files
dotenv = "0.15.0"
# Used to work with hexadecimal strings
hex = { version = "0.4.3", features = ["serde"] }
# Used for logging
log = { version = "0.4.14", features = ["serde"] }
log = "0.4.14"
env_logger = { version = "0.9.0", default-features = false }
# Used to verify minisign signatures
ed25519-dalek = "1.0.1"
@ -65,8 +65,6 @@ secp256k1 = { version = "0.21.3", features = ["rand", "rand-std"] }
# Used for serialization/deserialization
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.89"
# Used to parse config file
serde_yaml = "0.8.17"
# Used to calculate SHA2 hashes
sha2 = "0.9.5"
# Used to verify EIP-4361 signatures
@ -90,8 +88,9 @@ uuid = { version = "1.1.2", features = ["serde", "v4"] }
web3 = { version = "0.18.0", default-features = false, features = ["http", "http-tls", "signing"] }
[dev-dependencies]
mitra-config = { path = "mitra-config", features = ["test-utils"] }
mitra-utils = { path = "mitra-utils", features = ["test-utils"] }
serial_test = "0.7.0"
[features]
production = []
production = ["mitra-config/production"]

View file

@ -10,6 +10,7 @@ name = "mitractl"
path = "src/main.rs"
[dependencies]
mitra-config = { path = "../mitra-config" }
mitra-utils = { path = "../mitra-utils" }
mitra = { path = ".." }

View file

@ -8,7 +8,6 @@ use mitra::activitypub::{
builders::delete_person::prepare_delete_person,
fetcher::fetchers::fetch_actor,
};
use mitra::config::Config;
use mitra::database::DatabaseClient;
use mitra::ethereum::{
signatures::generate_ecdsa_key,
@ -48,6 +47,7 @@ use mitra::monero::{
helpers::check_expired_invoice,
wallet::create_monero_wallet,
};
use mitra_config::Config;
use mitra_utils::{
crypto_rsa::{
generate_rsa_key,

View file

@ -1,9 +1,9 @@
use clap::Parser;
use mitra::config::parse_config;
use mitra::database::create_database_client;
use mitra::database::migrate::apply_migrations;
use mitra::logger::configure_logger;
use mitra_config::parse_config;
mod cli;
use cli::{Opts, SubCommand};

30
mitra-config/Cargo.toml Normal file
View file

@ -0,0 +1,30 @@
[package]
name = "mitra-config"
version = "1.13.1"
license = "AGPL-3.0"
edition = "2021"
rust-version = "1.56"
[dependencies]
mitra-utils = { path = "../mitra-utils" }
# Used to read .env files
dotenv = "0.15.0"
# Used for logging
log = { version = "0.4.14", features = ["serde"] }
# Used for working with regular expressions
regex = "1.6.0"
# Used for working with RSA keys
rsa = "0.5.0"
# Used for serialization/deserialization
serde = { version = "1.0.136", features = ["derive"] }
# Used to parse config file
serde_yaml = "0.8.17"
# Used for creating error types
thiserror = "1.0.37"
# Used to work with URLs
url = "2.2.2"
[features]
production = []
test-utils = []

View file

@ -185,7 +185,7 @@ impl Instance {
}
}
#[cfg(test)]
#[cfg(feature = "test-utils")]
impl Instance {
pub fn for_test(url: &str) -> Self {
use mitra_utils::crypto_rsa::generate_weak_rsa_key;

View file

@ -1,8 +1,8 @@
mod blockchain;
mod config;
mod environment;
mod limits;
mod loader;
mod main;
mod retention;
pub use blockchain::{
@ -10,9 +10,9 @@ pub use blockchain::{
EthereumConfig,
MoneroConfig,
};
pub use config::{Config, Instance, RegistrationType};
pub use environment::Environment;
pub use loader::parse_config;
pub use main::{Config, Instance, RegistrationType};
pub const MITRA_VERSION: &str = env!("CARGO_PKG_VERSION");

View file

@ -13,8 +13,8 @@ use mitra_utils::{
files::{set_file_permissions, write_file},
};
use super::config::{Config, RegistrationType};
use super::environment::Environment;
use super::main::{Config, RegistrationType};
struct EnvConfig {
config_path: String,

View file

@ -2,12 +2,13 @@ use std::path::Path;
use serde_json::{Value as JsonValue};
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
fetcher::fetchers::fetch_file,
receiver::{parse_property_value, HandlerError},
};
use crate::config::Instance;
use crate::database::DatabaseClient;
use crate::models::{
profiles::queries::{create_profile, update_profile},

View file

@ -6,6 +6,7 @@ use serde::{
};
use serde_json::{json, Value};
use mitra_config::Instance;
use mitra_utils::{
crypto_rsa::{deserialize_private_key, get_public_key_pem},
urls::get_hostname,
@ -25,7 +26,6 @@ use crate::activitypub::{
receiver::parse_property_value,
vocabulary::{IDENTITY_PROOF, IMAGE, LINK, PERSON, PROPERTY_VALUE, SERVICE},
};
use crate::config::Instance;
use crate::errors::ValidationError;
use crate::media::get_file_url;
use crate::models::{

View file

@ -1,9 +1,9 @@
use actix_web::HttpRequest;
use serde_json::Value;
use mitra_config::Config;
use mitra_utils::crypto_rsa::deserialize_public_key;
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::http_signatures::verify::{
parse_http_signature,

View file

@ -1,5 +1,6 @@
use serde::Serialize;
use mitra_config::Instance;
use mitra_utils::id::generate_ulid;
use crate::activitypub::{
@ -9,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::ACCEPT,
};
use crate::config::Instance;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,

View file

@ -1,5 +1,6 @@
use serde::Serialize;
use mitra_config::Instance;
use mitra_utils::id::generate_ulid;
use crate::activitypub::{
@ -9,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::{ADD, REMOVE},
};
use crate::config::Instance;
use crate::models::users::types::User;
#[derive(Serialize)]

View file

@ -1,6 +1,8 @@
use chrono::{DateTime, Utc};
use serde::Serialize;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
constants::AP_PUBLIC,
@ -9,7 +11,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::ANNOUNCE,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
posts::types::Post,

View file

@ -1,6 +1,8 @@
use chrono::{DateTime, Utc};
use serde::Serialize;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
constants::{AP_MEDIA_TYPE, AP_PUBLIC},
@ -24,7 +26,6 @@ use crate::activitypub::{
},
vocabulary::*,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::media::get_file_url;
use crate::models::{

View file

@ -1,12 +1,13 @@
use serde::Serialize;
use mitra_config::Instance;
use crate::activitypub::{
deliverer::OutgoingActivity,
identifiers::local_actor_id,
types::{build_default_context, Context},
vocabulary::{DELETE, NOTE, TOMBSTONE},
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
posts::helpers::add_related_posts,

View file

@ -1,6 +1,8 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
constants::AP_PUBLIC,
@ -8,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::DELETE,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
relationships::queries::{get_followers, get_following},

View file

@ -1,6 +1,8 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
deliverer::OutgoingActivity,
@ -8,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::FOLLOW,
};
use crate::config::Instance;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,

View file

@ -1,6 +1,8 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
constants::AP_PUBLIC,
@ -9,7 +11,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::LIKE,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
posts::types::{Post, Visibility},

View file

@ -1,6 +1,7 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use mitra_utils::id::generate_ulid;
use crate::activitypub::{
@ -10,7 +11,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::MOVE,
};
use crate::config::Instance;
use crate::models::users::types::User;
#[derive(Serialize)]

View file

@ -1,9 +1,10 @@
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
deliverer::OutgoingActivity,
identifiers::LocalActorCollection,
};
use crate::config::Instance;
use crate::models::users::types::User;
use super::add_person::prepare_update_collection;

View file

@ -1,6 +1,8 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
constants::AP_PUBLIC,
deliverer::OutgoingActivity,
@ -8,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::UNDO,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
posts::types::Post,

View file

@ -1,6 +1,8 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
actors::types::Actor,
deliverer::OutgoingActivity,
@ -8,7 +10,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::{FOLLOW, UNDO},
};
use crate::config::Instance;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,

View file

@ -1,13 +1,14 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::{
deliverer::OutgoingActivity,
identifiers::{local_actor_id, local_object_id},
types::{build_default_context, Context},
vocabulary::UNDO,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
posts::types::{Post, Visibility},

View file

@ -1,6 +1,7 @@
use serde::Serialize;
use uuid::Uuid;
use mitra_config::Instance;
use mitra_utils::id::generate_ulid;
use crate::activitypub::{
@ -11,7 +12,6 @@ use crate::activitypub::{
types::{build_default_context, Context},
vocabulary::UPDATE,
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError, DatabaseTypeError};
use crate::models::{
relationships::queries::get_followers,

View file

@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
use tokio::time::sleep;
use mitra_config::Instance;
use mitra_utils::crypto_rsa::deserialize_private_key;
use crate::config::Instance;
use crate::database::{
get_database_client,
DatabaseClient,

View file

@ -4,6 +4,7 @@ use std::time::Duration;
use reqwest::{Client, Method, Proxy, RequestBuilder};
use serde_json::Value;
use mitra_config::Instance;
use mitra_utils::{
files::sniff_media_type,
urls::guess_protocol,
@ -15,7 +16,6 @@ use crate::activitypub::{
identifiers::{local_actor_key_id, local_instance_actor_id},
types::Object,
};
use crate::config::Instance;
use crate::http_signatures::create::{
create_http_signature,
HttpSignatureError,

View file

@ -1,6 +1,8 @@
use std::collections::HashMap;
use std::path::Path;
use mitra_config::{Config, Instance};
use crate::activitypub::{
actors::helpers::{create_remote_profile, update_remote_profile},
handlers::create::handle_note,
@ -8,7 +10,6 @@ use crate::activitypub::{
receiver::HandlerError,
types::Object,
};
use crate::config::{Config, Instance};
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,12 +1,13 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
identifiers::parse_local_object_id,
receiver::deserialize_into_object_id,
vocabulary::FOLLOW,
};
use crate::config::Config;
use crate::database::DatabaseClient;
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,11 +1,12 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
identifiers::parse_local_actor_id,
vocabulary::PERSON,
};
use crate::config::Config;
use crate::database::DatabaseClient;
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,13 +1,14 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
fetcher::helpers::{get_or_import_profile_by_actor_id, import_post},
identifiers::parse_local_object_id,
receiver::deserialize_into_object_id,
vocabulary::{CREATE, DELETE, DISLIKE, LIKE, NOTE, UNDO, UPDATE},
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -4,6 +4,7 @@ use chrono::Utc;
use serde_json::{Value as JsonValue};
use uuid::Uuid;
use mitra_config::Config;
use mitra_utils::{
html::clean_html,
urls::get_hostname,
@ -22,7 +23,6 @@ use crate::activitypub::{
types::{Attachment, EmojiTag, Link, LinkTag, Object, Tag},
vocabulary::*,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,11 +1,12 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
receiver::deserialize_into_object_id,
vocabulary::{NOTE, PERSON},
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,6 +1,8 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
builders::accept_follow::prepare_accept_follow,
fetcher::helpers::get_or_import_profile_by_actor_id,
@ -8,7 +10,6 @@ use crate::activitypub::{
receiver::deserialize_into_object_id,
vocabulary::PERSON,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,12 +1,13 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
fetcher::helpers::get_or_import_profile_by_actor_id,
receiver::deserialize_into_object_id,
vocabulary::NOTE,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,6 +1,8 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
builders::{
follow::prepare_follow,
@ -11,7 +13,6 @@ use crate::activitypub::{
receiver::parse_array,
vocabulary::PERSON,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,12 +1,13 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
identifiers::parse_local_object_id,
receiver::deserialize_into_object_id,
vocabulary::FOLLOW,
};
use crate::config::Config;
use crate::database::DatabaseClient;
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,11 +1,12 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
identifiers::parse_local_actor_id,
vocabulary::PERSON,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -1,12 +1,13 @@
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
identifiers::parse_local_actor_id,
receiver::{deserialize_into_object_id, find_object_id},
vocabulary::{ANNOUNCE, FOLLOW, LIKE},
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -4,6 +4,8 @@ use chrono::Utc;
use serde::Deserialize;
use serde_json::Value;
use mitra_config::Config;
use crate::activitypub::{
actors::{
helpers::update_remote_profile,
@ -19,7 +21,6 @@ use crate::activitypub::{
types::Object,
vocabulary::{NOTE, PERSON},
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::{

View file

@ -3,7 +3,8 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
use uuid::Uuid;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{
get_database_client,
DatabaseClient,

View file

@ -7,7 +7,8 @@ use serde::{
};
use serde_json::Value;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::{
ConversionError,

View file

@ -14,7 +14,8 @@ use serde::Deserialize;
use tokio::sync::Mutex;
use uuid::Uuid;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::models::{

View file

@ -1,10 +1,10 @@
use mitra_config::Instance;
use mitra_utils::{
datetime::get_min_datetime,
html::{clean_html_all, escape_html},
};
use crate::activitypub::identifiers::{local_actor_id, local_object_id};
use crate::config::Instance;
use crate::models::{
posts::types::Post,
profiles::types::DbActorProfile,

View file

@ -1,6 +1,7 @@
use actix_web::{get, web, HttpResponse};
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::models::{

View file

@ -8,7 +8,8 @@ use web3::{
transports::Http,
};
use crate::config::EthereumConfig;
use mitra_config::EthereumConfig;
use super::api::connect;
use super::errors::EthereumError;
use super::sync::{

View file

@ -10,7 +10,8 @@ use web3::{
types::{BlockNumber, FilterBuilder},
};
use crate::config::EthereumConfig;
use mitra_config::EthereumConfig;
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::ipfs::utils::parse_ipfs_url;
use crate::models::posts::queries::{

View file

@ -9,6 +9,7 @@ use web3::{
types::{BlockId, BlockNumber, FilterBuilder, U256},
};
use mitra_config::{EthereumConfig, Instance};
use mitra_utils::{
caip2::ChainId,
currencies::Currency,
@ -21,7 +22,6 @@ use crate::activitypub::{
},
identifiers::LocalActorCollection,
};
use crate::config::{EthereumConfig, Instance};
use crate::database::{
get_database_client,
DatabaseClient,

View file

@ -5,13 +5,13 @@ use anyhow::Error;
use chrono::{DateTime, Utc};
use uuid::Uuid;
use mitra_config::Config;
use mitra_utils::datetime::days_before_now;
use crate::activitypub::queues::{
process_queued_incoming_activities,
process_queued_outgoing_activities,
};
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::ethereum::{
contracts::Blockchain,

View file

@ -4,10 +4,10 @@ use std::time::Duration;
use chrono::{DateTime, Utc};
use uuid::Uuid;
use crate::config::Config;
use mitra_config::Config;
use crate::database::DbPool;
use crate::ethereum::contracts::Blockchain;
use super::periodic_tasks::*;
#[derive(Debug, Eq, Hash, PartialEq)]

View file

@ -1,6 +1,5 @@
pub mod activitypub;
pub mod atom;
pub mod config;
pub mod database;
mod errors;
pub mod ethereum;

View file

@ -12,7 +12,6 @@ use tokio::sync::Mutex;
use mitra::activitypub::views as activitypub;
use mitra::atom::views as atom;
use mitra::config::{parse_config, Environment, MITRA_VERSION};
use mitra::database::{get_database_client, create_pool};
use mitra::database::migrate::apply_migrations;
use mitra::ethereum::contracts::get_contracts;
@ -38,6 +37,7 @@ use mitra::mastodon_api::UPLOAD_MAX_SIZE;
use mitra::nodeinfo::views as nodeinfo;
use mitra::webfinger::views as webfinger;
use mitra::web_client::views as web_client;
use mitra_config::{parse_config, Environment, MITRA_VERSION};
#[actix_web::main]
async fn main() -> std::io::Result<()> {

View file

@ -1,7 +1,8 @@
use uuid::Uuid;
use mitra_config::Instance;
use crate::activitypub::builders::follow::prepare_follow;
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
profiles::types::DbActorProfile,

View file

@ -5,6 +5,7 @@ use actix_web::{
use actix_web_httpauth::extractors::bearer::BearerAuth;
use uuid::Uuid;
use mitra_config::{Config, RegistrationType};
use mitra_utils::{
caip2::ChainId,
canonicalization::canonicalize_object,
@ -24,7 +25,6 @@ use crate::activitypub::builders::{
prepare_update_person,
},
};
use crate::config::{Config, RegistrationType};
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::{

View file

@ -1,6 +1,7 @@
use actix_web::{get, web, HttpResponse, Scope};
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::models::emojis::queries::get_local_emojis;

View file

@ -2,7 +2,8 @@
use actix_web::{get, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::{

View file

@ -1,14 +1,14 @@
use serde::Serialize;
use serde_json::{to_value, Value};
use mitra_utils::markdown::markdown_to_html;
use crate::config::{
use mitra_config::{
BlockchainConfig,
Config,
RegistrationType,
MITRA_VERSION,
};
use mitra_utils::markdown::markdown_to_html;
use crate::ethereum::contracts::ContractSet;
use crate::mastodon_api::{
MASTODON_API_VERSION,

View file

@ -1,6 +1,7 @@
use actix_web::{get, web, HttpResponse, Scope};
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::ethereum::contracts::ContractSet;

View file

@ -2,7 +2,8 @@
use actix_web::{post, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::{

View file

@ -6,7 +6,8 @@ use actix_web::{
};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::{

View file

@ -10,9 +10,9 @@ use actix_web::{
use actix_web_httpauth::extractors::bearer::BearerAuth;
use chrono::{Duration, Utc};
use mitra_config::Config;
use mitra_utils::passwords::verify_password;
use crate::config::Config;
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::{

View file

@ -3,6 +3,7 @@ use std::str::FromStr;
use regex::Regex;
use url::Url;
use mitra_config::Config;
use mitra_utils::currencies::Currency;
use crate::activitypub::{
@ -14,7 +15,6 @@ use crate::activitypub::{
identifiers::{parse_local_actor_id, parse_local_object_id},
HandlerError,
};
use crate::config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::ethereum::utils::validate_ethereum_address;

View file

@ -2,7 +2,8 @@
use actix_web::{get, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::{

View file

@ -1,10 +1,11 @@
use uuid::Uuid;
use mitra_config::Config;
use crate::activitypub::{
fetcher::helpers::get_or_import_profile_by_actor_address,
HandlerError,
};
use crate::config::Config;
use crate::database::{
get_database_client,
DatabaseClient,

View file

@ -1,6 +1,7 @@
use actix_web::{get, post, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use mitra_config::Config;
use mitra_utils::passwords::hash_password;
use crate::activitypub::{
@ -9,7 +10,6 @@ use crate::activitypub::{
undo_follow::prepare_undo_follow,
},
};
use crate::config::Config;
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::mastodon_api::{

View file

@ -1,6 +1,7 @@
use uuid::Uuid;
use crate::config::Instance;
use mitra_config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{
emojis::types::DbEmoji,

View file

@ -4,6 +4,7 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use chrono::Utc;
use uuid::Uuid;
use mitra_config::Config;
use mitra_utils::{
currencies::Currency,
markdown::markdown_lite_to_html,
@ -17,7 +18,6 @@ use crate::activitypub::builders::{
undo_announce::prepare_undo_announce,
undo_like::prepare_undo_like,
};
use crate::config::Config;
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::nft::create_mint_signature;

View file

@ -2,10 +2,10 @@ use actix_web::{get, post, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use uuid::Uuid;
use mitra_config::Config;
use mitra_utils::currencies::Currency;
use crate::activitypub::builders::update_person::prepare_update_person;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::{

View file

@ -2,7 +2,8 @@
use actix_web::{get, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::{

View file

@ -1,4 +1,5 @@
use crate::config::Config;
use mitra_config::Config;
use crate::database::{DatabaseClient, DatabaseError};
use crate::ipfs::store as ipfs_store;
use crate::media::remove_files;

View file

@ -4,7 +4,8 @@ use monero_rpc::TransferType;
use monero_rpc::monero::Address;
use uuid::Uuid;
use crate::config::MoneroConfig;
use mitra_config::MoneroConfig;
use crate::database::DatabaseClient;
use crate::errors::ValidationError;
use crate::models::{

View file

@ -4,7 +4,8 @@ use chrono::{Duration, Utc};
use monero_rpc::TransferType;
use monero_rpc::monero::{Address, Amount};
use crate::config::{Instance, MoneroConfig};
use mitra_config::{Instance, MoneroConfig};
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::ethereum::subscriptions::send_subscription_notifications;
use crate::models::{

View file

@ -13,7 +13,8 @@ use monero_rpc::monero::{
Amount,
};
use crate::config::MoneroConfig;
use mitra_config::MoneroConfig;
use crate::database::DatabaseError;
pub const DEFAULT_ACCOUNT: u32 = 0;

View file

@ -2,7 +2,7 @@
use serde::Serialize;
use crate::config::{Config, RegistrationType, MITRA_VERSION};
use mitra_config::{Config, RegistrationType, MITRA_VERSION};
#[derive(Serialize)]
struct Software {

View file

@ -2,7 +2,8 @@
use actix_web::{get, web, HttpResponse};
use crate::config::Config;
use mitra_config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::webfinger::types::{

View file

@ -11,11 +11,12 @@ use actix_web::{
};
use uuid::Uuid;
use mitra_config::Config;
use crate::activitypub::{
identifiers::{local_actor_id, local_object_id},
views::is_activitypub_request,
};
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::models::users::queries::get_user_by_id;

View file

@ -1,5 +1,7 @@
use actix_web::{get, web, HttpResponse};
use mitra_config::{Config, Instance};
use crate::activitypub::{
constants::AP_MEDIA_TYPE,
identifiers::{
@ -8,7 +10,6 @@ use crate::activitypub::{
parse_local_actor_id,
},
};
use crate::config::{Config, Instance};
use crate::database::{get_database_client, DatabaseClient, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::models::users::queries::is_registered_user;