diff options
| author | green <dandelions@disroot.org> | 2025-03-22 21:31:01 +0100 |
|---|---|---|
| committer | green <dandelions@disroot.org> | 2025-04-13 14:39:04 +0200 |
| commit | 7f10057cff51748f7fb96021dc755127991cdbf9 (patch) | |
| tree | 64b1aa83ee7db936467a233c249cf730dd559169 /html.c | |
| parent | 251d31e10e7ab70d9480b2e056d1d76260de7046 (diff) | |
fixed broken emojis on akkoma
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -91,8 +91,18 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p const char *u = xs_dict_get(i, "url"); const char *mt = xs_dict_get(i, "mediaType"); - if (xs_is_string(u) && xs_is_string(mt)) { - if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) + if (xs_is_string(u)) { + // on akkoma instances mediaType is not present. + // but we need to to know if the image is an svg or not. + // for now, i just use the file extention, which may not be the most reliable... + int is_svg = 0; + if (xs_is_string(mt)) { + is_svg = (strcmp(mt, "image/svg+xml") == 0); + } else { + is_svg = xs_endswith(u, ".svg"); + } + + if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) s = xs_replace_i(s, n, ""); else { xs *url = make_url(u, proxy, 0); @@ -3112,6 +3122,10 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c if (!xs_is_null(c)) { xs *sc = sanitize(c); + + // replace shortnames in bio + // bug: this somehow fires twice on one specific user + // @ielenia@ck.catwithaclari.net sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy); xs_html *snac_content = xs_html_tag("div", |