diff options
| author | 2025-03-26 01:40:14 +0100 | |
|---|---|---|
| committer | 2025-04-13 14:41:34 +0200 | |
| commit | fbd81b604315f569ce5714fdc9d3caa78daaa83a (patch) | |
| tree | c8ccfe6ecfccc33fea7584f38fa5210a17a69faa | |
| parent | also display the emoji for likes (diff) | |
| download | penes-snac2-fbd81b604315f569ce5714fdc9d3caa78daaa83a.tar.gz penes-snac2-fbd81b604315f569ce5714fdc9d3caa78daaa83a.tar.xz penes-snac2-fbd81b604315f569ce5714fdc9d3caa78daaa83a.zip | |
mime types for apng and svg check
| -rw-r--r-- | html.c | 10 | ||||
| -rw-r--r-- | xs_mime.h | 1 |
2 files changed, 4 insertions, 7 deletions
| @@ -95,14 +95,10 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p | |||
| 95 | // on akkoma instances mediaType is not present. | 95 | // on akkoma instances mediaType is not present. |
| 96 | // but we need to to know if the image is an svg or not. | 96 | // but we need to to know if the image is an svg or not. |
| 97 | // for now, i just use the file extention, which may not be the most reliable... | 97 | // for now, i just use the file extention, which may not be the most reliable... |
| 98 | int is_svg = 0; | 98 | if (!xs_is_string(mt)) |
| 99 | if (xs_is_string(mt)) { | 99 | mt = xs_mime_by_ext(u); |
| 100 | is_svg = (strcmp(mt, "image/svg+xml") == 0); | ||
| 101 | } else { | ||
| 102 | is_svg = xs_endswith(u, ".svg"); | ||
| 103 | } | ||
| 104 | 100 | ||
| 105 | if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) | 101 | if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) |
| 106 | s = xs_replace_i(s, n, ""); | 102 | s = xs_replace_i(s, n, ""); |
| 107 | else { | 103 | else { |
| 108 | xs *url = make_url(u, proxy, 0); | 104 | xs *url = make_url(u, proxy, 0); |
| @@ -38,6 +38,7 @@ const char *xs_mime_types[] = { | |||
| 38 | "ogv", "video/ogg", | 38 | "ogv", "video/ogg", |
| 39 | "opus", "audio/ogg", | 39 | "opus", "audio/ogg", |
| 40 | "png", "image/png", | 40 | "png", "image/png", |
| 41 | "apng", "image/apng", | ||
| 41 | "svg", "image/svg+xml", | 42 | "svg", "image/svg+xml", |
| 42 | "svgz", "image/svg+xml", | 43 | "svgz", "image/svg+xml", |
| 43 | "txt", "text/plain", | 44 | "txt", "text/plain", |