From 37b6c7926e895aedb79b39cd2e9c788c26a7db28 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:01:13 +0200 Subject: [PATCH 1/8] Minor code reformatting. --- html.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index 4522050..d801b39 100644 --- a/html.c +++ b/html.c @@ -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", From 8e0ccc6d76af26c83e5adebfaa18aef364e59975 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:27:36 +0200 Subject: [PATCH 2/8] Added markdown-like links. --- format.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/format.c b/format.c index b021f55..0a8b72c 100644 --- a/format.c +++ b/format.c @@ -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,16 @@ 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(w, "]("); + xs *link = xs_fmt("%s", + xs_list_get(l, 1), xs_list_get(l, 0)); + + s = xs_str_cat(s, link); + } else s = xs_str_cat(s, v); } From db5a72b6a01eddc61f916365aaf175fb937298f1 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:29:38 +0200 Subject: [PATCH 3/8] Bumped version. --- snac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snac.h b/snac.h index 79e144a..0f1dfff 100644 --- a/snac.h +++ b/snac.h @@ -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 From fbdcbc841457f0f8bbaedd5efe7e54edbbf17c0a Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:36:04 +0200 Subject: [PATCH 4/8] Updated RELEASE_NOTES. --- RELEASE_NOTES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cea217a..7573246 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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. From 261466fb5fd45405869ec5e3a13750460dc5c42e Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:41:08 +0200 Subject: [PATCH 5/8] Updated documentation. --- doc/snac.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/snac.5 b/doc/snac.5 index c460c7b..3f5e27d 100644 --- a/doc/snac.5 +++ b/doc/snac.5 @@ -38,7 +38,9 @@ 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 quoted text Lines starting with >. .It User Mentions From 4979bccbe36cf4701c3b035483e5fbf1aab910ae Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 09:48:48 +0200 Subject: [PATCH 6/8] Updated documentation. --- doc/snac.5 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/snac.5 b/doc/snac.5 index 3f5e27d..42b257e 100644 --- a/doc/snac.5 +++ b/doc/snac.5 @@ -41,6 +41,9 @@ int main(int argc, char *argv[]) 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 From 36969bcf6f4ed85a76ee3216051e9acb181d60dc Mon Sep 17 00:00:00 2001 From: default Date: Sun, 26 May 2024 10:56:29 +0200 Subject: [PATCH 7/8] Updated documentation. --- doc/snac.8 | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/doc/snac.8 b/doc/snac.8 index 7c35aeb..389cd0e 100644 --- a/doc/snac.8 +++ b/doc/snac.8 @@ -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 From 36764b8ade5ee4686b04acb251f586eec4dacfad Mon Sep 17 00:00:00 2001 From: default Date: Mon, 27 May 2024 05:49:29 +0200 Subject: [PATCH 8/8] Minor tweak to markdown-like links. --- format.c | 11 ++++++++--- xs.h | 6 +++--- xs_version.h | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/format.c b/format.c index 0a8b72c..1020ddd 100644 --- a/format.c +++ b/format.c @@ -144,11 +144,16 @@ static xs_str *format_line(const char *line, xs_list **attach) if (*v == '[') { /* markdown-like links [label](url) */ xs *w = xs_strip_chars_i(xs_dup(v), "[)"); - xs *l = xs_split(w, "]("); - xs *link = xs_fmt("%s", + xs *l = xs_split_n(w, "](", 1); + + if (xs_list_len(l) == 2) { + xs *link = xs_fmt("%s", xs_list_get(l, 1), xs_list_get(l, 0)); - s = xs_str_cat(s, link); + s = xs_str_cat(s, link); + } + else + s = xs_str_cat(s, v); } else s = xs_str_cat(s, v); diff --git a/xs.h b/xs.h index 972665c..56771e1 100644 --- a/xs.h +++ b/xs.h @@ -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); } diff --git a/xs_version.h b/xs_version.h index 7a7ba53..2e86334 100644 --- a/xs_version.h +++ b/xs_version.h @@ -1 +1 @@ -/* 65769f25ed99b886a643522bef21628396cd118d 2024-05-25T08:18:51+02:00 */ +/* e148ab08d5a55ac7bd30ff900f5eb048a57e21af 2024-05-27T05:33:01+02:00 */