feat(services/autumn): download and preview files

This commit is contained in:
Paul Makles
2024-09-01 13:58:11 +01:00
parent 78757ac7f1
commit ebbbb5e174
21 changed files with 1119 additions and 81 deletions

View File

@@ -88,6 +88,8 @@ max_concurrent_connections = 50
# Encryption key for stored files
# Generate your own key using `openssl rand -base64 32`
encryption_key = "qcuMA+ssxhMyKaNAKBGFfryfFtUH8NDlamQyDwGW6fU="
# Quality used for lossy WebP previews (set to 100 for lossless)
webp_quality = 80.0
[files.limit]
# Minimum image resolution
@@ -118,13 +120,13 @@ emojis = [128, 128]
# - default_bucket matches the name of the bucket you've created
# S3 protocol endpoint
endpoint = ""
endpoint = "http://minio:9000"
# S3 region name
region = ""
region = "minio"
# S3 protocol key ID
access_key_id = ""
access_key_id = "minioautumn"
# S3 protocol access key
secret_access_key = ""
secret_access_key = "minioautumn"
# Bucket to upload to by default
default_bucket = "revolt-uploads"

View File

@@ -126,6 +126,31 @@ pub struct Api {
pub workers: ApiWorkers,
}
#[derive(Deserialize, Debug, Clone)]
pub struct FilesLimit {
pub min_resolution: [usize; 2],
pub max_mega_pixels: usize,
pub max_pixel_side: usize,
}
#[derive(Deserialize, Debug, Clone)]
pub struct FilesS3 {
pub endpoint: String,
pub region: String,
pub access_key_id: String,
pub secret_access_key: String,
pub default_bucket: String,
}
#[derive(Deserialize, Debug, Clone)]
pub struct Files {
pub encryption_key: String,
pub webp_quality: f32,
pub limit: FilesLimit,
pub preview: HashMap<String, [usize; 2]>,
pub s3: FilesS3,
}
#[derive(Deserialize, Debug, Clone)]
pub struct GlobalLimits {
pub group_size: usize,
@@ -186,6 +211,7 @@ pub struct Settings {
pub database: Database,
pub hosts: Hosts,
pub api: Api,
pub files: Files,
pub features: Features,
pub sentry: Sentry,
}