wizzomafizzo / tapto

Launch games using physical objects
GNU General Public License v3.0
64 stars 9 forks source link

http.post can conflict with command chain separator #27

Closed wizzomafizzo closed 3 months ago

wizzomafizzo commented 4 months ago

Whoops. It's a valid http.post command that has no data, for example: **http.post:http://asdf.com|stuff|

If you change this with another command after, I think the parser will get confused: **http.post:http://asdf.com|stuff|||menu.rbf

Will need to do something smarter than "split on ||" to fix this edge case

sigboe commented 4 months ago

In Taptui, I can do a replace of | with %7C

wizzomafizzo commented 4 months ago

@sigboe now that we spoke about this i wonder if it's better to just change it from a pipe. Like come up with a standard argument separator for all commands like "," and make people url encode if there's a conflict

sigboe commented 4 months ago

@wizzomafizzo I don't know if it helps at all changing the separator

json

I have a work in progress implementation

Currently working, only json, since I use jq to render the text into a computer readable output (so it fits in the command properly). If we don't do that, then the user has to write everything in one line without spaces

What other data types should we support?

I was about to say that vim and nano didn't work yet also, but I fixed that before I finished writing the comment

I also need to implement a check if there are two pipes in the post data.

I also need to do some error handling

sigboe commented 4 months ago

hmm, I don't think xmlstarlet is installed on mister... maybe we only support json? and let other content types be an exercise for the user?

Do you have any suggestions for content types, to think about?

maybe reading files, I can use the filepicker to read files.

What about sending the contents of the file that stores Arcade highscores?

for content type I can switch it out to a menu, to have multiple choice instead of a text input field

sigboe commented 4 months ago

Also json templates. do we want them? It is just a SMOP (small matter of programming) to implement them

wizzomafizzo commented 4 months ago

It doesn't help what you're doing to change the separator no, the problem still exists the data needs to be url encoded if it conflicts with any of the syntax of the token commands

What it does do is makes it so , is used as an argument separator in all commands and keeps it consistent. And it fixes the issues of an empty third argument in the http.post command breaking the || chain command parsing

The only other content type I would worry about is application/x-www-form-urlencoded. Don't sweat it on the xml stuff, imo that's quite rare

What do you have in mind for the arcade high scores?

sigboe commented 3 months ago

More or less finished gui for this is in pr #34