diff options
| author | 2025-01-07 19:01:46 +0100 | |
|---|---|---|
| committer | 2025-01-07 19:01:46 +0100 | |
| commit | fc9140bf1a94ea927c10db9c6bfb70afe5438bef (patch) | |
| tree | d9e4d1f7df08bc097f2524e35f0bfcedf627cba6 | |
| parent | Version 2.68 RELEASED. (diff) | |
| download | snac2-fc9140bf1a94ea927c10db9c6bfb70afe5438bef.tar.gz snac2-fc9140bf1a94ea927c10db9c6bfb70afe5438bef.tar.xz snac2-fc9140bf1a94ea927c10db9c6bfb70afe5438bef.zip | |
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) | |||
| 675 | 675 | ||
| 676 | if (pub_msg) { | 676 | if (pub_msg) { |
| 677 | /* a public message for someone we follow? (probably cc'ed) accept */ | 677 | /* a public message for someone we follow? (probably cc'ed) accept */ |
| 678 | if (following_check(snac, v)) | 678 | if (strcmp(v, public_address) != 0 && following_check(snac, v)) |
| 679 | return 5; | 679 | return 5; |
| 680 | } | 680 | } |
| 681 | else | 681 | else |
| @@ -1242,6 +1242,10 @@ xs_dict *msg_actor(snac *snac) | |||
| 1242 | if (xs_type(xs_dict_get(snac->config, "bot")) == XSTYPE_TRUE) | 1242 | if (xs_type(xs_dict_get(snac->config, "bot")) == XSTYPE_TRUE) |
| 1243 | msg = xs_dict_set(msg, "type", "Service"); | 1243 | msg = xs_dict_set(msg, "type", "Service"); |
| 1244 | 1244 | ||
| 1245 | /* if it's named "relay", then identify as an "Application" */ | ||
| 1246 | if (strcmp(snac->uid, "relay") == 0) | ||
| 1247 | msg = xs_dict_set(msg, "type", "Application"); | ||
| 1248 | |||
| 1245 | /* add the header image, if there is one defined */ | 1249 | /* add the header image, if there is one defined */ |
| 1246 | const char *header = xs_dict_get(snac->config, "header"); | 1250 | const char *header = xs_dict_get(snac->config, "header"); |
| 1247 | if (!xs_is_null(header)) { | 1251 | if (!xs_is_null(header)) { |
| @@ -2773,11 +2777,12 @@ void process_queue_item(xs_dict *q_item) | |||
| 2773 | snac user; | 2777 | snac user; |
| 2774 | 2778 | ||
| 2775 | if (user_open(&user, v)) { | 2779 | if (user_open(&user, v)) { |
| 2776 | if (is_msg_for_me(&user, msg)) { | 2780 | int rsn = is_msg_for_me(&user, msg); |
| 2781 | if (rsn) { | ||
| 2777 | xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); | 2782 | xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); |
| 2778 | 2783 | ||
| 2779 | snac_debug(&user, 1, | 2784 | snac_debug(&user, 1, |
| 2780 | xs_fmt("enqueue_input (from shared inbox) %s", xs_dict_get(msg, "id"))); | 2785 | xs_fmt("enqueue_input (from shared inbox) %s [%d]", xs_dict_get(msg, "id"), rsn)); |
| 2781 | 2786 | ||
| 2782 | if (link(tmpfn, fn) < 0) | 2787 | if (link(tmpfn, fn) < 0) |
| 2783 | srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); | 2788 | srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); |