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", "chrono",
"deadpool", "deadpool",
"deadpool-postgres", "deadpool-postgres",
"dotenv",
"ed25519", "ed25519",
"ed25519-dalek", "ed25519-dalek",
"env_logger", "env_logger",
"hex", "hex",
"log", "log",
"mitra-config",
"mitra-utils", "mitra-utils",
"monero-rpc", "monero-rpc",
"num_cpus", "num_cpus",
@ -1729,7 +1729,6 @@ dependencies = [
"secp256k1", "secp256k1",
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml",
"serial_test", "serial_test",
"sha2 0.9.9", "sha2 0.9.9",
"siwe", "siwe",
@ -1749,11 +1748,27 @@ dependencies = [
"clap", "clap",
"log", "log",
"mitra", "mitra",
"mitra-config",
"mitra-utils", "mitra-utils",
"tokio", "tokio",
"uuid", "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]] [[package]]
name = "mitra-utils" name = "mitra-utils"
version = "1.13.1" version = "1.13.1"

View file

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

View file

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

View file

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

View file

@ -1,9 +1,9 @@
use clap::Parser; use clap::Parser;
use mitra::config::parse_config;
use mitra::database::create_database_client; use mitra::database::create_database_client;
use mitra::database::migrate::apply_migrations; use mitra::database::migrate::apply_migrations;
use mitra::logger::configure_logger; use mitra::logger::configure_logger;
use mitra_config::parse_config;
mod cli; mod cli;
use cli::{Opts, SubCommand}; 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 { impl Instance {
pub fn for_test(url: &str) -> Self { pub fn for_test(url: &str) -> Self {
use mitra_utils::crypto_rsa::generate_weak_rsa_key; use mitra_utils::crypto_rsa::generate_weak_rsa_key;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,8 @@
use actix_web::{get, web, HttpResponse, Scope}; use actix_web::{get, web, HttpResponse, Scope};
use actix_web_httpauth::extractors::bearer::BearerAuth; use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config; use mitra_config::Config;
use crate::database::{get_database_client, DbPool}; use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError; use crate::errors::HttpError;
use crate::mastodon_api::{ 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::database::{DatabaseClient, DatabaseError};
use crate::ipfs::store as ipfs_store; use crate::ipfs::store as ipfs_store;
use crate::media::remove_files; use crate::media::remove_files;

View file

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

View file

@ -4,7 +4,8 @@ use chrono::{Duration, Utc};
use monero_rpc::TransferType; use monero_rpc::TransferType;
use monero_rpc::monero::{Address, Amount}; 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::database::{get_database_client, DatabaseError, DbPool};
use crate::ethereum::subscriptions::send_subscription_notifications; use crate::ethereum::subscriptions::send_subscription_notifications;
use crate::models::{ use crate::models::{

View file

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

View file

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

View file

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

View file

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

View file

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