commit 706816b
grunfink
·
2025-05-30 17:43:55 +0000 UTC
parent f055c8b
Added uid, basedir and baseurl to the notify webhook message.
2 files changed,
+9,
-5
M
data.c
+4,
-0
1@@ -3534,6 +3534,10 @@ void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
2
3 /* add more data */
4 msg = xs_dict_set(msg, "target", user->actor);
5+ msg = xs_dict_set(msg, "uid", user->uid);
6+ msg = xs_dict_set(msg, "basedir", srv_basedir);
7+ msg = xs_dict_set(msg, "baseurl", srv_baseurl);
8+
9 xs *actor_obj = NULL;
10
11 if (valid_status(object_get(xs_dict_get(noti, "actor"), &actor_obj)) && actor_obj)
+5,
-5
1@@ -2,8 +2,7 @@
2
3 # This is an example of a snac webhook that automatically follows all new followers.
4
5-# To use it, set the variables snac_basedir and snac_user to something reasonable,
6-# configure the user webhook to be http://localhost:12345, and run this program.
7+# To use it, configure the user webhook to be http://localhost:12345, and run this program.
8
9 # copyright (C) 2025 grunfink et al. / MIT license
10
11@@ -14,8 +13,6 @@ import os
12
13 host_name = "localhost"
14 server_port = 12345
15-snac_basedir = "/var/snac/example_instance"
16-snac_user = "example_user"
17
18 class SnacAutoResponderServer(BaseHTTPRequestHandler):
19
20@@ -35,7 +32,10 @@ class SnacAutoResponderServer(BaseHTTPRequestHandler):
21
22 if type == "Follow":
23 actor = noti["actor"]
24- cmd = "snac follow %s %s %s" % (snac_basedir, snac_user, actor)
25+ uid = noti["uid"]
26+ basedir = noti["basedir"]
27+
28+ cmd = "snac follow %s %s %s" % (basedir, uid, actor)
29
30 os.system(cmd)
31