arcuru / pokem

A notification helper for Matrix.
MIT License
27 stars 0 forks source link

Use HTTP headers for custom options #5

Closed koehn closed 3 months ago

koehn commented 3 months ago

Pokem is really handy. Thanks for building it!

It would be really nice if you could use HTTP headers for accessing various message options:

# markdown (or code)
curl --fail -d ‘This message **matters**’ -H ‘Format: markdown’ $URL

# file
curl --fail -d @filename.csv -H ‘Format: file’ $URL

# authentication
curl --fail -d ‘some content’ -H ‘Authentication: password123’ $URL

This, I think, is an improvement over putting the password into the URL, and allows you to extend the supported options in a forward-compatible way (e.g., you could add headers for text/notice/emote in later versions).

arcuru commented 3 months ago

Thanks! That is definitely better!

I'll add that the next time I have time, shouldn't be too much work.

The Format key is also something I had been thinking about, so I'll add that as well

arcuru commented 3 months ago

I've added both Format and Authentication as options into the HTTP headers, as well as added the Format defaults to the config file as well.

I do want to add the "file" formatting you suggested too, that would send actual files with the notification, but I haven't figured out the right incantation to use yet with the sdk I'm using. I'm going to open a separate issue for that