copyparty/bin/hooks
ed ed908b9868 usb-eject: support non-alphanumeric volume names
until now, volumes with whitespace and such would fail to unmount

also adds a sanchk that the directory to unmount is still below the
expected parent after absreal; the path was already passed to gio in
a safe manner (assuming gio doesn't have any vulns) but why risk it
2025-07-07 08:35:41 +00:00
..
discord-announce.py hooks: describe examples better 2024-07-13 01:32:26 +02:00
image-noexif.py new hook: exif stripper 2023-03-26 22:19:15 +00:00
into-the-cache-it-goes.py add hook side-effects; closes #86 2024-08-11 14:52:32 +00:00
msg-log.py hooks: describe examples better 2024-07-13 01:32:26 +02:00
notify.py hooks: more correct usage examples 2023-03-26 22:18:48 +00:00
notify2.py utcfromtimestamp was deprecated and nobody told me, 2023-10-20 23:41:58 +00:00
podcast-normalizer.py alias .oga to .ogg 2025-05-12 18:50:29 +02:00
qbittorrent-magnet.py change xm examples to reject users without write-access; #68 2024-07-25 19:23:08 +00:00
README.md new xau hook: podcast-normalizer.py 2025-04-09 19:44:13 +00:00
reject-extension.py hooks: more correct usage examples 2023-03-26 22:18:48 +00:00
reject-mimetype.py hooks: more correct usage examples 2023-03-26 22:18:48 +00:00
reloc-by-ext.py fix xbu/xau reloc collision-handling; 2025-05-14 15:45:52 +02:00
usb-eject.js usb-eject nitpicks 2025-03-02 23:51:35 +00:00
usb-eject.py usb-eject: support non-alphanumeric volume names 2025-07-07 08:35:41 +00:00
wget.py change xm examples to reject users without write-access; #68 2024-07-25 19:23:08 +00:00
xiu-sha.py utcfromtimestamp was deprecated and nobody told me, 2023-10-20 23:41:58 +00:00
xiu.py hooks: more correct usage examples 2023-03-26 22:18:48 +00:00

standalone programs which are executed by copyparty when an event happens (upload, file rename, delete, ...)

these programs either take zero arguments, or a filepath (the affected file), or a json message with filepath + additional info

run copyparty with --help-hooks for usage details / hook type explanations (xm/xbu/xau/xiu/xbc/xac/xbr/xar/xbd/xad/xban)

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 instead

after upload

upload batches

these are --xiu hooks; unlike xbu and xau (which get executed on every single file), xiu hooks are given a list of recent uploads on STDIN after the server has gone idle for N seconds, reducing server load + providing more context

  • xiu.py is a "minimal" example showing a list of filenames + total filesize
  • xiu-sha.py produces a sha512 checksum list in the volume root

before upload

on message

  • wget.py lets you download files by POSTing URLs to copyparty
  • qbittorrent-magnet.py starts downloading a torrent if you post a magnet url
  • usb-eject.py adds web-UI buttons to safe-remove usb flashdrives shared through copyparty
  • msg-log.py is a guestbook; logs messages to a doc in the same folder