fork
Configure Feed
Select the types of activity you want to include in your feed.
Live video on the AT Protocol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package api
2
3// Packaging a robust set of MIME types from Debian so everything
4// doesn't break when we add a new image type to the app or something.
5
6import (
7 "bufio"
8 "bytes"
9 _ "embed"
10 "mime"
11 "strings"
12)
13
14//go:embed mime.types
15var mimeTypes []byte
16
17func loadEmbeddedMimes() {
18 scanner := bufio.NewScanner(bytes.NewReader(mimeTypes))
19 for scanner.Scan() {
20 fields := strings.Fields(scanner.Text())
21 if len(fields) <= 1 || fields[0][0] == '#' {
22 continue
23 }
24 mimeType := fields[0]
25 for _, ext := range fields[1:] {
26 if ext[0] == '#' {
27 break
28 }
29 mime.AddExtensionType("."+ext, mimeType)
30 }
31 }
32 if err := scanner.Err(); err != nil {
33 panic(err)
34 }
35}