commit 7f10057
green
·
2025-03-22 20:31:01 +0000 UTC
parent 251d31e
fixed broken emojis on akkoma
1 files changed,
+16,
-2
M
html.c
M
html.c
+16,
-2
1@@ -91,8 +91,18 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
2 const char *u = xs_dict_get(i, "url");
3 const char *mt = xs_dict_get(i, "mediaType");
4
5- if (xs_is_string(u) && xs_is_string(mt)) {
6- if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
7+ if (xs_is_string(u)) {
8+ // on akkoma instances mediaType is not present.
9+ // but we need to to know if the image is an svg or not.
10+ // for now, i just use the file extention, which may not be the most reliable...
11+ int is_svg = 0;
12+ if (xs_is_string(mt)) {
13+ is_svg = (strcmp(mt, "image/svg+xml") == 0);
14+ } else {
15+ is_svg = xs_endswith(u, ".svg");
16+ }
17+
18+ if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
19 s = xs_replace_i(s, n, "");
20 else {
21 xs *url = make_url(u, proxy, 0);
22@@ -3112,6 +3122,10 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
23
24 if (!xs_is_null(c)) {
25 xs *sc = sanitize(c);
26+
27+ // replace shortnames in bio
28+ // bug: this somehow fires twice on one specific user
29+ // @ielenia@ck.catwithaclari.net
30 sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy);
31
32 xs_html *snac_content = xs_html_tag("div",