Allow custom emojis with image/apng media type
This commit is contained in:
parent
42329328ec
commit
e24f01a2b5
4 changed files with 8 additions and 4 deletions
|
@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Save sizes of media attachments and other files to database.
|
||||
- Added `import-emoji` command.
|
||||
- Added support for emoji shortcodes.
|
||||
- Allowed custom emojis with `image/apng` media type.
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ struct InstanceStatusLimits {
|
|||
|
||||
#[derive(Serialize)]
|
||||
struct InstanceMediaLimits {
|
||||
supported_mime_types: [&'static str; 7],
|
||||
supported_mime_types: Vec<String>,
|
||||
image_size_limit: usize,
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,8 @@ impl InstanceInfo {
|
|||
max_media_attachments: ATTACHMENTS_MAX_NUM,
|
||||
},
|
||||
media_attachments: InstanceMediaLimits {
|
||||
supported_mime_types: SUPPORTED_MEDIA_TYPES,
|
||||
supported_mime_types: SUPPORTED_MEDIA_TYPES.iter()
|
||||
.map(|media_type| media_type.to_string()).collect(),
|
||||
image_size_limit: UPLOAD_MAX_SIZE,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -5,7 +5,8 @@ use crate::errors::ValidationError;
|
|||
const EMOJI_NAME_RE: &str = r"^[\w.]+$";
|
||||
pub const EMOJI_MAX_SIZE: usize = 250 * 1000; // 250 kB
|
||||
pub const EMOJI_LOCAL_MAX_SIZE: usize = 50 * 1000; // 50 kB
|
||||
pub const EMOJI_MEDIA_TYPES: [&str; 2] = [
|
||||
pub const EMOJI_MEDIA_TYPES: [&str; 3] = [
|
||||
"image/apng",
|
||||
"image/gif",
|
||||
"image/png",
|
||||
];
|
||||
|
|
|
@ -13,8 +13,9 @@ use mime_guess::get_mime_extensions_str;
|
|||
use mime_sniffer::MimeTypeSniffer;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
pub const SUPPORTED_MEDIA_TYPES: [&str; 7] = [
|
||||
pub const SUPPORTED_MEDIA_TYPES: [&str; 8] = [
|
||||
"audio/mpeg",
|
||||
"image/apng",
|
||||
"image/gif",
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
|
|
Loading…
Reference in a new issue