Merge remote-tracking branch 'origin/master'

This commit is contained in:
Louis Brauer 2024-05-27 12:25:38 +02:00
commit 4621a25ba4
8 changed files with 66 additions and 18 deletions

View File

@ -1,5 +1,13 @@
# Release Notes
## 2.54
Markdown-style links are now supported.
The avatar and/or the header images can now be deleted (contributed by louis77).
The webfinger content-type response header is now RFC-compliant (contributed by steve-bate).
## 2.53
New user feature to search by post content (using regular expressions) or tag.

View File

@ -38,7 +38,12 @@ int main(int argc, char *argv[])
```
.Ed
.It links
Standalone URLs.
Standalone URLs are converted to links. Also, from version 2.54,
markdown-style links in the form of [link label](url) are also
supported.
.It Line separators
Horizonal rules can be inserted by typing three minus symbols
alone in a line.
.It quoted text
Lines starting with >.
.It User Mentions

View File

@ -304,15 +304,25 @@ supports:
Complete support, on input and output.
.It Vt Undo
For
.Vt Follow
.Vt Follow ,
.Vt Like
and
.Vt Announce
objects, on input and output.
.It Vt Create
For
.Vt Note ,
.Vt Question
.Vt Question ,
.Vt Page ,
.Vt Article ,
.Vt Event
and
.Vt Page
objects, on input and output.
.Vt Video
objects on input, and for
.Vt Note
and
.Vt Question
on output.
.It Vt Accept
For
.Vt Follow
@ -327,11 +337,16 @@ For
objects, on input and output.
.It Vt Update
For
.Vt Person ,
.Vt Note
.Vt Note ,
.Vt Question ,
.Vt Page ,
.Vt Article ,
.Vt Event
and
.Vt Question
objects, on input and output.
.Vt Video
objects on input, and for
.Vt Note
on output.
.It Vt Delete
Supported for
.Vt Note

View File

@ -87,7 +87,12 @@ static xs_str *format_line(const char *line, xs_list **attach)
/* split by markup */
xs *sm = xs_regex_split(line,
"(`[^`]+`|\\*\\*?[^\\*]+\\*?\\*|https?:/" "/[^[:space:]]+)");
"("
"`[^`]+`" "|"
"\\*\\*?[^\\*]+\\*?\\*" "|"
"\\[[^]]+\\]\\([^\\)]+\\)" "|"
"https?:/" "/[^[:space:]]+"
")");
int n = 0;
p = sm;
@ -135,6 +140,21 @@ static xs_str *format_line(const char *line, xs_list **attach)
s = xs_str_cat(s, s1);
}
}
else
if (*v == '[') {
/* markdown-like links [label](url) */
xs *w = xs_strip_chars_i(xs_dup(v), "[)");
xs *l = xs_split_n(w, "](", 1);
if (xs_list_len(l) == 2) {
xs *link = xs_fmt("<a href=\"%s\">%s</a>",
xs_list_get(l, 1), xs_list_get(l, 0));
s = xs_str_cat(s, link);
}
else
s = xs_str_cat(s, v);
}
else
s = xs_str_cat(s, v);
}

6
html.c
View File

@ -1016,7 +1016,7 @@ xs_html *html_top_controls(snac *snac)
xs_html_sctag("input",
xs_html_attr("type", "checkbox"),
xs_html_attr("name", "avatar_delete")),
xs_html_text(L("Delete current avatar"))),
xs_html_text(L("Delete current avatar"))),
xs_html_tag("p",
xs_html_text(L("Header image (banner): ")),
xs_html_sctag("input",
@ -1026,8 +1026,8 @@ xs_html *html_top_controls(snac *snac)
xs_html_sctag("input",
xs_html_attr("type", "checkbox"),
xs_html_attr("name", "header_delete")),
xs_html_text(L("Delete current header image"))),
xs_html_tag("p",
xs_html_text(L("Delete current header image"))),
xs_html_tag("p",
xs_html_text(L("Bio:")),
xs_html_sctag("br", NULL),
xs_html_tag("textarea",

2
snac.h
View File

@ -1,7 +1,7 @@
/* snac - A simple, minimalistic ActivityPub instance */
/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */
#define VERSION "2.53"
#define VERSION "2.54-dev"
#define USER_AGENT "snac/" VERSION

6
xs.h
View File

@ -277,7 +277,7 @@ int _xs_get_size(const xs_val *ptr)
/* must match _XS_TYPE_SIZE */
{
int i;
memcpy(&i, ptr, sizeof(i));
memcpy(&i, ptr + 1, sizeof(i));
return i;
}
@ -299,7 +299,7 @@ int xs_size(const xs_val *data)
case XSTYPE_LIST:
case XSTYPE_DICT:
case XSTYPE_DATA:
len = _xs_get_size(data + 1);
len = _xs_get_size(data);
break;
@ -1286,7 +1286,7 @@ xs_data *xs_data_new(const void *data, int size)
int xs_data_size(const xs_data *value)
/* returns the size of the data stored inside value */
{
return _xs_get_size(value + 1) - (1 + _XS_TYPE_SIZE);
return _xs_get_size(value) - (1 + _XS_TYPE_SIZE);
}

View File

@ -1 +1 @@
/* 65769f25ed99b886a643522bef21628396cd118d 2024-05-25T08:18:51+02:00 */
/* e148ab08d5a55ac7bd30ff900f5eb048a57e21af 2024-05-27T05:33:01+02:00 */