diff options
| author | default <nobody@localhost> | 2025-01-07 19:01:46 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-07 19:01:46 +0100 |
| commit | fc9140bf1a94ea927c10db9c6bfb70afe5438bef (patch) | |
| tree | d9e4d1f7df08bc097f2524e35f0bfcedf627cba6 | |
| parent | 1039c2dff51173b46278c6b89555af7b273a9eae (diff) | |
Added a tweak to follow LitePub (Pleroma-style, https://litepub.social/) relays.
Usage: create a magic user named 'relay' and make it follow a relay actor (examples:
https://relay.c.im/actor or https://relay.ie9.org/actor).
Unfollowing returns a 400 status and posts keep arriving (at least with ie9.org),
so this is a problem at this moment.
| -rw-r--r-- | activitypub.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index 0740d3d..fe3fd41 100644 --- a/activitypub.c +++ b/activitypub.c @@ -675,7 +675,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) if (pub_msg) { /* a public message for someone we follow? (probably cc'ed) accept */ - if (following_check(snac, v)) + if (strcmp(v, public_address) != 0 && following_check(snac, v)) return 5; } else @@ -1242,6 +1242,10 @@ xs_dict *msg_actor(snac *snac) if (xs_type(xs_dict_get(snac->config, "bot")) == XSTYPE_TRUE) msg = xs_dict_set(msg, "type", "Service"); + /* if it's named "relay", then identify as an "Application" */ + if (strcmp(snac->uid, "relay") == 0) + msg = xs_dict_set(msg, "type", "Application"); + /* add the header image, if there is one defined */ const char *header = xs_dict_get(snac->config, "header"); if (!xs_is_null(header)) { @@ -2773,11 +2777,12 @@ void process_queue_item(xs_dict *q_item) snac user; if (user_open(&user, v)) { - if (is_msg_for_me(&user, msg)) { + int rsn = is_msg_for_me(&user, msg); + if (rsn) { xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); snac_debug(&user, 1, - xs_fmt("enqueue_input (from shared inbox) %s", xs_dict_get(msg, "id"))); + xs_fmt("enqueue_input (from shared inbox) %s [%d]", xs_dict_get(msg, "id"), rsn)); if (link(tmpfn, fn) < 0) srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); |