Giter VIP home page Giter VIP logo

lemonade's Introduction

Lemonade

remote...lemote...lemode......Lemonade!!! 🍋 🍋

Lemonade is a remote utility tool. (copy, paste and open browser) over TCP.

Build Status

Maintainers wanted

See #25

Installation

go get -d github.com/lemonade-command/lemonade
cd $GOPATH/src/github.com/lemonade-command/lemonade/
make install

Or download from latest release

Example of use

Example

For example, you use a Linux as a virtual machine on Windows host. You connect to Linux by SSH client(e.g. PuTTY). When you want to copy text of a file on Linux to Windows, what do you do? One solution is doing cat file.txt and drag displayed text. But this answer is NOT elegant! Because your hand leaves from the keyboard to use the mouse.

Another solution is using the Lemonade. You input cat file.txt | lemonade copy. Then, lemonade copies text of the file to clipboard of the Windows!

In addition to the above, lemonade supports pasting and opening URL.

Usage

Usage: lemonade [options]... SUB_COMMAND [arg]
Sub Commands:
  open [URL]                  Open URL by browser
  copy [text]                 Copy text.
  paste                       Paste text.
  server                      Start lemonade server.

Options:
  --port=2489                 TCP port number
  --line-ending               Convert Line Ending(CR/CRLF)
  --allow="0.0.0.0/0,::/0"    Allow IP Range                [Server only]
  --host="localhost"          Destination hostname          [Client only]
  --no-fallback-messages      Do not show fallback messages [Client only]
  --trans-loopback=true       Translate loopback address    [open subcommand only]
  --trans-localfile=true      Translate local file path     [open subcommand only]
  --help                      Show this message

On server (in the above, Windows)

$ lemonade server

Client (in the above, Linux)

# You want to copy a text
$ cat file.txt | lemonade copy

# You want to paste a text from the clipboard of Windows
$ lemonade paste

# You want to open an URL to a browser on Windows.
$ lemonade open 'http://google.com'

Configuration

You can override command line options by configuration file. There is configuration file at ~/.config/lemonade.toml.

Server

port = 1234
allow = '192.168.0.0/24'
line-ending = 'crlf'
  • port is a listening port of TCP.
  • allow is a comma separated list of a allowed IP address(with CIDR block).

Client

port = 1234
host = '192.168.x.x'
trans-loopback = true
trans-localfile = true
line-ending = 'crlf'
  • port is a port of server.
  • host is a hostname of server.
  • trans-loopback is a flag of translation loopback address.
  • trans-localfile is a flag of translation localfile.

Detail of trans-loopback and trans-localfile are described Advanced Usage.

Advanced Usage

trans-loopback

Default: true

This option works with open command only.

If this option is true, lemonade translates loopback address to address of client.

For example, you input lemonade open 'http://127.0.0.1:8000'. If this option is false, server receives loopback address. But this isn't expected. Because, at server, loopback address is server itself.

If this option is true, server receives IP address of client. So, server can open URL!

trans-localfile

Default: true

This option works with open command only.

If this option is true, lemonade translates path of local file to address of client.

For example, you input lemonade open ./file.txt. If this option is false, server receives ./file.txt. But this isn't expected. Because, at server, ./file.txt doesn't exist.

If this option is true, server receives IP address of client. And client serve the local file. So, server can open the local file!

line-ending

Default: "" (NONE)

This options works with copy and paste command only.

If this option is lf or crlf, lemonade converts the line ending of text to the specified.

Alias

You can use lemonade as a xdg-open, pbcopy and pbpaste.

For example.

$ ln -s /path/to/lemonade /usr/bin/xdg-open
$ xdg-open  'http://example.com' # Same as lemonade open 'http://example.com'

Secure TCP Connection

Lemonade doesn't provide encryption and authorization. However we can use SSH Port forwarding for the purpose.

lemonade server

$ lemonade server -allow 127.0.0.1 &
$ ssh -R 2489:127.0.0.1:2489 user@host

See:

Links

lemonade's People

Contributors

jsvisa avatar lambdalisue avatar magicmark avatar mattn avatar pocke avatar raa0121 avatar supersandro2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lemonade's Issues

[Feature Request] Support Multiple Server

I am currently using this amazing gadget, but I encountered a problem. I have 2 computers and I may use them at the same time, but I can only enjoy the convinence at one of the two machines. I do not know GO so I can not figure out a solution.

Unable to handle utf-8

It seems that lemonade cannot handle utf-8 in and out of the clipboard. At least on MacOS.

As long as lemonade is used for both directions it seems OK, but using pbcopy or the system 'Copy' or 'Paste' in conjunction does not work

image

OS data according to screenfetch
OS: 64bit Mac OS X 10.12.6 16G29
Kernel: x86_64 Darwin 16.7.0

In binary

[fmmbp thm-dotfiles]$ echo 'Blåbærgrød' | pbcopy
[fmmbp thm-dotfiles]$ pbpaste | hexdump -C
00000000  42 6c c3 a5 62 c3 a6 72  67 72 c3 b8 64 0a        |Bl..b..rgr..d.|
0000000e
[fmmbp thm-dotfiles]$ lemonade paste | hexdump -C
00000000  42 6c 8c 62 be 72 67 72  bf 64 0a                 |Bl.b.rgr.d.|
0000000b
[fmmbp thm-dotfiles]$ echo 'Blåbærgrød' | hexdump -C
00000000  42 6c c3 a5 62 c3 a6 72  67 72 c3 b8 64 0a        |Bl..b..rgr..d.|
0000000e
[fmmbp thm-dotfiles]$ echo 'Blåbærgrød' | lemonade copy
[fmmbp thm-dotfiles]$ pbpaste | hexdump -C
00000000  42 6c e2 88 9a e2 80 a2  62 e2 88 9a c2 b6 72 67  |Bl......b.....rg|
00000010  72 e2 88 9a e2 88 8f 64  0a                       |r......d.|
00000019
[fmmbp thm-dotfiles]$ lemonade paste | hexdump -C
00000000  42 6c c3 a5 62 c3 a6 72  67 72 c3 b8 64 0a        |Bl..b..rgr..d.|
0000000e

Silently fails with `exit status 1`

Hi, I have just downloaded lemonade using the latest release tar. I am running a headless ubuntu server:

❯ which lemonade
/usr/local/bin/lemonade

Version:
v1.1.1

❯ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

I run the server with

lemonade server

(no output)

I then run

❯ echo "hi" | lemonade copy
exit status 1

The server emits:

❯ lemonade server
2021/03/18 08:29:14 Request from [::1]:39108

⌘v does not produce "hi". Thanks for your help!

Gets stuck at connection established

Everything seems to be working fine when I check the tcp connection at both the ends which says 'Established' but when I try to copy anything it doesn't work, it get's stuck there and doesn't even throw any errors.

Any help would be appreciated.
Thanks.

remove need for xsel/xclip for lemonade client

rationale:

when running a headless unix inside vagrant on a windows host, in other words, when you don't have xsel or xclip available because you don't have X server or client, I can't use lemonade.

xclip or xsel should not be needed because you have a direct connection to lemonade server via TCP.

Use the value of $SSH_CLIENT

Hi,

Great package, one thing I think you could do, which would make it work without configuration, is to use the $SSH_CLIENT environment variable, if it's populated, then get the IP address from there, otherwise use the rest of your logic.

OR

use what's in the config, then if that's empty use the SSH_CLIENT env

thoughts?

WOW! and security?

  1. This is freakin amazing, thank you!! Works flawlessly in both directions from linux -- mac in and outside of neovim. Thank you thank you thank you
  2. To experiment I did:
    cat somelinuxbinary | lemonade copy on linux
    and lemonade paste > somelinuxbinary on mac
    then file somelinuxbinary and it showed ELF 64bit binary (as you would expect)
    this scared the daylights out of me. How can lemonade be secured other than the network masking?

Add silent mode for client when there is no connection

Hi!
I use lemonade with tmux and I found when there is no connection (client shows message):

2017/12/04 04:07:32 dial tcp [::1]:2489: getsockopt: connection refused
2017/12/04 04:07:32 Fall back to localhost

Tmux in this time just stuck. As I can guess it's because lemonade doens't auto closes when there is error.
It would be great to add to client --silent mode. For current status will be useful to have command status lemonade status. So for example output of lemonade status I can put to tmux bar.

Support for Wayland?

Hi,
I'm using Linux (KDE Neon 22.04) on my desktop with Wayland and Debian Bullseye on my (headless) little Homeserver.
Sharing the Clipboard works MARVELOUS on a Xorg Session. Absolutely no Issues.

No such luck on Wayland tough. When I have lemonade server running on my Desktop, it'll still print lines, when trying to do something on the Client with the Clipboard, but there is no exchange between the boards.

I suppose lemonade is using xsel or xclip on the server side? This would explain why it ain't working with Wayland. Is there a way around that? Or am I overlooking something very obvious and just make a fool out of myself?

Thanks for any help.

(Ps: Thanks for your work! I really appreciate it!)

using lemonade as a zero-touch xclip alternative

Hi,

I've seen myself wanting to use lemonade as a drop-in replacement for xclip, which would permit me to use the "copy to clipboard" functionality of some software (e.g. the neat lazygit) without needing from these software to knowingly support lemonade copy interaction.

in other words, when trying to Copy to clipboard from such software (lazygit), it tries to find either xsel, xclip or wl-copy in my $PATH, which it cannot succeed to do.

that is, unless I use this small script that I put in /usr/bin/xclip:

#!/bin/bash

stdin="$([[ -p /dev/stdin ]] && cat -)"
lemonade copy $stdin

with that in place, I'm able to use the functionality!

this is not really an issue, rather a suggestion to maybe put this info in the docs?
also now that there is an issue for it, people looking for lemonade xclip replacement might find this answer more easily :)

Maintainers wanted

Currently I don't use lemonade. I used this tool for development in Virtual box, but I changed jobs, so I don't use Virtual box for development.

If you are interested in helping me maintain this library, please let me know.

Line endings

Should lemonade convert line endings? For example if you copy something on Windows host and lemonade paste it on Linux host, there are \r characters that are almost never needed.

getting networking errors

I ssh from mac to my linux machine, lemonade available on both, xecute lemonade server on mac, echo "lalala" | lemonade copy on linux. Nothing comes up on my mac keyboard.

Go get is no longer supported

README.md tells the user to run go get -d github.com/lemonade-command/lemonade for installation.

However, doing so give me:

$ go get -d github.com/lemonade-command/lemonade
go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

Re-Write README

現在のREADMEはとっつきづらい。
機能ごとの説明、目的の説明を重視したい。
網羅的な説明は最後の方に乗せる感じがいいと思う。

More verbose logging

I usually use Lemonade when I access Linux server through ssh on my Mac. For this, Lemonade works wonderfully. However, I have tried setting this up for a Mac server, and have run into issues.

I would first like to see more verbose logging to see what went wrong, as, all I see is:

EROR[01-28|01:41:01] dial tcp [::1]:2424: connect: connection refused
EROR[01-28|01:41:01] Falling back to localhost
exit status 1

(this is with port set to 2424, and using ssh -R 2489:127.0.0.1:2424 user@address).

The same thing occurs when I try to use the default port (2489) instead of 2424.

This is weird behavior as with the same instance of lemonade server running on my local Mac, I am able to use lemonade copy in all my Linux servers.

I was wondering if there is a verbose option to see problems that occur in more detail.

Thank you

Translate loopback address

If server receives http://127.0.0.1/hoge, translate to http://<client ip addr>/hoge

TODOs

  • Implement
  • Optional
  • Update readme => #8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.