Fixed video attachments.

This commit is contained in:
default 2023-04-26 21:07:00 +02:00
parent 9bb08cfd51
commit dd4ba7969f

View File

@ -570,12 +570,13 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
while (xs_list_iter(&att, &aobj)) {
const char *mtype = xs_dict_get(aobj, "mediaType");
if (!xs_is_null(mtype) && xs_startswith(mtype, "image/")) {
if (!xs_is_null(mtype)) {
if (xs_startswith(mtype, "image/") || xs_startswith(mtype, "video/")) {
xs *matteid = xs_fmt("%s_%d", id, xs_list_len(matt));
xs *matte = xs_dict_new();
matte = xs_dict_append(matte, "id", matteid);
matte = xs_dict_append(matte, "type", "image");
matte = xs_dict_append(matte, "type", *mtype == 'i' ? "image" : "video");
matte = xs_dict_append(matte, "url", xs_dict_get(aobj, "url"));
matte = xs_dict_append(matte, "preview_url", xs_dict_get(aobj, "url"));
matte = xs_dict_append(matte, "remote_url", xs_dict_get(aobj, "url"));
@ -589,6 +590,7 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
matt = xs_list_append(matt, matte);
}
}
}
st = xs_dict_append(st, "media_attachments", matt);