lemonade-command / lemonade

Lemonade is a remote utility tool. (copy, paste and open browser) over TCP.
MIT License
627 stars 54 forks source link

Use HTTP instead of TCP and Go RPC #21

Open pocke opened 8 years ago

mattn commented 5 years ago

Do you mean JSON-RPC via HTTP?

pocke commented 5 years ago

Do you mean JSON-RPC via HTTP?

No, I'd like to remove RPC, and introduce HTTP API such as REST. I was thinking to use curl instead of lemonade client by this change. https://twitter.com/p_ck_/status/790797713348583424

But I'm not sure it is the best design.

hanxi commented 5 years ago

I want client like this.

#content with urlEncode
curl http://127.0.0.1:2489/copy?content=%e6%88%91%e6%98%af%e7%b2%98%e8%b4%b4%e6%9d%bf&line-ending=CRLF
curl http://127.0.0.1:2489/paste?line-ending=CRLF
#url with urlEncode
curl http://127.0.0.1:2489/open?url=https%3a%2f%2fgithub.com%2flemonade-command%2flemonade
hanxi commented 5 years ago

Only use HTTP GET. also can use nc command to send HTTP GET request.

mattn commented 5 years ago

I prefer use POST for copy.

hanxi commented 5 years ago

I agree use POST. that rest.

hanxi commented 5 years ago
curl -X POST --data "this is raw data" http://127.0.0.1:2489/copy?line-ending=CRLF
hanxi commented 5 years ago

I test server REST API use curl is ok, I'll write a client.

https://github.com/hanxi/lemonade/commit/cee32d58855d3db03bda0f8d68402bf549699aad

hanxi commented 5 years ago

I release this feature in https://github.com/hanxi/lemonade/releases/tag/v2.0.0-pre

zhoupro commented 2 years ago

At the start, I want to use it for a while. quit last. Becase so simple, I rewrite one in roperate。 And add get host clip image。