9001 / copyparty

Portable file server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++ all in one file, no deps
MIT License
571 stars 34 forks source link

Who gets to [📟] send-msg? #68

Closed Gremious closed 9 months ago

Gremious commented 9 months ago

I go to copyparty and I have a [📟] send-msg button. I login as other users, and it is gone (good).

But I don't see much information about it, how come my account can do that, I don't necessarily remember configuring that.

Is there a permission flag or something I'm missing?

9001 commented 9 months ago

good catch -- yeah this isn't documented very well, partially because it doesn't really serve a purpose on its own.

the current intention of that feature is to be combined with a script which would be called when a "message" is sent, for example assuming the message is a URL and the script could then interact with that URL somehow. This can be done with --xm, and there are two examples in the repo, wget.py and msg-log.py (which i forgot to add to the hooks readme, nice)

another usecase (the original one) is to write each message to a textfile; this is documented in --help-urlform

since all of these are kind-of, sort-of related to writing, the feature is given to accounts with write-access.

Gremious commented 9 months ago

there are two examples in the repo, wget.py and msg-log.py (which i forgot to add to the hooks readme, nice)

wget.py is exactly what I was looking for, and why I stumbled upon this in the first place. Wow copyparty really does just have everything...

Awesome, thanks!

9001 commented 2 months ago

bit of an important correction to this -- it's true that the UI for sending a message disappeared when you were in a folder without write-access, but the server API would still happily accept messages (and run hooks) regardless, due to a conflict of interests at some point which I forgot about... Because there are valid usecases for both behaviors (allow messages both with/without write-access), this is now configurable per-hook as of v1.13.4. Documentation is a bit sparse since there's some more hooks-related features on the horizon, but CTRL-F hooks help page in here for more info: https://ocv.me/copyparty/helptext.html

in short, if you want to run wget.py for all users, no matter what permissions they have, then the following entry inside a volume's flags: section in the config file would do that: xm: f,j,t3600,~/bin/hooks/wget.py

but if you want to restrict it to users with write-access, then adding the aw flag will make it so: xm: f,j,aw,t3600,~/bin/hooks/wget.py

sorry for the misinformation on this!! should have actually checked to make sure before replying 😅 and since this was unintuitive enough to even confuse myself, I'll @everyone about it on the discord just in case anyone else made the same assumption.