diff options
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 24 |
1 files changed, 23 insertions, 1 deletions
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "xs_set.h" | 12 | #include "xs_set.h" |
| 13 | #include "xs_random.h" | 13 | #include "xs_random.h" |
| 14 | #include "xs_httpd.h" | 14 | #include "xs_httpd.h" |
| 15 | #include "xs_mime.h" | ||
| 15 | 16 | ||
| 16 | #include "snac.h" | 17 | #include "snac.h" |
| 17 | 18 | ||
| @@ -1524,11 +1525,32 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1524 | 1525 | ||
| 1525 | xs *d13 = xs_json_loads("{\"image_matrix_limit\":33177600," | 1526 | xs *d13 = xs_json_loads("{\"image_matrix_limit\":33177600," |
| 1526 | "\"image_size_limit\":16777216," | 1527 | "\"image_size_limit\":16777216," |
| 1527 | "\"supported_mime_types\":[\"image/jpeg\"]," | ||
| 1528 | "\"video_frame_rate_limit\":120," | 1528 | "\"video_frame_rate_limit\":120," |
| 1529 | "\"video_matrix_limit\":8294400," | 1529 | "\"video_matrix_limit\":8294400," |
| 1530 | "\"video_size_limit\":103809024}" | 1530 | "\"video_size_limit\":103809024}" |
| 1531 | ); | 1531 | ); |
| 1532 | |||
| 1533 | { | ||
| 1534 | /* get the supported mime types from the internal list */ | ||
| 1535 | const char **p = xs_mime_types; | ||
| 1536 | xs_set mtypes; | ||
| 1537 | xs_set_init(&mtypes); | ||
| 1538 | |||
| 1539 | while (*p) { | ||
| 1540 | const char *type = p[1]; | ||
| 1541 | |||
| 1542 | if (xs_startswith(type, "image/") || | ||
| 1543 | xs_startswith(type, "video/") || | ||
| 1544 | xs_startswith(type, "audio/")) | ||
| 1545 | xs_set_add(&mtypes, type); | ||
| 1546 | |||
| 1547 | p += 2; | ||
| 1548 | } | ||
| 1549 | |||
| 1550 | xs *l = xs_set_result(&mtypes); | ||
| 1551 | d13 = xs_dict_append(d13, "supported_mime_types", l); | ||
| 1552 | } | ||
| 1553 | |||
| 1532 | cfg = xs_dict_append(cfg, "media_attachments", d13); | 1554 | cfg = xs_dict_append(cfg, "media_attachments", d13); |
| 1533 | 1555 | ||
| 1534 | xs *d14 = xs_json_loads("{\"max_characters_per_option\":50," | 1556 | xs *d14 = xs_json_loads("{\"max_characters_per_option\":50," |