mytglib 2.1.4 → 2.1.5
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/README.md +45 -0
- package/dist/index.js +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1 +1,46 @@
|
|
|
1
1
|
# mytglib
|
|
2
|
+
|
|
3
|
+
Node.js 与 Rust 的离线 `session + JSON ↔ tdata` 转换见
|
|
4
|
+
[转换指南](docs/session-conversion.md)。输出为 Telethon v8 与包含 `twoFA` 的最小 Desktop JSON;
|
|
5
|
+
不需要初始化客户端或填写手机号。Node.js 命令行示例:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run build
|
|
9
|
+
node examples/convert-session.js --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
需要先把非 Desktop 会话登录为新的 Desktop 授权,再转 tdata 时,使用
|
|
13
|
+
`sessionToDesktopTdata()` / Rust `session_to_desktop_tdata()`,见
|
|
14
|
+
[Desktop 登录转换指南](docs/desktop-conversion.md)。它信任 JSON 的 API ID 分流、联网检查旧授权,
|
|
15
|
+
支持旧会话自动取码、邮箱和 2FA;输入只读,失败时保留已创建的新授权用于恢复。
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run build
|
|
19
|
+
node examples/desktop-conversion.js --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Telegram 客户端版本更新见 [版本同步指南](docs/client-version-sync.md)。
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run versions:check
|
|
26
|
+
npm run versions:sync
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
默认同步 Android 主包、Beta 与 Telegram X 频道;Web、iOS、Desktop 和全部来源的命令见指南。
|
|
30
|
+
|
|
31
|
+
新注册会话在连接前设置 `registration: true`,按手机号所在地区使用平台语言表的第一项。
|
|
32
|
+
Node.js 使用 `systemLangCode`、Rust 使用 `system_lang_code` 传入自定义值;Android 转小写,iOS 保留大小写。
|
|
33
|
+
已有会话的保存值始终优先。配置示例、兜底和维护方式见 [系统语言配置](docs/system-lang-codes.md)。
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import { android, ios } from "mytglib";
|
|
37
|
+
|
|
38
|
+
const input = { phone: "+639306091813", registration: true };
|
|
39
|
+
console.log(android.createInitConnectionOptions(input).systemLangCode); // en-ph
|
|
40
|
+
console.log(ios.createInitConnectionOptions(input).systemLangCode); // en-PH
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
完整的初始化、验证码登录/注册、发送 `help.getConfig` 请求与 `finally` 关闭示例见
|
|
44
|
+
[examples/login.js](examples/login.js)。运行 `npm run example:login -- --help` 查看参数;
|
|
45
|
+
设置 `TG_REGISTRATION=true` 启用新注册地区默认值,`TG_SYSTEM_LANG_CODE` 可选传入自定义系统语言。
|
|
46
|
+
离线预览可运行 `npm run example:inspect`。
|