summaryrefslogtreecommitdiff
path: root/internal/media/util.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-12-17 05:38:56 +0100
committerLibravatar GitHub <noreply@github.com>2022-12-17 04:38:56 +0000
commit2bbc64be4317166d3abb7aa177d4913f166a53e8 (patch)
tree88c3d613eb986b18894f311afa4291987a0e26c4 /internal/media/util.go
parent[chore] fix some little config whoopsies (#1272) (diff)
downloadgotosocial-2bbc64be4317166d3abb7aa177d4913f166a53e8.tar.xz
[feature] Enable basic video support (mp4 only) (#1274)
* [feature] basic video support * fix missing semicolon * replace text shadow with stacked icons Co-authored-by: f0x <f0x@cthu.lu>
Diffstat (limited to 'internal/media/util.go')
-rw-r--r--internal/media/util.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/internal/media/util.go b/internal/media/util.go
index 60661cbc0..387f5d65a 100644
--- a/internal/media/util.go
+++ b/internal/media/util.go
@@ -37,6 +37,7 @@ func AllSupportedMIMETypes() []string {
mimeImageGif,
mimeImagePng,
mimeImageWebp,
+ mimeVideoMp4,
}
}
@@ -61,16 +62,10 @@ func parseContentType(fileHeader []byte) (string, error) {
return kind.MIME.Value, nil
}
-// supportedImage checks mime type of an image against a slice of accepted types,
-// and returns True if the mime type is accepted.
-func supportedImage(mimeType string) bool {
- acceptedImageTypes := []string{
- mimeImageJpeg,
- mimeImageGif,
- mimeImagePng,
- mimeImageWebp,
- }
- for _, accepted := range acceptedImageTypes {
+// supportedAttachment checks mime type of an attachment against a
+// slice of accepted types, and returns True if the mime type is accepted.
+func supportedAttachment(mimeType string) bool {
+ for _, accepted := range AllSupportedMIMETypes() {
if mimeType == accepted {
return true
}