commit 4621a25

Louis Brauer  ·  2024-05-27 10:25:38 +0000 UTC
parents 81cf309, 36764b8
Merge remote-tracking branch 'origin/master'
8 files changed,  +66, -18
M html.c
M snac.h
M xs.h
+8, -0
 1@@ -1,5 +1,13 @@
 2 # Release Notes
 3 
 4+## 2.54
 5+
 6+Markdown-style links are now supported.
 7+
 8+The avatar and/or the header images can now be deleted (contributed by louis77).
 9+
10+The webfinger content-type response header is now RFC-compliant (contributed by steve-bate).
11+
12 ## 2.53
13 
14 New user feature to search by post content (using regular expressions) or tag.
+6, -1
 1@@ -38,7 +38,12 @@ int main(int argc, char *argv[])
 2 ```
 3 .Ed
 4 .It links
 5-Standalone URLs.
 6+Standalone URLs are converted to links. Also, from version 2.54,
 7+markdown-style links in the form of [link label](url) are also
 8+supported.
 9+.It Line separators
10+Horizonal rules can be inserted by typing three minus symbols
11+alone in a line.
12 .It quoted text
13 Lines starting with >.
14 .It User Mentions
+23, -8
 1@@ -304,15 +304,25 @@ supports:
 2 Complete support, on input and output.
 3 .It Vt Undo
 4 For
 5-.Vt Follow
 6+.Vt Follow ,
 7+.Vt Like
 8+and
 9+.Vt Announce
10 objects, on input and output.
11 .It Vt Create
12 For
13 .Vt Note ,
14-.Vt Question
15+.Vt Question ,
16+.Vt Page ,
17+.Vt Article ,
18+.Vt Event
19 and
20-.Vt Page
21-objects, on input and output.
22+.Vt Video
23+objects on input, and for
24+.Vt Note
25+and
26+.Vt Question
27+on output.
28 .It Vt Accept
29 For
30 .Vt Follow
31@@ -327,11 +337,16 @@ For
32 objects, on input and output.
33 .It Vt Update
34 For
35-.Vt Person ,
36-.Vt Note
37+.Vt Note ,
38+.Vt Question ,
39+.Vt Page ,
40+.Vt Article ,
41+.Vt Event
42 and
43-.Vt Question
44-objects, on input and output.
45+.Vt Video
46+objects on input, and for
47+.Vt Note
48+on output.
49 .It Vt Delete
50 Supported for
51 .Vt Note
+21, -1
 1@@ -87,7 +87,12 @@ static xs_str *format_line(const char *line, xs_list **attach)
 2 
 3     /* split by markup */
 4     xs *sm = xs_regex_split(line,
 5-        "(`[^`]+`|\\*\\*?[^\\*]+\\*?\\*|https?:/" "/[^[:space:]]+)");
 6+        "("
 7+            "`[^`]+`"                   "|"
 8+            "\\*\\*?[^\\*]+\\*?\\*"     "|"
 9+            "\\[[^]]+\\]\\([^\\)]+\\)"  "|"
10+            "https?:/" "/[^[:space:]]+"
11+        ")");
12     int n = 0;
13 
14     p = sm;
15@@ -135,6 +140,21 @@ static xs_str *format_line(const char *line, xs_list **attach)
16                     s = xs_str_cat(s, s1);
17                 }
18             }
19+            else
20+            if (*v == '[') {
21+                /* markdown-like links [label](url) */
22+                xs *w    = xs_strip_chars_i(xs_dup(v), "[)");
23+                xs *l    = xs_split_n(w, "](", 1);
24+
25+                if (xs_list_len(l) == 2) {
26+                    xs *link = xs_fmt("<a href=\"%s\">%s</a>",
27+                            xs_list_get(l, 1), xs_list_get(l, 0));
28+
29+                    s = xs_str_cat(s, link);
30+                }
31+                else
32+                    s = xs_str_cat(s, v);
33+            }
34             else
35                 s = xs_str_cat(s, v);
36         }
M html.c
+3, -3
 1@@ -1016,7 +1016,7 @@ xs_html *html_top_controls(snac *snac)
 2                     xs_html_sctag("input",
 3                         xs_html_attr("type", "checkbox"),
 4                         xs_html_attr("name", "avatar_delete")),
 5-        			xs_html_text(L("Delete current avatar"))),
 6+                        xs_html_text(L("Delete current avatar"))),
 7                 xs_html_tag("p",
 8                     xs_html_text(L("Header image (banner): ")),
 9                     xs_html_sctag("input",
10@@ -1026,8 +1026,8 @@ xs_html *html_top_controls(snac *snac)
11                     xs_html_sctag("input",
12                         xs_html_attr("type", "checkbox"),
13                         xs_html_attr("name", "header_delete")),
14-        			xs_html_text(L("Delete current header image"))),
15-		        xs_html_tag("p",
16+                        xs_html_text(L("Delete current header image"))),
17+                xs_html_tag("p",
18                     xs_html_text(L("Bio:")),
19                     xs_html_sctag("br", NULL),
20                     xs_html_tag("textarea",
M snac.h
+1, -1
1@@ -1,7 +1,7 @@
2 /* snac - A simple, minimalistic ActivityPub instance */
3 /* copyright (c) 2022 - 2024 grunfink et al. / MIT license */
4 
5-#define VERSION "2.53"
6+#define VERSION "2.54-dev"
7 
8 #define USER_AGENT "snac/" VERSION
9 
M xs.h
+3, -3
 1@@ -277,7 +277,7 @@ int _xs_get_size(const xs_val *ptr)
 2 /* must match _XS_TYPE_SIZE */
 3 {
 4     int i;
 5-    memcpy(&i, ptr, sizeof(i));
 6+    memcpy(&i, ptr + 1, sizeof(i));
 7     return i;
 8 }
 9 
10@@ -299,7 +299,7 @@ int xs_size(const xs_val *data)
11     case XSTYPE_LIST:
12     case XSTYPE_DICT:
13     case XSTYPE_DATA:
14-        len = _xs_get_size(data + 1);
15+        len = _xs_get_size(data);
16 
17         break;
18 
19@@ -1286,7 +1286,7 @@ xs_data *xs_data_new(const void *data, int size)
20 int xs_data_size(const xs_data *value)
21 /* returns the size of the data stored inside value */
22 {
23-    return _xs_get_size(value + 1) - (1 + _XS_TYPE_SIZE);
24+    return _xs_get_size(value) - (1 + _XS_TYPE_SIZE);
25 }
26 
27 
+1, -1
1@@ -1 +1 @@
2-/* 65769f25ed99b886a643522bef21628396cd118d 2024-05-25T08:18:51+02:00 */
3+/* e148ab08d5a55ac7bd30ff900f5eb048a57e21af 2024-05-27T05:33:01+02:00 */