diff options
| author | 2025-05-30 19:43:55 +0200 | |
|---|---|---|
| committer | 2025-05-30 19:43:55 +0200 | |
| commit | 706816b4321337d56ff3121186567363b882d01d (patch) | |
| tree | fd2791488024273af9795fe6399f507a78994439 /examples/auto_follower_webhook.py | |
| parent | Added a new server knob disable_notify_webhook. (diff) | |
| download | penes-snac2-706816b4321337d56ff3121186567363b882d01d.tar.gz penes-snac2-706816b4321337d56ff3121186567363b882d01d.tar.xz penes-snac2-706816b4321337d56ff3121186567363b882d01d.zip | |
Added uid, basedir and baseurl to the notify webhook message.
Diffstat (limited to '')
| -rwxr-xr-x | examples/auto_follower_webhook.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 | ||
| 15 | host_name = "localhost" | 14 | host_name = "localhost" |
| 16 | server_port = 12345 | 15 | server_port = 12345 |
| 17 | snac_basedir = "/var/snac/example_instance" | ||
| 18 | snac_user = "example_user" | ||
| 19 | 16 | ||
| 20 | class SnacAutoResponderServer(BaseHTTPRequestHandler): | 17 | class 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 | ||