From ac68f4a540942306a9308468787054a9270479c8 Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Thu, 25 May 2023 19:06:07 +0200 Subject: [PATCH] docs --- README.md | 25 +++++++++++++----- packages/cli/README.md | 54 +++++++++++++++++++++++++++++++++++++++ packages/cli/src/index.ts | 4 ++- 3 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 packages/cli/README.md diff --git a/README.md b/README.md index 8dfca81..e3d8dfa 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ EN | [简体中文](README_zh-CN.md) ## About? -_cryptgeon_ is a secure, open source sharing note or file service inspired by [_PrivNote_](https://privnote.com) +_cryptgeon_ is a secure, open source sharing note or file service inspired by [_PrivNote_](https://privnote.com). +It includes a server, a web page and a CLI client. > 🌍 If you want to translate the project feel free to reach out to me. > @@ -26,10 +27,21 @@ _cryptgeon_ is a secure, open source sharing note or file service inspired by [_ ## Live Service / Demo +### Web + Check out the live service / demo and see for yourself [cryptgeon.org](https://cryptgeon.org) +### CLI + +``` +npx cryptgeon send text "This is a secret note" +``` + +For more documentation about the CLI see the [readme](./packages/cli/README.md). + ## Features +- send text or files - server cannot decrypt contents due to client side encryption - view or time constraints - in memory, no persistence @@ -121,14 +133,13 @@ There is a [guide](https://mariushosting.com/how-to-install-cryptgeon-on-your-sy **Requirements** - `pnpm`: `>=6` -- `node`: `>=16` +- `node`: `>=18` - `rust`: edition `2021` **Install** ```bash pnpm install -pnpm --prefix frontend install # Also you need cargo watch if you don't already have it installed. # https://lib.rs/crates/cargo-watch @@ -148,6 +159,7 @@ Running `pnpm run dev` in the root folder will start the following things: - redis docker container - rust backend - client +- cli You can see the app under [localhost:1234](http://localhost:1234). @@ -157,10 +169,7 @@ Tests are end to end tests written with Playwright. ```sh pnpm run test:prepare -docker compose up redis -d -pnpm run test:server -# In another terminal. # Use the test or test:local script. The local version only runs in one browser for quicker development. pnpm run test:local ``` @@ -169,7 +178,9 @@ pnpm run test:local Please refer to the security section [here](./SECURITY.md). -###### Attributions +--- + +_Attributions_ - Test data: - Text for tests [Nietzsche Ipsum](https://nietzsche-ipsum.com/) diff --git a/packages/cli/README.md b/packages/cli/README.md new file mode 100644 index 0000000..4af3a42 --- /dev/null +++ b/packages/cli/README.md @@ -0,0 +1,54 @@ +# Cryptgeon CLI + +The CLI is a functionally identical way to interact with cryptgeon notes. +It supports text, files, expiration, password, etc. + +## Installation + +```bash +npx cryptgeon + +# Or install globally +npm -g install cryptgeon +cryptgeon +``` + +## Examples + +```bash +# Create simple note +cryptgeon send text "Foo bar" + +# Send two files +cryptgeon send file my.pdf picture.png + +# 3 views +cryptgeon send text "My message" --views 3 + +# 10 minutes +cryptgeon send text "My message" --minutes 10 + +# Custom password +cryptgeon send text "My message" --password "1337" + +# Password from stdin +echo "1337" | cryptgeon send text "My message" + +# Open a link +cryptgeon open https://cryptgeon.org/note/16gOIkxWjCxYNuXM8tCqMUzl... +``` + +## Options + +### Custom server + +The default server is `cryptgeon.org`, however you can use any cryptgeon server by passing the `-s` or `--server` option, or by setting the `CRYPTGEON_SERVER` environment variable. + +### Password + +Optionally, just like in the web ui, you can choose to use a manual password. You can do that by passing the `-p` or `--password` options, or by piping it into stdin. + +```bash +echo "my pw" | cryptgeon send text "my text" +cat pass.txt | cryptgeon send text "my text" +``` diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index ee51e45..cf4ef00 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -42,6 +42,7 @@ program.name('cryptgeon').version(version).configureHelp({ showGlobalOptions: tr program .command('info') + .description('show information about the server') .addOption(server) .action(async (options) => { setBase(options.server) @@ -56,7 +57,7 @@ program console.table(formatted) }) -const send = program.command('send') +const send = program.command('send').description('send a note') send .command('file') .addArgument(files) @@ -86,6 +87,7 @@ send program .command('open') + .description('open a link with text or files inside') .addArgument(url) .addOption(password) .addOption(all)