Support audio attachments

This commit is contained in:
silverpill 2023-03-05 14:08:26 +00:00
parent ba1c694294
commit 452de34780
4 changed files with 6 additions and 0 deletions

View file

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added `registration.default_role` configuration option. - Added `registration.default_role` configuration option.
- Save emojis attached to actor objects. - Save emojis attached to actor objects.
- Added `emojis` field to Mastodon API Account entity. - Added `emojis` field to Mastodon API Account entity.
- Support audio attachments.
### Changed ### Changed

View file

@ -1497,6 +1497,7 @@ components:
- unknown - unknown
- image - image
- video - video
- audio
url: url:
description: The location of the original full-size attachment. description: The location of the original full-size attachment.
type: string type: string

View file

@ -33,6 +33,7 @@ impl Attachment {
AttachmentType::Unknown => "unknown", AttachmentType::Unknown => "unknown",
AttachmentType::Image => "image", AttachmentType::Image => "image",
AttachmentType::Video => "video", AttachmentType::Video => "video",
AttachmentType::Audio => "audio",
}; };
let attachment_url = get_file_url( let attachment_url = get_file_url(
base_url, base_url,

View file

@ -19,6 +19,7 @@ pub enum AttachmentType {
Unknown, Unknown,
Image, Image,
Video, Video,
Audio,
} }
impl AttachmentType { impl AttachmentType {
@ -29,6 +30,8 @@ impl AttachmentType {
Self::Image Self::Image
} else if media_type.starts_with("video/") { } else if media_type.starts_with("video/") {
Self::Video Self::Video
} else if media_type.starts_with("audio/") {
Self::Audio
} else { } else {
Self::Unknown Self::Unknown
} }