Attached videos are now embedded.

This commit is contained in:
default 2022-10-10 08:25:16 +02:00
parent acb3bb90c4
commit f31dc02715

15
html.c
View file

@ -565,7 +565,10 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
while (xs_list_iter(&attach, &v)) { while (xs_list_iter(&attach, &v)) {
char *t = xs_dict_get(v, "mediaType"); char *t = xs_dict_get(v, "mediaType");
if (t && xs_startswith(t, "image/")) { if (xs_is_null(t))
continue;
if (xs_startswith(t, "image/")) {
char *url = xs_dict_get(v, "url"); char *url = xs_dict_get(v, "url");
char *name = xs_dict_get(v, "name"); char *name = xs_dict_get(v, "name");
@ -573,6 +576,16 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
xs *s1 = xs_fmt("<p><img src=\"%s\" alt=\"%s\"/></p>\n", xs *s1 = xs_fmt("<p><img src=\"%s\" alt=\"%s\"/></p>\n",
url, xs_is_null(name) ? "" : name); url, xs_is_null(name) ? "" : name);
s = xs_str_cat(s, s1);
}
}
else
if (xs_startswith(t, "video/")) {
char *url = xs_dict_get(v, "url");
if (url != NULL) {
xs *s1 = xs_fmt("<p><object data=\"%s\"></object></p>\n", url);
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
} }
} }