codex-unlimited 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/cli.mjs +3 -21
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,13 +4,13 @@ CLI độc lập của HRX để cấu hình Codex bằng khóa API thường ho
4
4
 
5
5
  ## Khóa API thường
6
6
 
7
- Trong **Khóa API → Sử dụng khóa API → Codex CLI**, chạy lệnh sau, bấm **Sao chép mã thiết lập** rồi dán vào lời nhắc ẩn. Xác nhận địa chỉ dịch vụ và mở lại Codex.
7
+ Trong **Khóa API → Sử dụng khóa → Hướng dẫn npm**, chạy lệnh sau, bấm **Sao chép mã thiết lập** rồi dán vào terminal. Kiểm tra nội dung vừa dán, nhấn Enter, xác nhận địa chỉ dịch vụ và mở lại Codex.
8
8
 
9
9
  ```sh
10
- npx --yes codex-unlimited@0.2.0 setup
10
+ npx --yes codex-unlimited@0.2.1 setup
11
11
  ```
12
12
 
13
- Để nhập khóa trực tiếp, chạy `npx --yes codex-unlimited@0.2.0 setup https://api.hugorix.com/v1` và dán khóa khi được hỏi. Công cụ đọc danh sách model để kiểm tra kết nối. Với cách cài bằng npx, dùng `npx --yes codex-unlimited@0.2.0 restore` để khôi phục cấu hình trước đó.
13
+ Để nhập khóa trực tiếp, chạy `npx --yes codex-unlimited@0.2.1 setup https://api.hugorix.com/v1` và dán khóa khi được hỏi. Công cụ đọc danh sách model để kiểm tra kết nối. Với cách cài bằng npx, dùng `npx --yes codex-unlimited@0.2.1 restore` để khôi phục cấu hình trước đó.
14
14
 
15
15
  ## Gói HRX
16
16
 
package/cli.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { stdin, stdout } from 'node:process'
3
3
  import { createInterface } from 'node:readline/promises'
4
- import { Writable } from 'node:stream'
5
4
  import { homedir } from 'node:os'
6
5
  import { join, dirname, delimiter, resolve } from 'node:path'
7
6
  import { access, constants, mkdir, open, readFile, rename, unlink, stat } from 'node:fs/promises'
@@ -47,24 +46,7 @@ async function atomic(file, content) {
47
46
  })
48
47
  }
49
48
  }
50
- let muted = false
51
- const output = new Writable({
52
- write(chunk, _encoding, done) {
53
- if (!muted) stdout.write(chunk)
54
- done()
55
- },
56
- })
57
- const rl = createInterface({ input: stdin, output, terminal: Boolean(stdin.isTTY) })
58
- async function askSecret(label = 'Dán mã kích hoạt (ẩn khi nhập): ') {
59
- stdout.write(label)
60
- muted = true
61
- try {
62
- return await rl.question('')
63
- } finally {
64
- muted = false
65
- stdout.write('\n')
66
- }
67
- }
49
+ const rl = createInterface({ input: stdin, output: stdout, terminal: Boolean(stdin.isTTY && stdout.isTTY), historySize: 0 })
68
50
  async function api(origin, endpoint, key) {
69
51
  const res = await fetch(origin + '/api/v1/hrx/' + endpoint, {
70
52
  method: endpoint === 'activate' ? 'POST' : 'GET',
@@ -136,7 +118,7 @@ async function install(old) {
136
118
  const f = await open(probe, 'wx', 0o600)
137
119
  await f.close()
138
120
  await unlink(probe)
139
- const { origin, code } = delivery(await askSecret())
121
+ const { origin, code } = delivery(await rl.question('Dán mã kích hoạt rồi nhấn Enter: '))
140
122
  if (
141
123
  (await rl.question('Yêu cầu Codex sẽ được gửi qua ' + origin + '. Kích hoạt gói bây giờ? [y/N] ')) !== 'y'
142
124
  )
@@ -174,7 +156,7 @@ async function saveConfiguration(existing, base, old, settings, catalog) {
174
156
  }
175
157
  async function setupRegularKey(old) {
176
158
  const url = process.argv[3]
177
- const input = await askSecret(url ? 'Dán khóa API (ẩn khi nhập): ' : 'Dán mã thiết lập từ trang Khóa API (ẩn khi nhập): ')
159
+ const input = await rl.question(url ? 'Dán khóa API rồi nhấn Enter: ' : 'Dán mã thiết lập từ trang Khóa API rồi nhấn Enter: ')
178
160
  const settings = apiKeySetup(input, url)
179
161
  if ((await rl.question('Dùng khóa API tại ' + settings.origin + '? [y/N] ')) !== 'y') return
180
162
  const existing = await read(path, null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-unlimited",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Configure Codex for a regular gateway API key or an independent HRX time or token pass",
5
5
  "type": "module",
6
6
  "bin": { "codex-unlimited": "cli.mjs" },