diff options
| author | grunfink <grunfink@comam.es> | 2025-05-09 15:31:58 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-05-09 15:31:58 +0200 |
| commit | c166e05f7d3ba1efe9b16290bf3da2b06fdae8ea (patch) | |
| tree | aba94462b73a15e41d7a7f651f41e379f194e1a7 /activitypub.c | |
| parent | 33647d2cb75077b7152a9727659b452a7727d42b (diff) | |
As they look ugly in some platforms, links are no longer shown as attachments.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index dcbb79f..48a999a 100644 --- a/activitypub.c +++ b/activitypub.c @@ -3034,13 +3034,15 @@ void process_queue_item(xs_dict *q_item) if (strcmp(type, "webmention") == 0) { const xs_dict *msg = xs_dict_get(q_item, "message"); const char *source = xs_dict_get(msg, "id"); - const xs_list *atts = xs_dict_get(msg, "attachment"); - const xs_dict *att; + const char *content = xs_dict_get(msg, "content"); - xs_list_foreach(atts, att) { - const char *target = xs_dict_get(att, "url"); + if (xs_is_string(source) && xs_is_string(content)) { + xs *links = xs_regex_select(content, "\"https?[^\"]+"); + const char *link; + + xs_list_foreach(links, link) { + xs *target = xs_strip_chars_i(xs_dup(link), "\""); - if (xs_is_string(source) && xs_is_string(target)) { int r = xs_webmention_send(source, target, USER_AGENT); srv_debug(1, xs_fmt("webmention source=%s target=%s %d", source, target, r)); |