@emaxe/tuigram 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +17 -0
- package/CHANGELOG.md +117 -0
- package/CHANGELOG.ru.md +119 -0
- package/README.md +527 -199
- package/README.ru.md +687 -0
- package/package.json +4 -1
- package/src/cli/init.js +2 -1
- package/src/config.js +125 -0
- package/src/telegram/client.js +15 -7
- package/src/telegram/socket.js +224 -0
package/README.md
CHANGED
|
@@ -1,78 +1,337 @@
|
|
|
1
1
|
# 🚀 TuiGram
|
|
2
2
|
|
|
3
|
+
**English** · [Русский](./README.ru.md)
|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@emaxe/tuigram)
|
|
4
6
|
[](https://nodejs.org)
|
|
5
7
|
[](./LICENSE)
|
|
8
|
+
[](https://www.npmjs.com/package/@emaxe/tuigram)
|
|
9
|
+
[](#-installation)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
A full-featured Telegram terminal client (TUI + CLI) for Node.js, built on the MTProto protocol (`teleproto`).
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
TuiGram lets you use Telegram entirely from the terminal: browse your dialog list split into categories, read conversations with formatting preserved (bold, italic, links, code highlighting), send messages, reply, edit, delete, react and send files.
|
|
10
14
|
|
|
11
15
|
```
|
|
12
16
|
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
13
|
-
│ 🚀 TuiGram │
|
|
14
|
-
│ 👥 Tech Chat [1420 уч.]
|
|
17
|
+
│ 🚀 TuiGram │ Alex Rivers (@alex_rivers) │ ● В сети │
|
|
18
|
+
│ 👥 Tech Chat [1420 уч.] ✍️ Sam печатает... │
|
|
15
19
|
├──────────────────────────────┬──────────────────────────────────────────────────────────────┤
|
|
16
|
-
│ [1:Все] [2:ЛС] [3:Группы]
|
|
20
|
+
│ [1:Все] [2:ЛС] [3:Группы] … │ ──────────────── Сегодня ──────────────── │
|
|
17
21
|
│ [/] Поиск чатов... │ │
|
|
18
|
-
│ 📌 👤
|
|
22
|
+
│ 📌 👤 Sam Lee · Let me know… │ Sam Lee [13:40] │
|
|
19
23
|
│ 👥 Tech Chat · Nice work! [3]│ Have you checked the latest release? │
|
|
20
|
-
│ 🤖
|
|
21
|
-
│ 📢 News Channel · Дайд… [12] │
|
|
24
|
+
│ 🤖 Deploy Bot · Done! 12:10│ │
|
|
25
|
+
│ 📢 News Channel · Дайд… [12] │ Sam Lee [13:41] │
|
|
26
|
+
│ 👤 Mia Novak · 📷 Фото 9:41 │ 📷 Фото · 1.8 MB │
|
|
27
|
+
│ 💾 Избранное · Ссылка вчр│ │
|
|
28
|
+
│ │ Вы [13:42] ✓✓ │
|
|
29
|
+
│ │ ┌─ Ответ на сообщение #1042 │
|
|
22
30
|
│ │ Yes, testing it right now! │
|
|
23
31
|
│ │ 👍 4 🔥 2 │
|
|
24
32
|
│ ├──────────────────────────────────────────────────────────────┤
|
|
25
|
-
│ │ ↩️ Ответ на [
|
|
26
|
-
│ │ Пишу ответ прямо здесь█
|
|
27
|
-
│ │ │
|
|
33
|
+
│ │ ↩️ Ответ на [Sam Lee]: "Have you checked…" [Esc] │
|
|
34
|
+
│ │ Пишу ответ прямо здесь█ │
|
|
28
35
|
├──────────────────────────────┴──────────────────────────────────────────────────────────────┤
|
|
29
|
-
│ [Tab] Панель │ [Enter] Отправить │ [1-6] Вкладки │ [F1] Помощь │ [Ctrl+
|
|
36
|
+
│ [Tab] Панель │ [Enter] Отправить │ [1-6] Вкладки │ [F1] Помощь │ [Ctrl+Q] Выход │
|
|
30
37
|
└─────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
31
38
|
```
|
|
32
39
|
|
|
40
|
+
> **Note on localization.** The TUI and CLI interface strings are currently in Russian only.
|
|
41
|
+
> The client itself works with any language of chat content. Localization of the UI is planned —
|
|
42
|
+
> see [CHANGELOG.md](./CHANGELOG.md).
|
|
43
|
+
|
|
33
44
|
---
|
|
34
45
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
- Ключи и сессия хранятся в пользовательских директориях ОС — пакет остаётся read-only и переживает обновления;
|
|
55
|
-
- Безопасное хранение сессии и ключей (`chmod 0600`).
|
|
46
|
+
## 📑 Table of contents
|
|
47
|
+
|
|
48
|
+
- [Features](#-features)
|
|
49
|
+
- [Screenshots](#-screenshots)
|
|
50
|
+
- [Installation](#-installation)
|
|
51
|
+
- [First run](#-first-run)
|
|
52
|
+
- [Where files are stored](#-where-files-are-stored)
|
|
53
|
+
- [Development](#-development)
|
|
54
|
+
- [Keyboard shortcuts](#️-keyboard-shortcuts)
|
|
55
|
+
- [Slash commands](#-slash-commands-in-the-input-box)
|
|
56
|
+
- [Sending files and images](#-sending-files-and-images)
|
|
57
|
+
- [Themes](#-themes)
|
|
58
|
+
- [Proxy configuration](#-proxy-configuration)
|
|
59
|
+
- [Command line usage (CLI)](#️-command-line-usage-cli)
|
|
60
|
+
- [Project structure](#-project-structure)
|
|
61
|
+
- [Security](#-security)
|
|
62
|
+
- [Changelog](#-changelog)
|
|
63
|
+
- [Contributing](#-contributing)
|
|
64
|
+
- [License](#-license)
|
|
56
65
|
|
|
57
66
|
---
|
|
58
67
|
|
|
59
|
-
##
|
|
68
|
+
## ⚡ Features
|
|
69
|
+
|
|
70
|
+
- **A complete interactive TUI**:
|
|
71
|
+
- Two-pane adaptive layout (dialog list on the left, history and input box on the right);
|
|
72
|
+
- Keyboard and mouse control (clicks, wheel scrolling);
|
|
73
|
+
- Chat categories: All, Direct messages, Groups, Channels, Bots, Unread;
|
|
74
|
+
- Instant search and filtering of chats by title and `@username` (`/`);
|
|
75
|
+
- Live typing indicator ("… is typing");
|
|
76
|
+
- Colored rendering of Telegram entities (bold, italic, monospace code, URLs, mentions, spoilers);
|
|
77
|
+
- Media attachment indicators (photo, video, document, voice, sticker, poll);
|
|
78
|
+
- Message reactions (👍, 🔥, ❤️);
|
|
79
|
+
- Infinite upward pagination of message history (`PageUp` / `Ctrl+U`);
|
|
80
|
+
- Contextual quick-reply (`Ctrl+R`) and edit (`Ctrl+E`) modes;
|
|
81
|
+
- Modal windows: Help (`F1` / `?`), Chat info (`Ctrl+P`), Action menu (`Ctrl+A`), Send file (`Ctrl+O`).
|
|
82
|
+
- **Standalone CLI mode**:
|
|
83
|
+
- Send messages and files straight from the command line;
|
|
84
|
+
- List dialogs and print chat history in the terminal;
|
|
85
|
+
- Stream live updates.
|
|
86
|
+
- **Sensible configuration**:
|
|
87
|
+
- Credentials and session live in OS user directories — the package stays read-only and survives updates;
|
|
88
|
+
- Session and credentials are written with `0600` permissions.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🖼 Screenshots
|
|
93
|
+
|
|
94
|
+
TuiGram lives in the terminal, so instead of images here are exact text captures of its
|
|
95
|
+
screens. Labels, hints and output formats are taken from the interface code rather than
|
|
96
|
+
invented; the data in the examples is fictional.
|
|
97
|
+
|
|
98
|
+
Note that the interface strings are Russian — the screens below show the client as it
|
|
99
|
+
actually looks today.
|
|
60
100
|
|
|
61
|
-
|
|
101
|
+
The main window is shown at the top of this README. Below are the remaining screens.
|
|
102
|
+
|
|
103
|
+
### Chat search and filtering
|
|
104
|
+
|
|
105
|
+
`/` starts an instant search by title and `@username`; the digits `1`–`6` switch categories
|
|
106
|
+
(All, Direct messages, Groups, Channels, Bots, Unread).
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
110
|
+
│ 🚀 TuiGram │ Alex Rivers (@alex_rivers) │ ● В сети │
|
|
111
|
+
├──────────────────────────────┬──────────────────────────────────────────────────────────────┤
|
|
112
|
+
│ [1:Все] [2:ЛС] [3:Группы] … │ ──────────────── Сегодня ──────────────── │
|
|
113
|
+
│ [/] tech█ │ │
|
|
114
|
+
│ 👥 Tech Chat · Nice work! [3]│ Sam Lee [11:02] │
|
|
115
|
+
│ 📢 Tech Digest · Выпуск… │ Let me know how it goes. │
|
|
116
|
+
│ 🤖 TechSupport Bot · Ок │ │
|
|
117
|
+
│ │ Вы [11:05] ✓✓ │
|
|
118
|
+
│ 3 из 214 чатов │ Will do 👍 │
|
|
119
|
+
│ ├──────────────────────────────────────────────────────────────┤
|
|
120
|
+
│ │ Введите сообщение…█ │
|
|
121
|
+
└──────────────────────────────┴──────────────────────────────────────────────────────────────┘
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
<details>
|
|
125
|
+
<summary><b>Help — <code>F1</code> / <code>?</code></b></summary>
|
|
126
|
+
|
|
127
|
+
The full list of shortcuts and slash commands, right inside the client.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
┌──────────────────────────────────────────────────────────────────────────┐
|
|
131
|
+
│ 🚀 TuiGram — Горячие клавиши и управление │
|
|
132
|
+
│ │
|
|
133
|
+
│ Навигация и фокус: │
|
|
134
|
+
│ [Tab] / [Shift+Tab] Фокус: Чаты → Сообщения → Ввод │
|
|
135
|
+
│ [↑] / [↓] Перемещение по списку чатов │
|
|
136
|
+
│ [Enter] Открыть чат / Загрузить историю │
|
|
137
|
+
│ [PageUp] / [Ctrl+U] Прокрутка вверх / старая история │
|
|
138
|
+
│ │
|
|
139
|
+
│ Вкладки фильтрации диалогов: │
|
|
140
|
+
│ [1] Все чаты [2] Личные (ЛС) [3] Группы │
|
|
141
|
+
│ [4] Каналы [5] Боты [6] Непрочитанные │
|
|
142
|
+
│ [/] Поиск чатов по названию/username │
|
|
143
|
+
│ │
|
|
144
|
+
│ Работа с сообщениями: │
|
|
145
|
+
│ [Enter] Отправить [Ctrl+R] Ответить (Reply) │
|
|
146
|
+
│ [Ctrl+J] Перенос строки [Ctrl+E] Редактировать сообщение │
|
|
147
|
+
│ [Ctrl+A] Меню действий [Ctrl+O] Отправить файл / фото │
|
|
148
|
+
│ [Ctrl+P] Инфо о чате [Esc] Закрыть окно / режим │
|
|
149
|
+
│ │
|
|
150
|
+
│ Слэш-команды в поле ввода: │
|
|
151
|
+
│ /help /info /sendfile /sendfile <путь> /clear /logout │
|
|
152
|
+
│ │
|
|
153
|
+
│ Выход: │
|
|
154
|
+
│ [Ctrl+Q] или [Ctrl+C] Безопасный выход из клиента │
|
|
155
|
+
│ │
|
|
156
|
+
│ [ Закрыть ] │
|
|
157
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
</details>
|
|
161
|
+
|
|
162
|
+
<details>
|
|
163
|
+
<summary><b>Message action menu — <code>Ctrl+A</code></b></summary>
|
|
164
|
+
|
|
165
|
+
Reply, edit, delete, reactions and attachment download. "Edit" and
|
|
166
|
+
"Download" appear only where they actually apply.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
┌──────────────────────────────────────────────────────┐
|
|
170
|
+
│ ⚡ Действия с сообщением #1042 │
|
|
171
|
+
│ Sam Lee: Have you checked the latest release? │
|
|
172
|
+
├──────────────────────────────────────────────────────┤
|
|
173
|
+
│ ↩️ Ответить (Reply) │
|
|
174
|
+
│ ✏️ Редактировать текст │
|
|
175
|
+
│ 🗑️ Удалить сообщение │
|
|
176
|
+
│ 👍 Поставить реакцию 👍 │
|
|
177
|
+
│ 🔥 Поставить реакцию 🔥 │
|
|
178
|
+
│ ❤️ Поставить реакцию ❤️ │
|
|
179
|
+
│ 📥 Скачать медиа-вложение │
|
|
180
|
+
│ 📋 Скопировать текст в ввод │
|
|
181
|
+
├──────────────────────────────────────────────────────┤
|
|
182
|
+
│ [↑↓] Выбор [Enter] Выполнить [Esc] Отмена │
|
|
183
|
+
└──────────────────────────────────────────────────────┘
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
|
|
188
|
+
<details>
|
|
189
|
+
<summary><b>Send file — <code>Ctrl+O</code></b></summary>
|
|
190
|
+
|
|
191
|
+
Several paths separated by `|` are sent as a single album. The line under the
|
|
192
|
+
checkbox states exactly what the file will become on Telegram's side.
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
┌────────────────────────────────────────────────────────────┐
|
|
196
|
+
│ 📤 Отправка файла или документа │
|
|
197
|
+
├────────────────────────────────────────────────────────────┤
|
|
198
|
+
│ Путь к файлу (несколько — через |) [Ctrl+F] Обзор │
|
|
199
|
+
│ ┌────────────────────────────────────────────────────────┐ │
|
|
200
|
+
│ │ ~/Desktop/photo.png | ~/Desktop/chart.png█ │ │
|
|
201
|
+
│ └────────────────────────────────────────────────────────┘ │
|
|
202
|
+
│ Подпись (необязательно): │
|
|
203
|
+
│ ┌────────────────────────────────────────────────────────┐ │
|
|
204
|
+
│ │ Две картинки с релиза │ │
|
|
205
|
+
│ └────────────────────────────────────────────────────────┘ │
|
|
206
|
+
│ [ ] Как файл, без сжатия [Ctrl+D] │
|
|
207
|
+
│ ✓ photo.png · 2.4 MB · уйдёт как фото │
|
|
208
|
+
├────────────────────────────────────────────────────────────┤
|
|
209
|
+
│ [ Отправить ] [ Отмена ] │
|
|
210
|
+
│ [Tab] Поля [Enter] Далее [Ctrl+F] Обзор [Esc] Выход │
|
|
211
|
+
└────────────────────────────────────────────────────────────┘
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
</details>
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary><b>File browser — <code>Ctrl+F</code></b></summary>
|
|
218
|
+
|
|
219
|
+
Navigate folders with the arrow keys; the size of the highlighted file is shown
|
|
220
|
+
at the bottom.
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
┌──────────────────────────────────────────────────────────┐
|
|
224
|
+
│ 📁 Выбор файла: /Users/alex/Desktop │
|
|
225
|
+
├──────────────────────────────────────────────────────────┤
|
|
226
|
+
│ .. <папка> │
|
|
227
|
+
│ screenshots/ <папка> │
|
|
228
|
+
│ ▸ photo.png 2.4 MB │
|
|
229
|
+
│ chart.png 812 KB │
|
|
230
|
+
│ report.pdf 1.1 MB │
|
|
231
|
+
│ archive.zip 18.7 MB │
|
|
232
|
+
├──────────────────────────────────────────────────────────┤
|
|
233
|
+
│ photo.png · 2.4 MB │
|
|
234
|
+
│ [↑↓] Навигация [Enter] Выбрать [Esc] Назад │
|
|
235
|
+
└──────────────────────────────────────────────────────────┘
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
<details>
|
|
241
|
+
<summary><b>Chat info — <code>Ctrl+P</code></b></summary>
|
|
242
|
+
|
|
243
|
+
ID, type, username, member count and description.
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
┌──────────────────────────────────────────────────────┐
|
|
247
|
+
│ ℹ Информация о чате │
|
|
248
|
+
├──────────────────────────────────────────────────────┤
|
|
249
|
+
│ Название: Tech Chat │
|
|
250
|
+
│ Тип: supergroup │
|
|
251
|
+
│ ID: -1001234567890 │
|
|
252
|
+
│ Username: @techchat │
|
|
253
|
+
│ Участников: 1420 │
|
|
254
|
+
│ Уведомления: Включены │
|
|
255
|
+
│ │
|
|
256
|
+
│ О чате / О себе: │
|
|
257
|
+
│ Чат про терминальные клиенты и MTProto. │
|
|
258
|
+
├──────────────────────────────────────────────────────┤
|
|
259
|
+
│ [ Закрыть ] │
|
|
260
|
+
└──────────────────────────────────────────────────────┘
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
</details>
|
|
264
|
+
|
|
265
|
+
### Command line mode
|
|
266
|
+
|
|
267
|
+
<details>
|
|
268
|
+
<summary><b>CLI command output</b></summary>
|
|
269
|
+
|
|
270
|
+
**`tuigram dialogs --limit 8`**
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
📂 Загрузка диалогов (макс. 8)...
|
|
274
|
+
|
|
275
|
+
📌 [user ] Sam Lee id=100200301
|
|
276
|
+
[supergroup] Tech Chat id=-1001234567890 (+3)
|
|
277
|
+
[bot ] Deploy Bot id=100200302
|
|
278
|
+
[channel ] News Channel id=-1009876543210 (+12)
|
|
279
|
+
[saved ] Избранное id=100200300
|
|
280
|
+
[user ] Mia Novak id=100200303 (+1)
|
|
281
|
+
[group ] Team Terminal id=-400112233
|
|
282
|
+
[user ] Nina Ivanova id=100200304
|
|
283
|
+
|
|
284
|
+
Всего получено: 8 диалогов
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**`tuigram history @sam_lee --limit 5`**
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
💬 Загрузка истории для @sam_lee (макс. 5 сообщений)...
|
|
291
|
+
|
|
292
|
+
[29.08.2026, 11:02:14] #1040 Sam Lee: Let me know how it goes.
|
|
293
|
+
[29.08.2026, 11:05:41] #1041 Вы: Will do 👍
|
|
294
|
+
[29.08.2026, 13:40:07] #1042 Sam Lee: Have you checked the latest release?
|
|
295
|
+
[29.08.2026, 13:41:22] #1043 Sam Lee: 📷 Фото
|
|
296
|
+
[29.08.2026, 13:42:55] #1044 Вы (в ответ на #1042): Yes, testing it right now! (изменено)
|
|
297
|
+
|
|
298
|
+
Всего отображено: 5 сообщений
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**`tuigram listen`**
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
🟢 Подключено как: Alex Rivers (@alex_rivers)
|
|
305
|
+
Слушаю обновления в реальном времени... Нажмите Ctrl+C для выхода.
|
|
306
|
+
|
|
307
|
+
[13:40:07] + НОВОЕ [-1001234567890] Sam Lee: Have you checked the latest release?
|
|
308
|
+
[13:41:19] ✍️ ПЕЧАТАЕТ чат: -1001234567890
|
|
309
|
+
[13:42:55] + НОВОЕ [-1001234567890] Вы: Yes, testing it right now!
|
|
310
|
+
[13:43:30] ~ ИЗМЕНЕНО [-1001234567890] #1044: Yes, testing it right now! 🚀
|
|
311
|
+
[13:44:02] - УДАЛЕНО [123456789] IDs: 1039, 1038
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
</details>
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 📦 Installation
|
|
319
|
+
|
|
320
|
+
### Option 1: global install from npm (recommended)
|
|
62
321
|
|
|
63
322
|
```bash
|
|
64
323
|
npm install -g @emaxe/tuigram
|
|
65
324
|
```
|
|
66
325
|
|
|
67
|
-
|
|
326
|
+
The `tuigram` command is then available from any directory.
|
|
68
327
|
|
|
69
|
-
###
|
|
328
|
+
### Option 2: one-off run without installing
|
|
70
329
|
|
|
71
330
|
```bash
|
|
72
331
|
npx @emaxe/tuigram
|
|
73
332
|
```
|
|
74
333
|
|
|
75
|
-
###
|
|
334
|
+
### Option 3: from source (for development)
|
|
76
335
|
|
|
77
336
|
```bash
|
|
78
337
|
git clone https://github.com/emaxe/tuigram.git
|
|
@@ -83,282 +342,351 @@ npm start
|
|
|
83
342
|
|
|
84
343
|
---
|
|
85
344
|
|
|
86
|
-
## ⚙️
|
|
345
|
+
## ⚙️ First run
|
|
87
346
|
|
|
88
|
-
### 1.
|
|
347
|
+
### 1. Telegram API credentials
|
|
89
348
|
|
|
90
|
-
|
|
349
|
+
Get your `api_id` and `api_hash` at [https://my.telegram.org](https://my.telegram.org) (*API development tools*), then run:
|
|
91
350
|
|
|
92
351
|
```bash
|
|
93
352
|
tuigram init
|
|
94
353
|
```
|
|
95
354
|
|
|
96
|
-
|
|
355
|
+
The command asks for both keys and stores them with `0600` permissions. For scripts and CI there is a non-interactive form:
|
|
97
356
|
|
|
98
357
|
```bash
|
|
99
358
|
tuigram init --api-id 1234567 --api-hash 0123456789abcdef0123456789abcdef
|
|
100
359
|
```
|
|
101
360
|
|
|
102
|
-
|
|
361
|
+
Alternatively, use the `TELEGRAM_API_ID` and `TELEGRAM_API_HASH` environment variables — they take precedence over the settings file.
|
|
103
362
|
|
|
104
|
-
### 2.
|
|
363
|
+
### 2. Authorization and launch
|
|
105
364
|
|
|
106
365
|
```bash
|
|
107
366
|
tuigram
|
|
108
367
|
```
|
|
109
368
|
|
|
110
|
-
|
|
369
|
+
On first launch TuiGram asks for your phone number, the confirmation code from Telegram and your 2FA password (if enabled). The session is then saved and subsequent launches are instant.
|
|
111
370
|
|
|
112
|
-
|
|
371
|
+
You can also authorize separately with `tuigram login`.
|
|
113
372
|
|
|
114
|
-
>
|
|
115
|
-
> `tuigram login`
|
|
116
|
-
>
|
|
117
|
-
>
|
|
118
|
-
> (
|
|
373
|
+
> **In a non-interactive environment** (CI, a pipe, `< /dev/null`) phone login is impossible:
|
|
374
|
+
> `tuigram login` exits immediately with a clear error instead of hanging. If a session
|
|
375
|
+
> already exists, the command simply reports who you are signed in as and returns exit
|
|
376
|
+
> code `0`. For automation, drop a ready `session.txt` into the data directory
|
|
377
|
+
> (`tuigram paths` prints the location).
|
|
119
378
|
|
|
120
379
|
---
|
|
121
380
|
|
|
122
|
-
## 📂
|
|
381
|
+
## 📂 Where files are stored
|
|
123
382
|
|
|
124
|
-
|
|
383
|
+
Nothing is written inside the package itself — this matters for global installs, where `node_modules` is usually not writable and is wiped on update.
|
|
125
384
|
|
|
126
|
-
|
|
|
385
|
+
| What | macOS / Linux | Windows |
|
|
127
386
|
|---|---|---|
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
387
|
+
| Settings (`.env`) | `~/.config/tuigram/.env` | `%APPDATA%\tuigram\.env` |
|
|
388
|
+
| Session | `~/.local/share/tuigram/session.txt` | `%LOCALAPPDATA%\tuigram\session.txt` |
|
|
389
|
+
| Downloads from chats | `~/.local/share/tuigram/downloads/` | `%LOCALAPPDATA%\tuigram\downloads\` |
|
|
131
390
|
|
|
132
|
-
|
|
391
|
+
To inspect the actual paths and configuration state:
|
|
133
392
|
|
|
134
393
|
```bash
|
|
135
394
|
tuigram paths
|
|
136
395
|
```
|
|
137
396
|
|
|
138
|
-
|
|
397
|
+
Locations can be overridden with `TUIGRAM_CONFIG_DIR` and `TUIGRAM_DATA_DIR` (`XDG_CONFIG_HOME` / `XDG_DATA_HOME` are honored too).
|
|
139
398
|
|
|
140
|
-
|
|
141
|
-
1.
|
|
142
|
-
2. `.env`
|
|
143
|
-
3. `~/.config/tuigram/.env` —
|
|
399
|
+
**Settings precedence** (top to bottom, first match wins):
|
|
400
|
+
1. process environment variables;
|
|
401
|
+
2. `.env` in the project root — only when running from a repository clone;
|
|
402
|
+
3. `~/.config/tuigram/.env` — the main file for an installed CLI.
|
|
144
403
|
|
|
145
|
-
|
|
404
|
+
A session from an older installation (`<project>/data/session.txt`) is migrated to the new location automatically on first run — no need to log in again.
|
|
146
405
|
|
|
147
406
|
---
|
|
148
407
|
|
|
149
|
-
## 🛠
|
|
408
|
+
## 🛠 Development
|
|
150
409
|
|
|
151
|
-
|
|
410
|
+
When running from a repository clone, an interactive launcher menu is available:
|
|
152
411
|
|
|
153
412
|
```bash
|
|
154
|
-
./run.sh #
|
|
413
|
+
./run.sh # or npm run menu
|
|
155
414
|
```
|
|
156
415
|
|
|
157
|
-
|
|
416
|
+
It offers a convenient choice of mode (TUI, login, dialogs, send, tests, cleanup).
|
|
158
417
|
|
|
159
|
-
|
|
418
|
+
Tests and a check of the future npm package contents:
|
|
160
419
|
|
|
161
420
|
```bash
|
|
162
|
-
npm test #
|
|
163
|
-
node scripts/check-package.js #
|
|
421
|
+
npm test # unit tests
|
|
422
|
+
node scripts/check-package.js # verifies that .env and the session do not leak into the package
|
|
164
423
|
```
|
|
165
424
|
|
|
166
425
|
---
|
|
167
426
|
|
|
168
|
-
## ⌨️
|
|
427
|
+
## ⌨️ Keyboard shortcuts
|
|
169
428
|
|
|
170
|
-
|
|
|
429
|
+
| Shortcut | Scope | Action |
|
|
171
430
|
|---|---|---|
|
|
172
|
-
| `Tab` / `Shift+Tab` |
|
|
173
|
-
| `↑` / `↓` |
|
|
174
|
-
| `Enter` |
|
|
175
|
-
| `1` .. `6` |
|
|
176
|
-
| `/` |
|
|
177
|
-
| `Enter` |
|
|
178
|
-
| `Ctrl+J` |
|
|
179
|
-
| `Ctrl+R` |
|
|
180
|
-
| `Ctrl+E` |
|
|
181
|
-
| `Ctrl+A` |
|
|
182
|
-
| `Ctrl+O` |
|
|
183
|
-
| `Ctrl+F` |
|
|
184
|
-
| `Ctrl+D` |
|
|
185
|
-
| `Ctrl+P` |
|
|
186
|
-
| `PageUp` / `Ctrl+U
|
|
187
|
-
| `PageDown` / `Ctrl+D
|
|
188
|
-
| `Esc` |
|
|
189
|
-
| `F1`
|
|
190
|
-
| `Ctrl+Q` / `Ctrl+C` |
|
|
431
|
+
| `Tab` / `Shift+Tab` | Global | Cycle focus: dialog list → message feed → input box |
|
|
432
|
+
| `↑` / `↓` | Dialog list | Select a chat |
|
|
433
|
+
| `Enter` | Dialog list | Open the selected chat and load its history |
|
|
434
|
+
| `1` .. `6` | Dialog list | Switch category: `1:All`, `2:DM`, `3:Groups`, `4:Channels`, `5:Bots`, `6:Unread` |
|
|
435
|
+
| `/` | Dialog list | Search / filter chats |
|
|
436
|
+
| `Enter` | Input box | Send the typed message |
|
|
437
|
+
| `Ctrl+J` | Input box | Insert a line break without sending |
|
|
438
|
+
| `Ctrl+R` | Chat / Input | Reply to the last message |
|
|
439
|
+
| `Ctrl+E` | Chat / Input | Edit your own last message |
|
|
440
|
+
| `Ctrl+A` | Messages | Context action menu (reactions, delete, download, reply) |
|
|
441
|
+
| `Ctrl+O` | Global | Send a file / photo / document |
|
|
442
|
+
| `Ctrl+F` | Send dialog | File browser (navigate folders) |
|
|
443
|
+
| `Ctrl+D` | Send dialog | Send uncompressed, as a document |
|
|
444
|
+
| `Ctrl+P` | Global | Info about the current chat (ID, members, links) |
|
|
445
|
+
| `PageUp` / `Ctrl+U` | History | Scroll up / load older history |
|
|
446
|
+
| `PageDown` / `Ctrl+D` | History | Scroll down |
|
|
447
|
+
| `Esc` | Modals | Close the modal / cancel reply or edit |
|
|
448
|
+
| `F1` or `?` | Global | Help window with every shortcut |
|
|
449
|
+
| `Ctrl+Q` / `Ctrl+C` | Global | Safely exit the client |
|
|
191
450
|
|
|
192
451
|
---
|
|
193
452
|
|
|
194
|
-
## 💬
|
|
453
|
+
## 💬 Slash commands in the input box
|
|
195
454
|
|
|
196
|
-
|
|
455
|
+
Quick commands are available in the message input box (they start with `/`):
|
|
197
456
|
|
|
198
|
-
- `/help` —
|
|
199
|
-
- `/info` —
|
|
200
|
-
- `/sendfile` —
|
|
201
|
-
- `/sendfile
|
|
202
|
-
- `/sendfile
|
|
203
|
-
- `/sendfile
|
|
204
|
-
- `/clear` —
|
|
205
|
-
- `/logout` —
|
|
457
|
+
- `/help` — open the help window;
|
|
458
|
+
- `/info` — detailed information about the current chat;
|
|
459
|
+
- `/sendfile` — open the send-file dialog;
|
|
460
|
+
- `/sendfile <path>` — send a file right away;
|
|
461
|
+
- `/sendfile <path> -- <caption>` — file with a caption;
|
|
462
|
+
- `/sendfile <path> | <path> -- <caption>` — an album of several files;
|
|
463
|
+
- `/clear` — clear the on-screen message feed;
|
|
464
|
+
- `/logout` — sign out of the Telegram account.
|
|
206
465
|
|
|
207
466
|
---
|
|
208
467
|
|
|
209
|
-
## 📎
|
|
468
|
+
## 📎 Sending files and images
|
|
210
469
|
|
|
211
|
-
|
|
470
|
+
Three ways: the `Ctrl+O` dialog, the `/sendfile` slash command, and the `sendfile` console command.
|
|
212
471
|
|
|
213
|
-
|
|
472
|
+
**The send dialog (`Ctrl+O`)**
|
|
214
473
|
|
|
215
|
-
- `Ctrl+F` —
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
- `Ctrl+D` —
|
|
219
|
-
-
|
|
220
|
-
-
|
|
474
|
+
- `Ctrl+F` — file browser: navigate folders with the arrow keys, `Enter` enters a folder or picks a file, `Esc` goes back. The size of the highlighted file is shown at the bottom.
|
|
475
|
+
- You can also just type a path: `~/Desktop/photo.png`, quoted paths and escaped spaces are understood — so dragging a file into the terminal works.
|
|
476
|
+
- Multiple files — separate them with `|` in the path field (or add them one by one via the browser). Up to 10 are sent as a single album.
|
|
477
|
+
- `Ctrl+D` — send uncompressed, as a document. Useful when the original image quality matters.
|
|
478
|
+
- The line under the checkbox shows exactly what will be sent: `✓ photo.png · 2.4 MB · will be sent as a photo`.
|
|
479
|
+
- If reply mode (`Ctrl+R`) is active at that moment, the file is sent **as a reply** to that message.
|
|
221
480
|
|
|
222
|
-
|
|
481
|
+
**What goes as a photo and what as a document**
|
|
223
482
|
|
|
224
|
-
`.png`, `.jpg`, `.jpeg`
|
|
483
|
+
Telegram accepts `.png`, `.jpg`, `.jpeg` as compressed photos; video formats (`.mp4`, `.mov`, `.mkv`, etc.) as video; everything else, including `.webp` and `.heic`, as a document. The "As a file, uncompressed" checkbox (`Ctrl+D`, or `--as-file` in the CLI) forces anything to be sent as a document.
|
|
225
484
|
|
|
226
|
-
|
|
485
|
+
**Progress and cancellation**
|
|
227
486
|
|
|
228
|
-
|
|
487
|
+
The status bar shows a percentage during upload. `Esc` aborts the transfer.
|
|
229
488
|
|
|
230
|
-
|
|
489
|
+
**Downloading incoming media**
|
|
231
490
|
|
|
232
|
-
`Ctrl+A`
|
|
491
|
+
`Ctrl+A` on a message → "Download attachment". The file is saved to the downloads directory.
|
|
233
492
|
|
|
234
493
|
---
|
|
235
494
|
|
|
236
|
-
## 🎨
|
|
495
|
+
## 🎨 Themes
|
|
237
496
|
|
|
238
|
-
|
|
497
|
+
The theme is set in `.env`:
|
|
239
498
|
|
|
240
499
|
```env
|
|
241
|
-
TUI_THEME=default #
|
|
500
|
+
TUI_THEME=default # dark (default)
|
|
242
501
|
TUI_THEME=nord # Nord
|
|
243
|
-
TUI_THEME=light #
|
|
502
|
+
TUI_THEME=light # light
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
All colors are given as hex values and are reduced to the xterm-256 palette (indices ≥ 16).
|
|
506
|
+
Named colors (`blue`, `cyan`, `gray`) are deliberately avoided: they occupy indices 0–15,
|
|
507
|
+
which the terminal theme repaints as it pleases — that is why a blue background could render
|
|
508
|
+
as teal and gray text could disappear entirely.
|
|
509
|
+
|
|
510
|
+
The contrast of every "text on background" pair is verified by an automated WCAG test
|
|
511
|
+
(threshold 3:1) **after** conversion to xterm-256 — that is, exactly as the user will see it.
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## 🌐 Proxy configuration
|
|
516
|
+
|
|
517
|
+
TuiGram supports routing MTProto connections through HTTP (including HTTPS CONNECT) and SOCKS5/SOCKS4 proxies — both with and without username/password authentication.
|
|
518
|
+
|
|
519
|
+
Proxy options can be configured in `.env` (or via environment variables):
|
|
520
|
+
|
|
521
|
+
**Single URL:**
|
|
522
|
+
```env
|
|
523
|
+
PROXY_URL=http://127.0.0.1:8080
|
|
524
|
+
PROXY_URL=http://user:password@proxy.example.com:8080
|
|
525
|
+
PROXY_URL=socks5://127.0.0.1:1080
|
|
526
|
+
PROXY_URL=socks5://user:password@127.0.0.1:1080
|
|
244
527
|
```
|
|
245
528
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
529
|
+
**Or separate variables:**
|
|
530
|
+
```env
|
|
531
|
+
PROXY_TYPE=http # http, https, socks5, socks4
|
|
532
|
+
PROXY_HOST=127.0.0.1
|
|
533
|
+
PROXY_PORT=8080
|
|
534
|
+
PROXY_USERNAME=user # optional
|
|
535
|
+
PROXY_PASSWORD=password # optional
|
|
536
|
+
PROXY_TIMEOUT=10 # timeout in seconds (default: 10)
|
|
537
|
+
```
|
|
250
538
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
увидит пользователь.
|
|
539
|
+
Standard environment variables `HTTPS_PROXY`, `HTTP_PROXY`, and `ALL_PROXY` are also supported as fallbacks.
|
|
540
|
+
The active proxy status can be inspected using `tuigram paths`.
|
|
254
541
|
|
|
255
542
|
---
|
|
256
543
|
|
|
257
|
-
## 🛠️
|
|
544
|
+
## 🛠️ Command line usage (CLI)
|
|
258
545
|
|
|
259
|
-
TuiGram
|
|
260
|
-
|
|
546
|
+
TuiGram can be used as a set of console utilities (when running from a repository
|
|
547
|
+
clone, substitute `node bin/tuigram.js` for `tuigram`):
|
|
261
548
|
|
|
262
549
|
```bash
|
|
263
|
-
#
|
|
550
|
+
# Authorization
|
|
264
551
|
tuigram login
|
|
265
552
|
|
|
266
|
-
#
|
|
553
|
+
# List dialogs
|
|
267
554
|
tuigram dialogs --limit 30
|
|
268
555
|
|
|
269
|
-
#
|
|
270
|
-
tuigram history @
|
|
556
|
+
# View chat history (@username, ID, or `me` for Saved Messages)
|
|
557
|
+
tuigram history @sam_lee --limit 20
|
|
271
558
|
tuigram history me
|
|
272
559
|
|
|
273
|
-
#
|
|
274
|
-
tuigram send me "
|
|
275
|
-
tuigram send @friend "
|
|
560
|
+
# Send a text message
|
|
561
|
+
tuigram send me "Hello from the terminal!"
|
|
562
|
+
tuigram send @friend "See you at 18:00"
|
|
276
563
|
|
|
277
|
-
#
|
|
564
|
+
# Send a file (multiple paths are sent as one album)
|
|
278
565
|
tuigram sendfile me ./screenshot.png
|
|
279
|
-
tuigram sendfile me ~/a.png ~/b.png --caption "
|
|
280
|
-
tuigram sendfile me ~/photo.png --as-file #
|
|
566
|
+
tuigram sendfile me ~/a.png ~/b.png --caption "Two pictures"
|
|
567
|
+
tuigram sendfile me ~/photo.png --as-file # uncompressed, as a document
|
|
281
568
|
|
|
282
|
-
#
|
|
569
|
+
# Live stream of real-time updates
|
|
283
570
|
tuigram listen
|
|
284
571
|
```
|
|
285
572
|
|
|
286
573
|
---
|
|
287
574
|
|
|
288
|
-
## 📁
|
|
575
|
+
## 📁 Project structure
|
|
289
576
|
|
|
290
577
|
```
|
|
291
578
|
TuiGram/
|
|
292
579
|
├── bin/
|
|
293
|
-
│ └── tuigram.js # CLI
|
|
580
|
+
│ └── tuigram.js # CLI executable
|
|
294
581
|
├── src/
|
|
295
|
-
│ ├── index.js #
|
|
296
|
-
│ ├── config.js #
|
|
297
|
-
│ ├── state.js #
|
|
582
|
+
│ ├── index.js # Main entry point (TUI / CLI router)
|
|
583
|
+
│ ├── config.js # User directory paths and .env loader
|
|
584
|
+
│ ├── state.js # Reactive centralized state store
|
|
298
585
|
│ ├── telegram/
|
|
299
|
-
│ │ ├── client.js #
|
|
300
|
-
│ │ ├──
|
|
301
|
-
│ │ ├──
|
|
302
|
-
│ │ ├──
|
|
303
|
-
│ │ ├──
|
|
304
|
-
│ │ ├──
|
|
305
|
-
│ │
|
|
586
|
+
│ │ ├── client.js # MTProto client creation and management
|
|
587
|
+
│ │ ├── socket.js # MTProto network transport and proxy tunneling (HTTP/SOCKS5)
|
|
588
|
+
│ │ ├── auth.js # Interactive login wizard and 2FA
|
|
589
|
+
│ │ ├── dialogs.js # Fetching, filtering and searching dialogs
|
|
590
|
+
│ │ ├── messages.js # History loading, sending, editing, files, reactions
|
|
591
|
+
│ │ ├── listener.js # Live background MTProto event listener
|
|
592
|
+
│ │ ├── entities.js # Peer parsing, chat types and entity cache
|
|
593
|
+
│ │ └── formatter.js # Telegram entities -> Blessed ANSI formatting
|
|
306
594
|
│ ├── ui/
|
|
307
|
-
│ │ ├── screen.js #
|
|
308
|
-
│ │ ├── theme.js #
|
|
309
|
-
│ │ ├── app.js #
|
|
595
|
+
│ │ ├── screen.js # Blessed screen management
|
|
596
|
+
│ │ ├── theme.js # Themes (Default Dark, Nord, Light)
|
|
597
|
+
│ │ ├── app.js # Main interface coordinator
|
|
310
598
|
│ │ └── components/
|
|
311
|
-
│ │ ├── header.js #
|
|
312
|
-
│ │ ├── chatList.js #
|
|
313
|
-
│ │ ├── chatView.js #
|
|
314
|
-
│ │ ├── inputBox.js #
|
|
315
|
-
│ │ ├── statusBar.js #
|
|
599
|
+
│ │ ├── header.js # Top header and connection status
|
|
600
|
+
│ │ ├── chatList.js # Dialog list with scrolling, tabs and search
|
|
601
|
+
│ │ ├── chatView.js # Message feed with autoscroll and formatting
|
|
602
|
+
│ │ ├── inputBox.js # Input box with reply/edit banner and history
|
|
603
|
+
│ │ ├── statusBar.js # Bottom hint line and toasts
|
|
316
604
|
│ │ └── modals/
|
|
317
|
-
│ │ ├── helpModal.js #
|
|
318
|
-
│ │ ├── chatInfoModal.js #
|
|
319
|
-
│ │ ├── actionModal.js #
|
|
320
|
-
│ │ ├── fileModal.js #
|
|
321
|
-
│ │ └── confirmModal.js #
|
|
605
|
+
│ │ ├── helpModal.js # Help window
|
|
606
|
+
│ │ ├── chatInfoModal.js # Chat info window
|
|
607
|
+
│ │ ├── actionModal.js # Message action menu
|
|
608
|
+
│ │ ├── fileModal.js # Send-file dialog
|
|
609
|
+
│ │ └── confirmModal.js # Confirmation dialog
|
|
322
610
|
│ ├── cli/
|
|
323
|
-
│ │ ├── cliCommands.js #
|
|
324
|
-
│ │ ├── init.js # tuigram init / paths —
|
|
325
|
-
│ │ └── formatters.js #
|
|
611
|
+
│ │ ├── cliCommands.js # Standalone CLI commands
|
|
612
|
+
│ │ ├── init.js # tuigram init / paths — setup and diagnostics
|
|
613
|
+
│ │ └── formatters.js # Console table and log formatters
|
|
326
614
|
│ └── utils/
|
|
327
|
-
│ ├── storage.js #
|
|
328
|
-
│ └── time.js #
|
|
615
|
+
│ ├── storage.js # File operations and session persistence
|
|
616
|
+
│ └── time.js # Time and date formatting
|
|
329
617
|
├── scripts/
|
|
330
|
-
│ └── check-package.js #
|
|
618
|
+
│ └── check-package.js # Pre-publish npm package check
|
|
331
619
|
├── test/
|
|
332
|
-
│ └── unit.test.js #
|
|
333
|
-
├── .env.example #
|
|
334
|
-
├── run.sh #
|
|
620
|
+
│ └── unit.test.js # Unit tests
|
|
621
|
+
├── .env.example # Configuration example
|
|
622
|
+
├── run.sh # Development launcher menu
|
|
623
|
+
├── AGENTS.md # Codebase rules (source of truth for AI agents)
|
|
624
|
+
├── CHANGELOG.md
|
|
335
625
|
├── LICENSE
|
|
336
626
|
├── package.json
|
|
337
|
-
|
|
627
|
+
├── README.md
|
|
628
|
+
└── README.ru.md
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
> The published npm package contains only `bin/`, `src/`, `README.md`, `README.ru.md`,
|
|
632
|
+
> `CHANGELOG.md`, `LICENSE` and `.env.example` — see the `files` field in `package.json`.
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## 🔒 Security
|
|
637
|
+
|
|
638
|
+
**Where the authorization lives.** A single file — `session.txt` in the data directory
|
|
639
|
+
(`~/.local/share/tuigram/` or `%LOCALAPPDATA%\tuigram\`; the location can be changed with
|
|
640
|
+
`TUIGRAM_DATA_DIR` and inspected with `tuigram paths`). It holds an MTProto `StringSession`:
|
|
641
|
+
the format version, the data-center number, its address and port, and a 256-byte `authKey`,
|
|
642
|
+
base64-encoded. Neither your password nor the confirmation code is stored there.
|
|
643
|
+
|
|
644
|
+
- The session file and the settings file are written with `0600` permissions — owner read/write only.
|
|
645
|
+
- Neither the session nor the credentials live inside the package: `npm update` does not touch them.
|
|
646
|
+
- `data/` and `.env` are in `.gitignore` and excluded from the npm package via the `files` field;
|
|
647
|
+
`node scripts/check-package.js` fails if a secret ends up in the build anyway.
|
|
648
|
+
- **The `authKey` is stored in the clear**: base64 is an encoding, not encryption.
|
|
649
|
+
Anyone who reads the file gets full access to the account without the phone, the code or 2FA.
|
|
650
|
+
Do not put it in shared folders or unencrypted backups. If the file leaks,
|
|
651
|
+
terminate the session in an official client (*Settings → Devices*) — that revokes the key
|
|
652
|
+
on the server and makes the string useless.
|
|
653
|
+
- `/logout` in the TUI revokes the key on the server and deletes the session file.
|
|
654
|
+
- No data is sent to third-party servers — the client connects directly to the official
|
|
655
|
+
Telegram MTProto servers.
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
## 📜 Changelog
|
|
660
|
+
|
|
661
|
+
All notable changes are recorded in [CHANGELOG.md](./CHANGELOG.md).
|
|
662
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
663
|
+
and versioning follows [SemVer](https://semver.org/).
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## 🤝 Contributing
|
|
668
|
+
|
|
669
|
+
Bug reports and pull requests are welcome:
|
|
670
|
+
[issues](https://github.com/emaxe/tuigram/issues).
|
|
671
|
+
|
|
672
|
+
Before submitting changes:
|
|
673
|
+
|
|
674
|
+
```bash
|
|
675
|
+
npm test # unit tests must be green
|
|
676
|
+
node scripts/check-package.js # .env and the session must not reach the package
|
|
338
677
|
```
|
|
339
678
|
|
|
340
|
-
|
|
341
|
-
|
|
679
|
+
Codebase rules for humans and AI agents live in [AGENTS.md](./AGENTS.md) — the single
|
|
680
|
+
source of truth for architecture, style, testing and security. If you work with
|
|
681
|
+
Claude Code, Cursor or Copilot, start there.
|
|
682
|
+
|
|
683
|
+
Both README versions (`README.md` and `README.ru.md`) must be updated together.
|
|
342
684
|
|
|
343
685
|
---
|
|
344
686
|
|
|
345
|
-
##
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
и 256-байтный `authKey`, закодированные в base64. Пароля и кода подтверждения там нет.
|
|
352
|
-
|
|
353
|
-
- Файл сессии и файл настроек сохраняются с правами `0600` — чтение и запись только владельцу.
|
|
354
|
-
- Ни сессия, ни ключи не лежат внутри пакета: `npm update` их не затрагивает.
|
|
355
|
-
- `data/` и `.env` в `.gitignore` и исключены из npm-пакета полем `files`;
|
|
356
|
-
проверка `node scripts/check-package.js` падает, если секрет всё же попал в сборку.
|
|
357
|
-
- **`authKey` хранится в открытом виде**: base64 — это кодирование, а не шифрование.
|
|
358
|
-
Кто прочитает файл, тот получит полный доступ к аккаунту без телефона, кода и 2FA.
|
|
359
|
-
Не кладите его в общие папки и незашифрованные бэкапы. Если файл утёк —
|
|
360
|
-
завершите сеанс в официальном клиенте («Настройки → Устройства»), это отзовёт ключ
|
|
361
|
-
на сервере, и строка станет бесполезной.
|
|
362
|
-
- `/logout` в TUI отзывает ключ на сервере и удаляет файл сессии.
|
|
363
|
-
- Никакие данные не передаются сторонним серверам — прямое соединение с официальными
|
|
364
|
-
серверами Telegram MTProto.
|
|
687
|
+
## 📄 License
|
|
688
|
+
|
|
689
|
+
[MIT](./LICENSE) © Maksim Klisin
|
|
690
|
+
|
|
691
|
+
TuiGram is an unofficial client. The project is not affiliated with,
|
|
692
|
+
nor endorsed by, Telegram Messenger Inc.
|