Add README

main
staticvoid 2022-06-27 22:10:55 +03:00
parent bfd3ad7535
commit 4f468cc80d
1 changed files with 97 additions and 0 deletions

97
README.md 100644
View File

@ -0,0 +1,97 @@
## Features
- As on 27.06.22, all 3 (read-only) API endoints are available
- Username coloring: `4r` calculates hash of a username, takes 1st byte and uses it to color a username
- Markdown rendering
- Override location of your I2P router with `I2P_HTTP_PROXY` env variable.
## Future features
- Wrap lines and prepend corresponding prefix (like `> `) to each line.
- Configure access to 4rum without proxy.
- Posting/post editing and topic creation (kind of blocked by API itself).
- Debug flag
- Cache messages and allow offline-only reading (low-priority).
## Build
You need [Nix](https://nixos.org/download.html) installed to build this project.
You can use [this docker image](https://hub.docker.com/r/nixos/nix) to run build without installing Nix.
### Full build one-liner
```bash
git config --global http.http://git.community.i2p.proxy http://127.0.0.1:4444 && \
git clone http://git.community.i2p/staticvoid/4r.git && cd 4r && \
nix shell
```
After building (that took ~40min on 8-core machine) you'll have a shell with `4r` command available.
## Usage
```
> 4r --help
Usage: 4r [-N|--offline] [-A|--no-ansi] [-c|--columns COLUMNS_NUMBER]
(COMMAND | COMMAND | COMMAND)
Available options:
-N,--offline only access cache
-A,--no-ansi disable ANSI codes
-c,--columns COLUMNS_NUMBER
number of columns
-h,--help Show this help text
Available commands:
ss Request list of sections
ts Request list of topics
t Request a topic
```
Usual workflow:
- Print 10 last updated topics: `4r ts | head -20`
Example output:
```
> 4r ts | head -20
Переезжаю: @abzyk at 2022-06-27 21:01:10 #31
Пожелания: @nick at 2022-06-27 20:43:34 #20
Хочу уйти от цивилизации: @NoName at 2022-06-27 20:28:27 #44
Глупые вопросы: @nenet at 2022-06-27 20:04:00 #53
Vipnet Инфотекс: @asics at 2022-06-27 17:23:23 #52
4rum api: @Carvet at 2022-06-27 14:34:49 #41
Создание полностью анонимного чата.: @staticvoid at 2022-06-27 11:33:03 #51
Устройство p2p чата: @Carvet at 2022-06-27 10:02:13 #49
Markdown: @Carvet at 2022-06-26 19:44:12 #35
Всё дрянь, надо делать новый нормальный язык.: @NoName at 2022-06-26 19:33:30 #47
```
- View all posts (in chronological order) from a topic: `4r t <TOPIC_ID> | less -r`.
`-r` flag is needed if you use `less` because `4r` makes use of `ANSI` escape sequences to format output.
You can use `-A` flag to disable them (only strikethrough text will stay).
Example output:
```
> 4r t 35 | tail -10
Carvet 2022-06-26 17:12:23 #870
Нет, всё гораздо тупее, разбивается по разделителю {}, если нечётное количество то вставляются блоки. И да вложенность в таком случае работать не будет. Текущий md парсер не умеет работать со сложными блоками двойной вложенности, а научить его этому сходу довольно сложно.
staticvoid 2022-06-26 17:44:10 #872
Ну, вложенность - это ещё пусть, зачем вложенные спойлеры мне не понятно. Но в преформатированном блоке ничего рендериться не должно, это нужно исправить
Carvet 2022-06-26 19:44:12 #880
> Но в преформатированном блоке ничего рендериться не должно, это нужно исправить
Попробую что-нибуть придумать
```