commit fc9140b
default
·
2025-01-07 18:01:46 +0000 UTC
parent 1039c2d
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.
1 files changed,
+8,
-3
+8,
-3
1@@ -675,7 +675,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
2
3 if (pub_msg) {
4 /* a public message for someone we follow? (probably cc'ed) accept */
5- if (following_check(snac, v))
6+ if (strcmp(v, public_address) != 0 && following_check(snac, v))
7 return 5;
8 }
9 else
10@@ -1242,6 +1242,10 @@ xs_dict *msg_actor(snac *snac)
11 if (xs_type(xs_dict_get(snac->config, "bot")) == XSTYPE_TRUE)
12 msg = xs_dict_set(msg, "type", "Service");
13
14+ /* if it's named "relay", then identify as an "Application" */
15+ if (strcmp(snac->uid, "relay") == 0)
16+ msg = xs_dict_set(msg, "type", "Application");
17+
18 /* add the header image, if there is one defined */
19 const char *header = xs_dict_get(snac->config, "header");
20 if (!xs_is_null(header)) {
21@@ -2773,11 +2777,12 @@ void process_queue_item(xs_dict *q_item)
22 snac user;
23
24 if (user_open(&user, v)) {
25- if (is_msg_for_me(&user, msg)) {
26+ int rsn = is_msg_for_me(&user, msg);
27+ if (rsn) {
28 xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid);
29
30 snac_debug(&user, 1,
31- xs_fmt("enqueue_input (from shared inbox) %s", xs_dict_get(msg, "id")));
32+ xs_fmt("enqueue_input (from shared inbox) %s [%d]", xs_dict_get(msg, "id"), rsn));
33
34 if (link(tmpfn, fn) < 0)
35 srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn));