## 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 the 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. For advices on building in containers, see [Build in container](#build-in-container) section. ### 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 --extra-experimental-features nix-command --extra-experimental-features flakes shell ``` After building (that took ~40min on 8-core machine) you'll have a shell with `4r` command available. ## Usage ``` > 4r --help Usage: 4r [-A|--no-ansi] [-c|--columns COLUMNS_NUMBER] (COMMAND | COMMAND | COMMAND) Available options: -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 -m 10` Example output: ``` > 4r ts -m 10 Переезжаю: @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 | 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 > Но в преформатированном блоке ничего рендериться не должно, это нужно исправить Попробую что-нибуть придумать ``` ## Build in container You can use [this docker image](https://hub.docker.com/r/nixos/nix) to run build without installing Nix. You can temporary switch your I2P HTTP Proxy to listen on `192.168.*.*` address to be able to reach it from container. If you did this, build one-liner becomes: ```bash git config --global http.http://git.community.i2p.proxy http://:4444 && \ git clone http://git.community.i2p/staticvoid/4r.git && cd 4r && \ nix --extra-experimental-features nix-command --extra-experimental-features flakes shell ```