mirror of
https://oauth2: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@github.com/m1ngsama/TNT.git
synced 2026-05-10 19:00:57 +08:00
docs: update all docs for :last, :search, :mute-joins and MOTD
- README: add new commands to COMMAND mode table, MOTD section, update Known Limitations (100-msg limit now softened by :last/:search) - tnt.1: add :last/:search/:mute-joins to man page command table, add motd.txt to FILES section - CHANGELOG: add 2026-04-23 entry - QUICKREF: rewrite command section, add new commands, add motd.txt to files - ROADMAP: mark Stage 4 :last/:search/:mute-joins items as completed - DEPLOYMENT: add MOTD setup section
This commit is contained in:
parent
ed5fc43cbd
commit
eead27544c
6 changed files with 86 additions and 15 deletions
20
README.md
20
README.md
|
|
@ -82,6 +82,9 @@ Ctrl+C - Exit chat
|
||||||
:nick <name> - Change nickname
|
:nick <name> - Change nickname
|
||||||
:msg <user> <text> - Whisper to user
|
:msg <user> <text> - Whisper to user
|
||||||
:w <user> <text> - Short alias for :msg
|
:w <user> <text> - Short alias for :msg
|
||||||
|
:last [N] - Show last N messages from history (max 50, default 10)
|
||||||
|
:search <keyword> - Search full message history (case-insensitive)
|
||||||
|
:mute-joins - Toggle join/leave system notifications
|
||||||
:help - Show available commands
|
:help - Show available commands
|
||||||
:clear - Clear command output
|
:clear - Clear command output
|
||||||
:q, :quit, :exit - Disconnect
|
:q, :quit, :exit - Disconnect
|
||||||
|
|
@ -276,9 +279,24 @@ See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for details.
|
||||||
```
|
```
|
||||||
messages.log - Chat history (RFC3339 format)
|
messages.log - Chat history (RFC3339 format)
|
||||||
host_key - SSH host key (auto-generated, 4096-bit RSA)
|
host_key - SSH host key (auto-generated, 4096-bit RSA)
|
||||||
|
motd.txt - Message of the Day (optional, shown to users on connect)
|
||||||
tnt.service - systemd service unit
|
tnt.service - systemd service unit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### MOTD (Message of the Day)
|
||||||
|
|
||||||
|
Place a `motd.txt` file in the state directory to show a welcome message to every user on connect. Users see the MOTD before entering the chat and press any key to continue.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Example (assuming default state dir)
|
||||||
|
cat > motd.txt <<'EOF'
|
||||||
|
Welcome to the chat server!
|
||||||
|
Be respectful. No spam.
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
Delete `motd.txt` to disable the MOTD.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- [Development Guide](https://github.com/m1ngsama/TNT/wiki/Development-Guide) - Complete development manual
|
- [Development Guide](https://github.com/m1ngsama/TNT/wiki/Development-Guide) - Complete development manual
|
||||||
|
|
@ -300,7 +318,7 @@ tnt.service - systemd service unit
|
||||||
## Known Limitations
|
## Known Limitations
|
||||||
|
|
||||||
- Single chat room (no multi-room support yet)
|
- Single chat room (no multi-room support yet)
|
||||||
- Keeps only last 100 messages in memory
|
- TUI displays at most 100 messages at once; use `:last N` or `:search` to access older history from disk
|
||||||
- Ctrl+W only recognizes ASCII space as word boundary
|
- Ctrl+W only recognizes ASCII space as word boundary
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-04-23 - Chat UX Commands and MOTD
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **`:last [N]`** — show last N messages retrieved directly from the log file (1–50, default 10), bypassing the 100-message in-memory ring buffer limit
|
||||||
|
- **`:search <keyword>`** — case-insensitive full-text search across the entire message history on disk; returns the most recent 15 matches
|
||||||
|
- **`:mute-joins`** — per-client toggle to silence join/leave system notifications; title bar shows `[静音]` when active
|
||||||
|
- **MOTD support** — place `motd.txt` in the state directory; users see it on connect and press any key to enter chat
|
||||||
|
- **`message_search()`** — new function in `message.c` / `message.h` for log file keyword search with rolling result collection
|
||||||
|
- Updated in-TUI help screens (English and Chinese) with new commands
|
||||||
|
|
||||||
## 2026-03-10 - SSH Runtime & Unix Interface Update
|
## 2026-03-10 - SSH Runtime & Unix Interface Update
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,24 @@ Recommended interpretation:
|
||||||
- `TNT_MAX_CONN_RATE_PER_IP`: new connection attempts allowed per IP per 60 seconds
|
- `TNT_MAX_CONN_RATE_PER_IP`: new connection attempts allowed per IP per 60 seconds
|
||||||
- `TNT_RATE_LIMIT=0`: disables rate-based blocking and auth-failure IP blocking, but not the explicit capacity limits
|
- `TNT_RATE_LIMIT=0`: disables rate-based blocking and auth-failure IP blocking, but not the explicit capacity limits
|
||||||
|
|
||||||
|
## MOTD (Message of the Day)
|
||||||
|
|
||||||
|
Place a `motd.txt` file in the state directory. TNT displays it to each user on connect; they press any key to enter the chat.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Systemd deployment (state dir is /var/lib/tnt)
|
||||||
|
sudo tee /var/lib/tnt/motd.txt <<'EOF'
|
||||||
|
Welcome! Be respectful. No spam.
|
||||||
|
Type :help for available commands.
|
||||||
|
EOF
|
||||||
|
sudo chown tnt:tnt /var/lib/tnt/motd.txt
|
||||||
|
|
||||||
|
# Remove to disable
|
||||||
|
sudo rm /var/lib/tnt/motd.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
No restart required — TNT reads the file on each new connection.
|
||||||
|
|
||||||
## Firewall
|
## Firewall
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -17,21 +17,37 @@ DEBUG
|
||||||
valgrind --leak-check=full ./tnt
|
valgrind --leak-check=full ./tnt
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
COMMANDS (COMMAND mode, prefix with :)
|
||||||
|
list, users, who show online users
|
||||||
|
nick <name> change nickname
|
||||||
|
msg <user> <text> whisper to user
|
||||||
|
w <user> <text> alias for msg
|
||||||
|
last [N] last N messages from log (default 10, max 50)
|
||||||
|
search <keyword> search full history (case-insensitive, 15 results)
|
||||||
|
mute-joins toggle join/leave notifications
|
||||||
|
help show all commands
|
||||||
|
clear clear output
|
||||||
|
q / quit / exit disconnect
|
||||||
|
|
||||||
|
INSERT MODE
|
||||||
|
/me <action> action message
|
||||||
|
@username mention (bell + highlight)
|
||||||
|
|
||||||
STRUCTURE
|
STRUCTURE
|
||||||
src/main.c entry, signals
|
src/main.c entry, signals
|
||||||
src/ssh_server.c SSH, threads
|
src/ssh_server.c SSH, threads, commands
|
||||||
src/chat_room.c broadcast
|
src/chat_room.c broadcast
|
||||||
src/message.c persistence
|
src/message.c persistence, search
|
||||||
src/tui.c rendering
|
src/tui.c rendering, help
|
||||||
src/utf8.c unicode
|
src/utf8.c unicode
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
64 clients max
|
64 clients max (configurable)
|
||||||
100 messages in RAM
|
100 messages in RAM; unlimited on disk
|
||||||
1024 bytes/message
|
1024 bytes/message
|
||||||
|
|
||||||
FILES
|
FILES
|
||||||
HACKING dev guide
|
messages.log chat log (RFC3339)
|
||||||
CHANGELOG.md changes
|
host_key SSH key (auto-generated)
|
||||||
messages.log chat log
|
motd.txt message of the day (optional)
|
||||||
host_key SSH key
|
CHANGELOG.md version history
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,11 @@ Goal: keep the interface efficient for terminal users without sacrificing simpli
|
||||||
- keep the current modal editing model, but make its behavior precise and documented
|
- keep the current modal editing model, but make its behavior precise and documented
|
||||||
- support resize, cursor movement, command history, and predictable paste behavior
|
- support resize, cursor movement, command history, and predictable paste behavior
|
||||||
- add useful chat commands with clear semantics:
|
- add useful chat commands with clear semantics:
|
||||||
- `/nick`
|
- ✅ `:nick` / `:name` — nickname change with broadcast
|
||||||
- `/me`
|
- ✅ `/me` — action messages
|
||||||
- `/last N`
|
- ✅ `:last N` — show last N messages from disk history
|
||||||
- `/search`
|
- ✅ `:search <keyword>` — case-insensitive full-text search
|
||||||
- `/mute-joins`
|
- ✅ `:mute-joins` — per-client join/leave notification toggle
|
||||||
- improve discoverability of NORMAL and COMMAND mode actions
|
- improve discoverability of NORMAL and COMMAND mode actions
|
||||||
- make status lines and help output concise enough for small terminals
|
- make status lines and help output concise enough for small terminals
|
||||||
|
|
||||||
|
|
|
||||||
9
tnt.1
9
tnt.1
|
|
@ -107,6 +107,9 @@ l l.
|
||||||
:name \fIname\fR Alias for :nick
|
:name \fIname\fR Alias for :nick
|
||||||
:msg \fIuser text\fR Send private whisper
|
:msg \fIuser text\fR Send private whisper
|
||||||
:w \fIuser text\fR Short alias for :msg
|
:w \fIuser text\fR Short alias for :msg
|
||||||
|
:last [\fIN\fR] Show last N messages from history (1\-50, default 10)
|
||||||
|
:search \fIkeyword\fR Case\-insensitive search across full message history
|
||||||
|
:mute\-joins Toggle join/leave system notifications on/off
|
||||||
:help Show available commands
|
:help Show available commands
|
||||||
:clear Clear command output
|
:clear Clear command output
|
||||||
:q, :quit, :exit Disconnect
|
:q, :quit, :exit Disconnect
|
||||||
|
|
@ -167,6 +170,12 @@ Stored in the state directory.
|
||||||
.I host_key
|
.I host_key
|
||||||
RSA 4096\-bit host key, auto\-generated on first run.
|
RSA 4096\-bit host key, auto\-generated on first run.
|
||||||
Stored in the state directory with mode 0600.
|
Stored in the state directory with mode 0600.
|
||||||
|
.TP
|
||||||
|
.I motd.txt
|
||||||
|
Optional Message of the Day.
|
||||||
|
When present in the state directory, its contents are shown to each user
|
||||||
|
immediately on connect before the chat screen appears.
|
||||||
|
Delete the file to disable the MOTD.
|
||||||
.SH SYSTEMD
|
.SH SYSTEMD
|
||||||
A unit file
|
A unit file
|
||||||
.I tnt.service
|
.I tnt.service
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue