forked from jmug/stoatchat
feat(services/autumn): file uploads
feat(services/autumn): deduplicate uploads feat(services/autumn): ClamAV support
This commit is contained in:
@@ -9,6 +9,7 @@ description = "Revolt Backend: Configuration"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
report-macros = ["revolt-result"]
|
||||
test = ["async-std"]
|
||||
default = ["test"]
|
||||
|
||||
@@ -32,3 +33,6 @@ pretty_env_logger = "0.4.0"
|
||||
|
||||
# Sentry
|
||||
sentry = "0.31.5"
|
||||
|
||||
# Core
|
||||
revolt-result = { version = "0.7.16", path = "../result", optional = true }
|
||||
|
||||
@@ -98,6 +98,14 @@ blocked_mime_types = []
|
||||
# ClamAV service
|
||||
# hostname:port
|
||||
clamd_host = ""
|
||||
# Mime types that should be virus scanned
|
||||
#
|
||||
# Leave empty to scan all file types
|
||||
scan_mime_types = [
|
||||
"application/vnd.microsoft.portable-executable",
|
||||
"application/vnd.android.package-archive",
|
||||
"application/zip",
|
||||
]
|
||||
|
||||
[files.limit]
|
||||
# Minimum file size (in bytes)
|
||||
@@ -220,3 +228,5 @@ emojis = 500_000
|
||||
# Configuration for Sentry error reporting
|
||||
api = ""
|
||||
events = ""
|
||||
files = ""
|
||||
proxy = ""
|
||||
|
||||
@@ -8,6 +8,30 @@ use serde::Deserialize;
|
||||
|
||||
pub use sentry::capture_error;
|
||||
|
||||
#[cfg(feature = "report-macros")]
|
||||
#[macro_export]
|
||||
macro_rules! report_error {
|
||||
( $expr: expr, $error: ident $( $tt:tt )? ) => {
|
||||
$expr
|
||||
.inspect_err(|err| {
|
||||
$crate::capture_error(err);
|
||||
})
|
||||
.map_err(|_| ::revolt_result::create_error!($error))
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "report-macros")]
|
||||
#[macro_export]
|
||||
macro_rules! report_internal_error {
|
||||
( $expr: expr ) => {
|
||||
$expr
|
||||
.inspect_err(|err| {
|
||||
$crate::capture_error(err);
|
||||
})
|
||||
.map_err(|_| ::revolt_result::create_error!(InternalError))
|
||||
};
|
||||
}
|
||||
|
||||
/// Paths to search for configuration
|
||||
static CONFIG_SEARCH_PATHS: [&str; 3] = [
|
||||
// current working directory
|
||||
@@ -157,6 +181,7 @@ pub struct Files {
|
||||
pub webp_quality: f32,
|
||||
pub blocked_mime_types: Vec<String>,
|
||||
pub clamd_host: String,
|
||||
pub scan_mime_types: Vec<String>,
|
||||
|
||||
pub limit: FilesLimit,
|
||||
pub preview: HashMap<String, [usize; 2]>,
|
||||
@@ -211,6 +236,8 @@ pub struct Features {
|
||||
pub struct Sentry {
|
||||
pub api: String,
|
||||
pub events: String,
|
||||
pub files: String,
|
||||
pub proxy: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user