summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c4
-rwxr-xr-xexamples/auto_follower_webhook.py10
2 files changed, 9 insertions, 5 deletions
diff --git a/data.c b/data.c
index 74bc112..28f7cd9 100644
--- a/data.c
+++ b/data.c
@@ -3534,6 +3534,10 @@ void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
3534 3534
3535 /* add more data */ 3535 /* add more data */
3536 msg = xs_dict_set(msg, "target", user->actor); 3536 msg = xs_dict_set(msg, "target", user->actor);
3537 msg = xs_dict_set(msg, "uid", user->uid);
3538 msg = xs_dict_set(msg, "basedir", srv_basedir);
3539 msg = xs_dict_set(msg, "baseurl", srv_baseurl);
3540
3537 xs *actor_obj = NULL; 3541 xs *actor_obj = NULL;
3538 3542
3539 if (valid_status(object_get(xs_dict_get(noti, "actor"), &actor_obj)) && actor_obj) 3543 if (valid_status(object_get(xs_dict_get(noti, "actor"), &actor_obj)) && actor_obj)
diff --git a/examples/auto_follower_webhook.py b/examples/auto_follower_webhook.py
index e1192c1..eb632a3 100755
--- a/examples/auto_follower_webhook.py
+++ b/examples/auto_follower_webhook.py
@@ -2,8 +2,7 @@
2 2
3# This is an example of a snac webhook that automatically follows all new followers. 3# This is an example of a snac webhook that automatically follows all new followers.
4 4
5# To use it, set the variables snac_basedir and snac_user to something reasonable, 5# To use it, configure the user webhook to be http://localhost:12345, and run this program.
6# configure the user webhook to be http://localhost:12345, and run this program.
7 6
8# copyright (C) 2025 grunfink et al. / MIT license 7# copyright (C) 2025 grunfink et al. / MIT license
9 8
@@ -14,8 +13,6 @@ import os
14 13
15host_name = "localhost" 14host_name = "localhost"
16server_port = 12345 15server_port = 12345
17snac_basedir = "/var/snac/example_instance"
18snac_user = "example_user"
19 16
20class SnacAutoResponderServer(BaseHTTPRequestHandler): 17class SnacAutoResponderServer(BaseHTTPRequestHandler):
21 18
@@ -35,7 +32,10 @@ class SnacAutoResponderServer(BaseHTTPRequestHandler):
35 32
36 if type == "Follow": 33 if type == "Follow":
37 actor = noti["actor"] 34 actor = noti["actor"]
38 cmd = "snac follow %s %s %s" % (snac_basedir, snac_user, actor) 35 uid = noti["uid"]
36 basedir = noti["basedir"]
37
38 cmd = "snac follow %s %s %s" % (basedir, uid, actor)
39 39
40 os.system(cmd) 40 os.system(cmd)
41 41