docs and configs update

This commit is contained in:
MeexReay 2025-02-12 14:31:57 +03:00
parent 3f163abb7c
commit 978fe2265e
6 changed files with 80 additions and 40 deletions

View File

@ -34,17 +34,20 @@ cargo build --release # build release (target/release/bRAC)
cargo run # run (builds and runs bRAC itself) cargo run # run (builds and runs bRAC itself)
``` ```
## config ## default config
```yml ```yml
host: meex.lol:11234 # server host host: meex.lol:11234 # server host
name: null # user name name: null # user name (null - ask every time)
message_format: 리㹰<{name}> {text} # message format message_format: 리㹰<{name}> {text} # message format
update_time: 50 # update chat interval update_time: 50 # update chat interval
max_messages: 100 # chat messages limit max_messages: 200 # chat messages limit
enable_ip_viewing: false # enable users' ip viewing
disable_ip_hiding: false # disable your ip hiding
enable_auth: false # enable auth-mode
``` ```
## command args ## command-line options
``` ```
-p, --config-path Print config path -p, --config-path Print config path
@ -58,23 +61,30 @@ max_messages: 100 # chat messages limit
-i, --disable-ip-hiding Disable ip hiding -i, --disable-ip-hiding Disable ip hiding
-v, --enable-users-ip-viewing Enable users IP viewing -v, --enable-users-ip-viewing Enable users IP viewing
-C, --configure Configure client -C, --configure Configure client
-a, --disable-auth Disable authentication -a, --enable-auth Enable authentication
-h, --help Print help -h, --help Print help
-V, --version Print version -V, --version Print version
``` ```
## commands ## cheat commands
`/help` - show help message \ commands are any messages that start with a slash `/` \
`/clear` - clear chat \ messages starting with a slash are sent to chat only if the `--disable-commands` option is specified
`/spam *args` - spam with text \
`/ping` - get server ping (send + read) - `/help` - show help message \
- `/clear` - clear chat \
- `/spam *args` - spam with text \
- `/ping` - get server ping (send + read)
## docs
- [Message formats](https://github.com/MeexReay/bRAC/blob/main/docs/message_formats.md)
- [Authenticated mode](https://github.com/MeexReay/bRAC/blob/main/docs/auth_mode.md)
## see also ## see also
- [RAC protocol (v2.0)](https://gitea.bedohswe.eu.org/pixtaded/crab#rac-protocol) - [RAC protocol (v2.0)](https://gitea.bedohswe.eu.org/pixtaded/crab#rac-protocol)
- [CRAB - client & server for RAC](https://gitea.bedohswe.eu.org/pixtaded/crab) - [CRAB - client & server for RAC](https://gitea.bedohswe.eu.org/pixtaded/crab)
- [Mefidroniy - client for RAC](https://github.com/OctoBanon-Main/mefedroniy-client) - [Mefidroniy - client for RAC](https://github.com/OctoBanon-Main/mefedroniy-client)
- [Colored usernames](https://github.com/MeexReay/bRAC/blob/main/docs/colored_usernames.md)
- [AlmatyD - server for RACv1.0](https://gitea.bedohswe.eu.org/bedohswe/almatyd) - [AlmatyD - server for RACv1.0](https://gitea.bedohswe.eu.org/bedohswe/almatyd)
- [RAC protocol (v1.0)](https://bedohswe.eu.org/text/rac/protocol.md.html) - [RAC protocol (v1.0)](https://bedohswe.eu.org/text/rac/protocol.md.html)

8
docs/auth_mode.md Normal file
View File

@ -0,0 +1,8 @@
# auth mode
## differences from the unauthorized mode
### message format
- there is must to be "> " after name ({name}> {text})
- if there is magic key (like 리㹰) then you must add "<" sign after it (not always)

View File

@ -1,25 +0,0 @@
# colored usernames
## bRAC
regex - `\uB9AC\u3E70<(.*?)> (.*)` \
color - green \
example - `리㹰<nick> text`
## CRAB
regex - `\u2550\u2550\u2550<(.*?)> (.*)` \
color - light red \
example - `═══<nick> text`
## Mefedroniy
regex - `(.*?): (.*)` \
color - light magenta \
example - `nick: text`
## clRAC
regex - `<(.*?)> (.*)` \
color - cyan \
example - `<nick> text`

47
docs/message_formats.md Normal file
View File

@ -0,0 +1,47 @@
# message formats
## types
### bRAC
this client
```yml
format: "리㹰<{name}> {text}"
regex: "\uB9AC\u3E70<(.*?)> (.*)"
color: "green"
```
### CRAB
[CRAB - client & server for RAC written in java](https://gitea.bedohswe.eu.org/pixtaded/crab)
```yml
format: "═══<{name}> {text}"
regex: "\u2550\u2550\u2550<(.*?)> (.*)"
color: "light red"
```
### Mefedroniy
[Mefidroniy - client for RAC written in rust](https://github.com/OctoBanon-Main/mefedroniy-client)
```yml
format: "°ʘ<{name}> {text}"
regex: "\u00B0\u0298<(.*?)> (.*)"
color: "light magenta"
```
### clRAC
official client
```yml
format: "<{name}> {text}"
regex: "<(.*?)> (.*)"
color: "cyan"
```
## developer notes
in auth-mode, there is must to be `> ` after name (`{name}> {text}`)

View File

@ -39,7 +39,7 @@ fn default_host() -> String { "meex.lol:11234".to_string() }
fn default_message_format() -> String { MESSAGE_FORMAT.to_string() } fn default_message_format() -> String { MESSAGE_FORMAT.to_string() }
fn ask_usize(name: impl ToString, default: usize) -> usize { fn ask_usize(name: impl ToString, default: usize) -> usize {
get_input(format!("{} (default: {}) > ", name.to_string(), default).bright_yellow()) get_input(format!("{} (default: {}) {} ", name.to_string().bold(), default, ">".bold()).bright_yellow())
.and_then(|o| o.parse().ok()).unwrap_or(default) .and_then(|o| o.parse().ok()).unwrap_or(default)
} }
@ -49,11 +49,11 @@ fn ask_string(name: impl ToString, default: impl ToString + Clone) -> String {
fn ask_string_option(name: impl ToString, default: impl ToString) -> Option<String> { fn ask_string_option(name: impl ToString, default: impl ToString) -> Option<String> {
let default = default.to_string(); let default = default.to_string();
get_input(format!("{} (default: {}) > ", name.to_string(), default).bright_yellow()) get_input(format!("{} (default: {}) {} ", name.to_string().bold(), default, ">".bold()).bright_yellow())
} }
fn ask_bool(name: impl ToString, default: bool) -> bool { fn ask_bool(name: impl ToString, default: bool) -> bool {
get_input(format!("{} (Y/N, default: {}) > ", name.to_string(), if default { "Y" } else { "N" }).bright_yellow()) get_input(format!("{} (Y/N, default: {}) {} ", name.to_string().bold(), if default { "Y" } else { "N" }, ">".bold()).bright_yellow())
.map(|o| o.to_lowercase() != "n") .map(|o| o.to_lowercase() != "n")
.unwrap_or(default) .unwrap_or(default)
} }

View File

@ -1,4 +1,4 @@
use std::{error::Error, io::{Read, Write}, net::{Shutdown, TcpStream}}; use std::{error::Error, io::{Read, Write}, net::TcpStream};