Re:Show HN: Curl https://ec2.shop
by codetrotter on Tuesday June 30, 2020 @08:27AM
(#23689347)
> realised that it actually need to check the user-agent
Like someone suggested for the featured page as well, I recommend you make use of the accept header.
For example, assuming your interface is outputting freeform text (since the goal was to have something readable in terminal), you could use something like this:
Accept: text/vnd.myproject.tui+plain; version=1.0
(Substitute “myproject” with the actual name of your project.)Hey, yes it's 100% open source.
https://github.com/yeo/ec2.shop
The reason it check `curl` agent is because it share the same endpoint (root url) for both of `curl` page and browser version(the one with dropdown, grid etc)
I personally try looking into implementing a curl "interface" to one of my projects, realised that it actually need to check the user-agent (of curl and a plethora of curl alternatives) which I find kind of weird...