Skip to content

Commit

Permalink
doc: more guides for end users
Browse files Browse the repository at this point in the history
  • Loading branch information
unrenamed committed Jul 21, 2024
1 parent 50e43a8 commit da03465
Showing 1 changed file with 59 additions and 3 deletions.
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

🚧 Work in Progress! 🚧

SSH chat server written in Rust 🦀 for real-time communication, providing encrypted messaging over SSH.
An implementation of an SSH server for real-time communication that
serves a chat room instead of a shell and provides encrypted messaging over
SSH.

### Acknowledgements

Expand All @@ -34,12 +36,14 @@ This project was greatly influenced by [shazow/ssh-chat](https://github.com/shaz
### Quick start

```console
SSH Chat: Real-time communication over SSH
chatd is an implementation of an SSH server for real-time communication that
serves a chat room instead of a shell and provides encrypted messaging over
SSH.

Usage: chatd [OPTIONS]

Options:
--port <PORT> Port to listen on [default: 2222]
--port <PORT> Port to listen on [default: 22]
-i, --identity <KEY> Private key to identify server with. Defaults to a temporary ed25519 key
--oplist <FILE> Optional file of public keys who are operators
--whitelist <FILE> Optional file of public keys who are allowed to connect
Expand All @@ -49,3 +53,55 @@ Options:
-h, --help Print help
-V, --version Print version
```

### Environment Variables

Due to the lack of persistent storage for user configurations in chatd (which is intentional), users need to reapply their settings each time they connect. This can be quite inconvenient, don't you think?

Using <b>environment variables</b> can solve this problem.

#### `CHATD_THEME`

This variable lets you set the theme for your session. Instead of manually configuring it by running `/theme hacker`, you can do it like this:

```bash
$ ssh -o SetEnv "CHATD_THEME=hacker" username@host
```

#### `CHATD_TIMESTAMP`

This variable enables the logging of a datetime or time prefix next to each received message. Instead of running `/timestamp datetime` manually, you can set it like this before connecting:

```bash
$ ssh -o SetEnv "CHATD_TIMESTAMP=datetime" username@host
```

If you find setting extra options to `ssh` command tiresome, you can use a configuration file supported by your ssh client. For the OpenSSH client, there is `.ssh/config` file. If you don't have one, feel free to create and provide r-w access `chmod 600 .ssh/config`.

Now add the following lines to the config file:

```bash
Host host
SendEnv CHATD_*
```

Now, add the environment variables to your shell profile. Then, you can simply run:

```bash
$ ssh username@host
```

### Autocomplete

`chatd`'s autocomplete is designed to be intuitive and convenient for terminal users, recognizing whether you're completing a command, its subcommand, or their arguments.

For example:

<table>
<tr><td>[user] /opl</td><td>[user] /oplist</td></tr>
<tr><td>[user] /oplist l</td><td>[user] /oplist load</td></tr>
<tr><td>[user] /oplist load m</td><td>[user] /oplist load merge</td></tr>
<tr><td>[user] /oplist add al</td><td>[user] /oplist add alice</td></tr>
</table>

So, don't hesitate to press <kbd>Tab</kbd> whenever you want to save some typing 😉

0 comments on commit da03465

Please sign in to comment.