arcuru / pokem

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

[Feature Request]: Allow using the room alias as the "target" #4

Closed arcuru closed 3 months ago

arcuru commented 4 months ago

We're not exactly pretending to be private, so it should be fine if we allow referencing the room by the room address instead of only using the internal room ID. e.g. pokem #pokem-example:jackson.dev Hello!

Hadn't gotten around to thinking about the usability much yet.

arcuru commented 4 months ago

This isn't too difficult to implement, I already have a rough working version locally, the problem is that I want to be careful with the UX. The pokem CLI is fine obviously, you can just run the example above, but the issue shows up in sending HTTP requests.

A '#' is a special character and using that directly in the URL doesn't send the info after it. So if somebody ran curl pokem.jackson.dev/#pokem-example:jackson.dev -d "hi" the request would not include the room info. It has to be URI encoded as %23.

So the working curl command would be:

curl pokem.jackson.dev/%23pokem-example:jackson.dev -d "hi"

That's an annoying usability quirk.

The reason why https://matrix.to can create links using that is because they embed javascript in the webpage. I can do that for the Web UI however that would mean you could use a link with the '#' but not a curl request. Which is awkward

Just dropping the '#' from the requirements is possible, which is what I'm leaning towards. You can poke a room via it's alias with "pokem.jackson.dev/roomname:server.com" or you can poke an internal room ID with "!InternalId:server.com".

While implementing I also though about poking a User as the target, which without the leading character looks exactly like a room alias. I've decided that poking a User is not a good idea. Fundamentally we are sending messages to Rooms, if we were to poke a User it would mean we'd need to figure out which room makes sense to send the poke in. That makes things awkward from the user side, and it would open up too many more opportunities for abuse.

TL;DR - I think this is a good idea, but we just won't use the # in any examples, and will be as permissive as possible when receiving data from the user. We'll accept both pokem-example:jackson.dev and %23pokem-example:jackson.dev. The CLI will accept the # and either of those as well. The WebUI will accept "https://pokem.jackson.dev/#pokem-example:jackson.dev" using javascript, but I won't use it in any examples and it will display a warning if there is a # used.