diff options
| author | 2024-12-21 17:06:01 +0100 | |
|---|---|---|
| committer | 2024-12-21 17:06:01 +0100 | |
| commit | 05d6e41710ed46526f42048dbf24cc3185ba3aa6 (patch) | |
| tree | 8337159d9c0f7471eb2a5d1d89e9b3fb77becd4d /html.c | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-05d6e41710ed46526f42048dbf24cc3185ba3aa6.tar.gz snac2-05d6e41710ed46526f42048dbf24cc3185ba3aa6.tar.xz snac2-05d6e41710ed46526f42048dbf24cc3185ba3aa6.zip | |
If an attachment includes an icon, show it.
Diffstat (limited to '')
| -rw-r--r-- | html.c | 17 |
1 files changed, 17 insertions, 0 deletions
| @@ -2061,6 +2061,23 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2061 | if (content && xs_str_in(content, o_href) != -1) | 2061 | if (content && xs_str_in(content, o_href) != -1) |
| 2062 | continue; | 2062 | continue; |
| 2063 | 2063 | ||
| 2064 | /* do this attachment include an icon? */ | ||
| 2065 | const xs_dict *icon = xs_dict_get(a, "icon"); | ||
| 2066 | if (xs_type(icon) == XSTYPE_DICT) { | ||
| 2067 | const char *icon_mtype = xs_dict_get(icon, "mediaType"); | ||
| 2068 | const char *icon_url = xs_dict_get(icon, "url"); | ||
| 2069 | |||
| 2070 | if (icon_mtype && icon_url && xs_startswith(icon_mtype, "image/")) { | ||
| 2071 | xs_html_add(content_attachments, | ||
| 2072 | xs_html_tag("a", | ||
| 2073 | xs_html_attr("href", icon_url), | ||
| 2074 | xs_html_attr("target", "_blank"), | ||
| 2075 | xs_html_sctag("img", | ||
| 2076 | xs_html_attr("loading", "lazy"), | ||
| 2077 | xs_html_attr("src", icon_url)))); | ||
| 2078 | } | ||
| 2079 | } | ||
| 2080 | |||
| 2064 | xs *href = make_url(o_href, proxy, 0); | 2081 | xs *href = make_url(o_href, proxy, 0); |
| 2065 | 2082 | ||
| 2066 | if (xs_startswith(type, "image/") || strcmp(type, "Image") == 0) { | 2083 | if (xs_startswith(type, "image/") || strcmp(type, "Image") == 0) { |