summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md8
-rw-r--r--doc/snac.57
-rw-r--r--doc/snac.831
-rw-r--r--format.c22
-rw-r--r--html.c6
-rw-r--r--snac.h2
-rw-r--r--xs.h6
-rw-r--r--xs_version.h2
8 files changed, 66 insertions, 18 deletions
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.
diff --git a/doc/snac.5 b/doc/snac.5
index c460c7b..42b257e 100644
--- a/doc/snac.5
+++ b/doc/snac.5
@@ -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
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
diff --git a/format.c b/format.c
index b021f55..1020ddd 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;
@@ -136,6 +141,21 @@ static xs_str *format_line(const char *line, xs_list **attach)
}
}
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);
}
else
diff --git a/html.c b/html.c
index 6267adf..bacee5b 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",
diff --git a/snac.h b/snac.h
index 5c2f731..a821b18 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
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 */