summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2023-09-22 12:34:47 +0200
committerGravatar default2023-09-22 12:34:47 +0200
commitac8790c3cd1dae815e276de000a5b31a437be7e8 (patch)
tree9deca689626433c052bef939b204e1c442783b2a /activitypub.c
parentAdded more calls to xs_match(). (diff)
downloadsnac2-ac8790c3cd1dae815e276de000a5b31a437be7e8.tar.gz
snac2-ac8790c3cd1dae815e276de000a5b31a437be7e8.tar.xz
snac2-ac8790c3cd1dae815e276de000a5b31a437be7e8.zip
If a metadata starts with https:, convert it to a link.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index 6770039..a8a570c 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -982,9 +982,19 @@ xs_dict *msg_actor(snac *snac)
982 while (xs_dict_iter(&metadata, &k, &v)) { 982 while (xs_dict_iter(&metadata, &k, &v)) {
983 xs *d = xs_dict_new(); 983 xs *d = xs_dict_new();
984 984
985 xs *k2 = encode_html(k);
986 xs *v2 = NULL;
987
988 if (xs_startswith(v, "https:")) {
989 xs *t = encode_html(v);
990 v2 = xs_fmt("<a href=\"%s\">%s</a>", t, t);
991 }
992 else
993 v2 = encode_html(v);
994
985 d = xs_dict_append(d, "type", "PropertyValue"); 995 d = xs_dict_append(d, "type", "PropertyValue");
986 d = xs_dict_append(d, "name", k); 996 d = xs_dict_append(d, "name", k2);
987 d = xs_dict_append(d, "value", v); 997 d = xs_dict_append(d, "value", v2);
988 998
989 attach = xs_list_append(attach, d); 999 attach = xs_list_append(attach, d);
990 } 1000 }