mirror of
https://github.com/9001/copyparty.git
synced 2026-09-24 13:50:16 +01:00
hooks: retcode 100, zmq json;
hooks returning exitcode 0 will: * run the next hook, if any * allow the original action, unless successive hook opposes hooks returning exitcode 100 will: * abort running successive hooks * allow the original action hooks returning anything other than 0 or 100 will: * abort running successive hooks * REJECT the original action zmq can now respond with json; a dict with "rc", "rejectmsg", "reloc" and so on, just like other hooks replying with json
This commit is contained in:
@@ -4,6 +4,11 @@ these programs either take zero arguments, or a filepath (the affected file), or
|
||||
|
||||
run copyparty with `--help-hooks` for usage details / hook type explanations (xm/xbu/xau/xiu/xbc/xac/xbr/xar/xbd/xad/xban)
|
||||
|
||||
in particular, if a hook is loaded into copyparty with the hook-flag `c` ("check") then its exit-code controls the action that launched the hook:
|
||||
* exit-code `0` = allow the action, and/or continue running the next hook
|
||||
* exit-code `100` = allow the action, and stop running any remaining consecutive hooks
|
||||
* anything else = reject/prevent the original action, and don't run the remaining hooks
|
||||
|
||||
> **note:** in addition to event hooks (the stuff described here), copyparty has another api to run your programs/scripts while providing way more information such as audio tags / video codecs / etc and optionally daisychaining data between scripts in a processing pipeline; if that's what you want then see [mtp plugins](../mtag/) instead
|
||||
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ def rep_server():
|
||||
print("copyparty says %r" % (sck.recv_string(),))
|
||||
reply = b"thx"
|
||||
# reply = b"return 1" # non-zero to block an upload
|
||||
# reply = b'{"rc":1}' # or as json, that's fine too
|
||||
# reply = b'{"rejectmsg":"naw dude"}' # or custom message
|
||||
sck.send(reply)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user