Skip to content

tuzig/terminal7

Repository files navigation

Terminal7 - A touchable terminal multiplexer running over WebRTC

Screen Shot 2022-01-06 at 22 31 04

Tests License Platform Languages Closed Issue Open Issues

Terminal7 is a terminal that includes a terminal multiplexer made for modern web clients and real time communications over WebRTC. A reincaranation of tmux and screen, Terminal7 is a hybrid app that designed for smart clients.

The code here is in vanilla TypeSctipt, relying chiefly on the following projects:

  • CapacitorJS for app packaging & plugins
  • Xterm.js for terminal emulation
  • noble-ed25519 for key generation
  • pion.ly for the WebRTC backend
  • Vite for packaging
  • Vitest for testing
  • Docker compose for acceptance tests
  • Playwright for end-to-end tests
  • MailHog for an SMRP test double

For networking we use SSH or WebRTC, the web standard for real time communications. WebRTC is UDP based with wide support and a great implmentation in go - pion/webrtc - that we use as a base for our server's agent.

If you're having problems with your first connection, please refer to our troubleshooting guide.

We welcome new contributors and are happy to help, talk to us on our discord server.

Getting Started

You can get Terminal7 for free from the App Store or Google Play.

To run from source, you should start by forking the repo (or using tuzig/terminal7 if you just want to test), cloning it and from it's root run:

yarn install
yarn test
yarn start

then point your browser at the printed URL, usually http://localhost:5173.

Installing the server

To connect from the browser you'll need the webexec agent running. webexec is an open source WebRTC server written in go and based on pion. Terminal7 should offer to install it for you, but if it doesn't, open TWR and run install to ensure your agent is up.

If you that doesn't work you can install webexec using go:

go install github.com/tuzig/webexec@latest
webexec start

If you don't have go, you can use our line installer to download the binary for your system and start it:

  bash <(curl -sL https://get.webexec.sh)

webexec will start an HTTP WHIP server on port 7777, waiting for the client to connect. If pperbook user is set, webexec will also connect to peerbook.io so it can accept connections even when behind-the-NAT.

webexec's CLI has a growing set of commands, use webexec to get help on the current set.

Clipboard integration

Terminal7 has a clipboard integration that works over WebRTC. From the CLI you can:

  • webexec copy < FILE to get the file into the client's clipboard
  • webexec paste to print rhe client's clipboard to stdout

If no peer are actives, e.g. you're using a classic terminal, webexec will look for the tools:

  • pbcopy, pbpaste on MacOS
  • xclip, xsel on Linux

neovim integration will let you use use the + and * named buffer to copy to and from the clipboard. Just 12 lines in your init.lua:

    vim.g.clipboard = {
        name = 'webexec',
        copy = {
            ["+"] = {'webexec', 'copy'},
            ["*"] = {'webexec', 'copy'},
        },
        paste = {
            ["+"] = {'webexec', 'paste'},
            ["*"] = {'webexec', 'paste'},
        },
        cache_enabled = true,
    }

When webexec is not install, neovim will try the default clipboard tools like xclip or pbcopy.

Running the acceptance tests

TL;DR: run docker and ./aatp/run

Terminal7 has a suite of acceptance tests that run over a docker compose virtual lab. They include end-to-end tests and run on PRs to ensure the code is solid. To learn more about the tests, please refer to ./aatp/README.md documentation.