snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit ac3b5dcbd472b533ec543331692921b804fd02e4
parent c3bcb2bd3b354bb05997347821a37506ca6cc298
Author: Louis Brauer <louis77@noreply.codeberg.org>
Date:   Thu, 30 May 2024 22:38:05 +0000

Merge branch 'master' into announcements

Diffstat:
MRELEASE_NOTES.md | 6++++++
Mactivitypub.c | 2+-
Mhtml.c | 16++++++++++++++++
Mmastoapi.c | 2+-
4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md @@ -4,8 +4,14 @@ Markdown-style links are now supported. +The alt text in attachments that have one is also shown in a dropdown just below it (useful for environments where mouseover is not available, i.e. for phones and tablets). + The avatar and/or the header images can now be deleted (contributed by louis77). +Code cleaning: HTTP status codes use names instead of hardcoded integers (contributed by louis77). + +Mastodon API: some fixes for Mona and Tokodon apps, user credentials can now be edited from apps (contributed by louis77). + The webfinger content-type response header is now RFC-compliant (contributed by steve-bate). ## 2.53 diff --git a/activitypub.c b/activitypub.c @@ -239,7 +239,7 @@ xs_list *get_attachments(const xs_dict *msg) if (xs_is_null(name)) name = xs_dict_get(msg, "name"); if (xs_is_null(name)) - name = L("No description"); + name = ""; xs *d = xs_dict_new(); d = xs_dict_append(d, "type", type); diff --git a/html.c b/html.c @@ -1909,6 +1909,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, xs_html_tag("a", xs_html_attr("href", href), xs_html_text(href)))); + + /* do not generate an Alt... */ + name = NULL; } else { xs_html_add(content_attachments, @@ -1918,6 +1921,19 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, xs_html_text(L("Attachment")), xs_html_text(": "), xs_html_text(href)))); + + /* do not generate an Alt... */ + name = NULL; + } + + if (name != NULL && *name) { + xs_html_add(content_attachments, + xs_html_tag("p", + xs_html_attr("class", "snac-alt-text"), + xs_html_tag("details", + xs_html_tag("summary", + xs_html_text(L("Alt..."))), + xs_html_text(name)))); } } } diff --git a/mastoapi.c b/mastoapi.c @@ -3215,7 +3215,7 @@ int mastoapi_patch_handler(const xs_dict *req, const char *q_path, const xs_str *k; const xs_val *v; const xs_str *field_name = NULL; - xs_dict *new_fields = xs_dict_new(); + xs *new_fields = xs_dict_new(); while (xs_dict_next(args, &k, &v, &c)) { if (strcmp(k, "display_name") == 0) { if (v != NULL)