diff options
| author | 2025-03-22 21:31:01 +0100 | |
|---|---|---|
| committer | 2025-04-13 14:39:04 +0200 | |
| commit | 7f10057cff51748f7fb96021dc755127991cdbf9 (patch) | |
| tree | 64b1aa83ee7db936467a233c249cf730dd559169 | |
| parent | emoji in external bios (i hope) (diff) | |
| download | penes-snac2-7f10057cff51748f7fb96021dc755127991cdbf9.tar.gz penes-snac2-7f10057cff51748f7fb96021dc755127991cdbf9.tar.xz penes-snac2-7f10057cff51748f7fb96021dc755127991cdbf9.zip | |
fixed broken emojis on akkoma
| -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 | |||
| 91 | const char *u = xs_dict_get(i, "url"); | 91 | const char *u = xs_dict_get(i, "url"); |
| 92 | const char *mt = xs_dict_get(i, "mediaType"); | 92 | const char *mt = xs_dict_get(i, "mediaType"); |
| 93 | 93 | ||
| 94 | if (xs_is_string(u) && xs_is_string(mt)) { | 94 | if (xs_is_string(u)) { |
| 95 | if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) | 95 | // on akkoma instances mediaType is not present. |
| 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... | ||
| 98 | int is_svg = 0; | ||
| 99 | if (xs_is_string(mt)) { | ||
| 100 | is_svg = (strcmp(mt, "image/svg+xml") == 0); | ||
| 101 | } else { | ||
| 102 | is_svg = xs_endswith(u, ".svg"); | ||
| 103 | } | ||
| 104 | |||
| 105 | if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg"))) | ||
| 96 | s = xs_replace_i(s, n, ""); | 106 | s = xs_replace_i(s, n, ""); |
| 97 | else { | 107 | else { |
| 98 | xs *url = make_url(u, proxy, 0); | 108 | 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 | |||
| 3112 | 3122 | ||
| 3113 | if (!xs_is_null(c)) { | 3123 | if (!xs_is_null(c)) { |
| 3114 | xs *sc = sanitize(c); | 3124 | xs *sc = sanitize(c); |
| 3125 | |||
| 3126 | // replace shortnames in bio | ||
| 3127 | // bug: this somehow fires twice on one specific user | ||
| 3128 | // @ielenia@ck.catwithaclari.net | ||
| 3115 | sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy); | 3129 | sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy); |
| 3116 | 3130 | ||
| 3117 | xs_html *snac_content = xs_html_tag("div", | 3131 | xs_html *snac_content = xs_html_tag("div", |