@pure01fx/dsh-openai-codex-auth 0.5.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/LICENSE +21 -0
- package/README.md +253 -0
- package/assets/readme/hero.svg +56 -0
- package/assets/readme/workflow.svg +56 -0
- package/client.js +601 -0
- package/cordis.patch.yml +9 -0
- package/lib/index.d.ts +128 -0
- package/lib/index.js +1258 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yoke233
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/readme/hero.svg" width="100%" alt="@pure01fx/dsh-openai-codex-auth:在 DeepSeek Harness 中通过设备码或本机浏览器 OAuth 登录 OpenAI Codex、查看用量并接入模型提供方">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>把 ChatGPT 订阅登录接入 DeepSeek Harness。</strong><br>
|
|
7
|
+
设备码优先、浏览器 OAuth 备用;在 DSH 设置页完成登录、查看 Codex 用量,并自动向 <code>openai-codex</code> 模型提供方提供有效凭据。
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="#快速开始">快速开始</a> ·
|
|
12
|
+
<a href="#两种登录方式">登录方式</a> ·
|
|
13
|
+
<a href="#功能一览">功能一览</a> ·
|
|
14
|
+
<a href="#远程与反向代理">远程访问</a> ·
|
|
15
|
+
<a href="#凭据处理边界">安全边界</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
将插件安装到 DSH 的 `web` profile:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
dsh plugin --profile web add @pure01fx/dsh-openai-codex-auth
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
开发 checkout 也可直接使用本地路径:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
dsh plugin --profile web add /absolute/path/to/dsh-openai-codex-auth
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
启动或重启 Web profile:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
dsh web
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
然后:
|
|
39
|
+
|
|
40
|
+
1. 打开 DSH Web,进入 **设置 → OpenAI Codex**。
|
|
41
|
+
2. 点击 **使用设备码登录**。
|
|
42
|
+
3. 先复制设置页显示的用户码,再点击按钮打开 OpenAI 验证页并完成登录。
|
|
43
|
+
4. 返回 DSH,在 **设置 → 模型提供方** 中选择 `openai-codex`。
|
|
44
|
+
|
|
45
|
+
设备码登录无需 OAuth callback,适合本机、SSH 隧道和 HTTPS 反向代理场景。
|
|
46
|
+
|
|
47
|
+
## 两种登录方式
|
|
48
|
+
|
|
49
|
+
### 设备码登录(推荐)
|
|
50
|
+
|
|
51
|
+
1. Host 从 OpenAI 申请一次性用户码。
|
|
52
|
+
2. 设置页显示用户码、验证网址和 15 分钟倒计时。
|
|
53
|
+
3. 用户可以在任意设备打开 <https://auth.openai.com/codex/device> 并输入代码。
|
|
54
|
+
4. Host 后台轮询授权结果,交换令牌并写入本地凭据。
|
|
55
|
+
|
|
56
|
+
设备码 flow 的临时 ID、用户码和轮询状态只存在于内存;DSH Web 重启或用户取消后即失效。
|
|
57
|
+
|
|
58
|
+
> [!NOTE]
|
|
59
|
+
> OpenAI workspace 可能要求管理员允许设备码登录。若申请接口返回 404,设置页会提示改用本机浏览器 OAuth。
|
|
60
|
+
|
|
61
|
+
### 本机浏览器 OAuth(备用)
|
|
62
|
+
|
|
63
|
+
OpenAI 的 Codex 公共 client ID 只接受已注册的精确 callback:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
http://localhost:1455/auth/callback
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
点击浏览器登录后,设置页会展开诊断卡片,插件同时在 IPv4/IPv6 loopback(`127.0.0.1`/`::1`)的 1455 端口启动临时 callback listener。浏览器会探测自身到 `127.0.0.1:1455` 的连接:成功显示绿色勾选;失败则给出端口转发提示,并提供重新检测和强制继续按钮。外部 OpenAI 页面只会在用户点击按钮后打开。
|
|
70
|
+
|
|
71
|
+
如果自动 callback 无法抵达,还可以把浏览器地址栏中的完整 callback URL 或 authorization code 粘贴回诊断卡片完成交换。登录完成、取消、失败或 10 分钟超时后 listener 立即关闭;1455 不会在 DSH 启动后常驻监听。
|
|
72
|
+
|
|
73
|
+
只有通过 HTTP `127.0.0.1` 或 `localhost` 打开 DSH 时,设置页才启用浏览器 OAuth 按钮。反代域名、LAN IP 或 HTTPS 入口应使用设备码。若 DSH 运行在远程服务器,还必须把本机 1455 转发到服务器的 1455。
|
|
74
|
+
|
|
75
|
+
## 功能一览
|
|
76
|
+
|
|
77
|
+
| 能力 | 说明 |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| 设备码登录 | 无本机 callback,支持远程/headless 使用 |
|
|
80
|
+
| 浏览器 OAuth fallback | PKCE + state、端到端 1455 探测、手动 code 回填和临时 callback listener |
|
|
81
|
+
| Codex 用量面板 | 展示短周期与周用量、剩余额度和重置时间 |
|
|
82
|
+
| 输入框额度圈 | 登录后显示在输入框右下角;Codex turn 结束或点击圆圈时刷新,不做常驻额度轮询 |
|
|
83
|
+
| 自动凭据续期 | 在令牌接近过期时刷新,并更新 DSH credentials |
|
|
84
|
+
| DSH 模型接入 | 将有效令牌提供给 `openai-codex` 模型提供方 |
|
|
85
|
+
| 登录生命周期管理 | 支持取消、15 分钟设备码超时、10 分钟浏览器超时和安全退出 |
|
|
86
|
+
| 同源管理路由 | 状态与控制接口挂载到 DSH Web;1456 已移除,1455 仅在浏览器登录期间临时使用 |
|
|
87
|
+
|
|
88
|
+
## 工作方式
|
|
89
|
+
|
|
90
|
+
<p align="center">
|
|
91
|
+
<img src="./assets/readme/workflow.svg" width="100%" alt="设备码授权由 DSH Host 轮询并写入本地凭据;浏览器 OAuth 备用方式仅在登录期间监听 localhost:1455 callback">
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
登录成功后:
|
|
95
|
+
|
|
96
|
+
1. 凭据以 owner-only 权限原子写入 `$DSH_HOME/openai-codex-auth.json`。
|
|
97
|
+
2. access token 通过 DSH credentials 注入 `DSH_OPENAI_CODEX_TOKEN`。
|
|
98
|
+
3. `openai-codex` 模型提供方在请求时读取该凭据。
|
|
99
|
+
4. 输入框右下角显示 Codex 额度圈;插件在 Codex turn 结束或用户点击圆圈时读取用量,不运行常驻额度轮询。
|
|
100
|
+
5. 设置页与额度圈只读取登录状态、账号 ID、过期时间和用量摘要,不接触 token。
|
|
101
|
+
|
|
102
|
+
## 同源路由
|
|
103
|
+
|
|
104
|
+
日常状态与控制接口由 DSH Web 提供;只有浏览器 OAuth flow 会额外创建一个短生命周期 callback Server:
|
|
105
|
+
|
|
106
|
+
| 方法 | 路径 | 用途 |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| GET | `/openai-codex/status` | 登录、flow、用量和 CSRF 状态 |
|
|
109
|
+
| POST | `/openai-codex/device/start` | 创建或复用设备码 flow |
|
|
110
|
+
| POST | `/openai-codex/browser/prepare` | 创建浏览器 flow,返回授权 URL 和一次性 1455 探测 URL |
|
|
111
|
+
| POST | `/openai-codex/browser/complete` | 接收用户粘贴的 callback URL 或 authorization code |
|
|
112
|
+
| GET | `/openai-codex/browser/start` | 兼容入口:直接启动并跳转浏览器 OAuth |
|
|
113
|
+
| POST | `/openai-codex/cancel` | 取消当前登录、关闭临时 listener,保留旧凭据 |
|
|
114
|
+
| POST | `/openai-codex/logout` | 取消 flow 并删除本地凭据 |
|
|
115
|
+
|
|
116
|
+
1456 已完全退役。1455 平时关闭,仅浏览器 OAuth pending 时绑定 loopback;设备码登录完全不使用它。
|
|
117
|
+
|
|
118
|
+
## 远程与反向代理
|
|
119
|
+
|
|
120
|
+
### SSH 隧道
|
|
121
|
+
|
|
122
|
+
设备码登录只需转发 DSH Web 端口,本地端口可以不同:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
ssh -L 8080:127.0.0.1:3080 user@server
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
若还要使用浏览器 OAuth fallback,同时转发 OpenAI 固定的 callback 端口:
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
ssh -L 8080:127.0.0.1:3080 -L 1455:127.0.0.1:1455 user@server
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
然后打开 `http://localhost:8080`。设备码登录仍不依赖 1455;只有浏览器 fallback 会临时使用该转发。
|
|
135
|
+
|
|
136
|
+
### HTTPS 反向代理
|
|
137
|
+
|
|
138
|
+
DSH Web 继续绑定 `127.0.0.1`。为外部域名配置 DSH trusted host:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
dsh web --trusted-host dsh.example.com
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
反代必须保留浏览器原始 Host,例如 Nginx:
|
|
145
|
+
|
|
146
|
+
```nginx
|
|
147
|
+
location / {
|
|
148
|
+
proxy_pass http://127.0.0.1:3080;
|
|
149
|
+
proxy_set_header Host $http_host;
|
|
150
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
通过反代域名访问时使用设备码登录;浏览器 OAuth 按钮会被禁用。反代还需按 DSH Web 本身的要求转发 WebSocket。
|
|
155
|
+
|
|
156
|
+
## 配置
|
|
157
|
+
|
|
158
|
+
插件通常无需额外配置。默认凭据文件为:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
$DSH_HOME/openai-codex-auth.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
如需改变存储位置,可在 Cordis 配置中设置 `path`:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
- insert:
|
|
168
|
+
- id: openai-codex-auth
|
|
169
|
+
name: '@pure01fx/dsh-openai-codex-auth'
|
|
170
|
+
config:
|
|
171
|
+
path: /secure/path/openai-codex-auth.json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`path` 的优先级高于 `dshHome`。
|
|
175
|
+
|
|
176
|
+
## 凭据处理边界
|
|
177
|
+
|
|
178
|
+
以下内容说明插件如何处理本地凭据与管理接口,不代表或承诺任何 OpenAI 账号风控结果。
|
|
179
|
+
|
|
180
|
+
- 浏览器 OAuth 使用 PKCE,并通过随机 `state` 防止 callback 串用。
|
|
181
|
+
- 设备码由 Host 轮询;Web 页面只看到用户码、验证网址和过期时间。
|
|
182
|
+
- 凭据目录与文件分别以 owner-only 权限创建,并通过文件锁和原子写入更新。
|
|
183
|
+
- access token 与 refresh token 只保存在 Host 侧;Web 页面不会读取或保存它们。
|
|
184
|
+
- 管理路由复用 DSH `trustedHosts`,并检查 Host、Origin、Fetch Metadata 和 CSRF。
|
|
185
|
+
- 临时 callback Server 只绑定 IPv4/IPv6 loopback 的 1455,并只接受注册 URI 对应的 `Host: localhost:1455`、`/auth/callback` 路径和匹配的 state。
|
|
186
|
+
- 浏览器连通性探测使用 flow 专属随机 URL,只向 HTTP `127.0.0.1`/`localhost` Origin 返回 CORS 结果;手动 code 提交受同源管理检查和 CSRF 保护,粘贴完整 URL 时还会校验 state。
|
|
187
|
+
- cancel 会保留旧凭据;logout 会先停止 flow,再删除凭据,避免迟到写回。
|
|
188
|
+
- 若 `DSH_OPENAI_CODEX_TOKEN` 被只读环境来源覆盖,插件会拒绝开始登录并显示明确错误。
|
|
189
|
+
|
|
190
|
+
## 代理
|
|
191
|
+
|
|
192
|
+
插件使用 Node.js 原生 `fetch`。若访问 OpenAI 需要 HTTP 代理,启动 DSH 前设置:
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
NODE_USE_ENV_PROXY=1 \
|
|
196
|
+
HTTP_PROXY=http://127.0.0.1:7890 \
|
|
197
|
+
HTTPS_PROXY=http://127.0.0.1:7890 \
|
|
198
|
+
dsh web
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
可按环境补充 `NO_PROXY=localhost,127.0.0.1,::1`。
|
|
202
|
+
|
|
203
|
+
## 常见问题
|
|
204
|
+
|
|
205
|
+
<details>
|
|
206
|
+
<summary><strong>设备码登录提示不可用或返回 404</strong></summary>
|
|
207
|
+
|
|
208
|
+
当前 OpenAI workspace 可能未启用 device auth。若是组织账号,请联系管理员;也可以通过 HTTP `127.0.0.1`/`localhost` 入口使用浏览器 OAuth fallback。
|
|
209
|
+
|
|
210
|
+
</details>
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary><strong>设备码一直等待或超时</strong></summary>
|
|
214
|
+
|
|
215
|
+
确认验证页已使用正确账号完成授权,并检查 Host 到 `auth.openai.com` 的网络与代理。设备码 15 分钟后自动失效,可取消后重新申请。
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
<details>
|
|
220
|
+
<summary><strong>为什么浏览器 OAuth 按钮不可用?</strong></summary>
|
|
221
|
+
|
|
222
|
+
该 fallback 只支持 HTTP loopback 入口。请用 `http://127.0.0.1:<port>` 或 `http://localhost:<port>` 打开 DSH;反代域名、LAN IP 和 HTTPS 入口请使用设备码。
|
|
223
|
+
|
|
224
|
+
</details>
|
|
225
|
+
|
|
226
|
+
<details>
|
|
227
|
+
<summary><strong>为什么登录提示 DSH_OPENAI_CODEX_TOKEN 是只读来源?</strong></summary>
|
|
228
|
+
|
|
229
|
+
环境变量或其他只读 credential source 正在覆盖插件管理的 token。移除该覆盖并重启 DSH 后再登录,避免文件凭据写入成功但模型仍使用旧 token。
|
|
230
|
+
|
|
231
|
+
</details>
|
|
232
|
+
|
|
233
|
+
<details>
|
|
234
|
+
<summary><strong>账号已连接,但没有显示额度窗口</strong></summary>
|
|
235
|
+
|
|
236
|
+
点击 **刷新用量** 重试。若 OpenAI 当前未返回可展示的窗口,插件会保留登录状态并显示说明。
|
|
237
|
+
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
## 本地开发
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
pnpm install
|
|
244
|
+
pnpm run build
|
|
245
|
+
pnpm test
|
|
246
|
+
node --check client.js
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
`src/index.ts` 是 Host 实现源;`lib/index.js` 与 `lib/index.d.ts` 由 TypeScript 构建生成。
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="420" viewBox="0 0 1200 420" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">dsh-openai-codex-auth</title>
|
|
3
|
+
<desc id="desc">Device-code-first OpenAI Codex login and usage integration for DeepSeek Harness, with browser OAuth as a loopback fallback.</desc>
|
|
4
|
+
|
|
5
|
+
<rect width="1200" height="420" rx="28" fill="#0B0F14"/>
|
|
6
|
+
<path d="M64 46H1136" stroke="#263241" stroke-width="2"/>
|
|
7
|
+
<rect x="56" y="23" width="50" height="46" rx="12" fill="#0B0F14"/>
|
|
8
|
+
<g id="deepseek-logo" transform="translate(62 28) scale(.72)">
|
|
9
|
+
<path d="M48.8354 10.0479C48.3232 9.79199 48.1025 10.2798 47.8032 10.5278C47.7007 10.6079 47.6143 10.7119 47.5273 10.8076C46.7793 11.624 45.9048 12.1597 44.7622 12.0957C43.0923 12 41.666 12.5356 40.4058 13.8398C40.1377 12.2319 39.2476 11.272 37.8926 10.6558C37.1836 10.3359 36.4668 10.0156 35.9702 9.31982C35.6235 8.82373 35.5293 8.27197 35.356 7.72754C35.2456 7.3999 35.1353 7.06396 34.7651 7.00781C34.3633 6.94385 34.2056 7.2876 34.0479 7.57568C33.418 8.75195 33.1733 10.0479 33.1973 11.3599C33.2524 14.312 34.4736 16.6641 36.8999 18.3359C37.1758 18.5278 37.2466 18.7197 37.1597 19C36.9946 19.5757 36.7974 20.1357 36.624 20.7119C36.5137 21.0801 36.3486 21.1597 35.9624 21C34.6309 20.4321 33.481 19.5918 32.4644 18.5757C30.7393 16.8721 29.1792 14.9917 27.2334 13.52C26.7764 13.1758 26.3193 12.856 25.8467 12.5518C23.8618 10.584 26.1069 8.96777 26.627 8.77588C27.1704 8.57568 26.8159 7.8877 25.0591 7.896C23.3022 7.90381 21.6953 8.50391 19.647 9.30371C19.3477 9.42383 19.0322 9.51172 18.7095 9.58398C16.8501 9.22363 14.9199 9.14355 12.9033 9.37598C9.10596 9.80762 6.07275 11.6396 3.84326 14.7681C1.16455 18.5278 0.53418 22.7998 1.30664 27.2559C2.11768 31.9521 4.46582 35.8398 8.07373 38.8799C11.8159 42.0322 16.1255 43.5762 21.041 43.2803C24.0269 43.104 27.3516 42.6963 31.1016 39.4561C32.0469 39.936 33.0396 40.1279 34.686 40.272C35.9546 40.3921 37.1758 40.208 38.1211 40.0078C39.6021 39.688 39.4995 38.2881 38.9639 38.0322C34.623 35.9678 35.5762 36.8081 34.71 36.1279C36.9155 33.4639 40.2402 30.6958 41.54 21.728C41.6426 21.0161 41.5557 20.5679 41.54 19.9917C41.5322 19.6396 41.6108 19.5039 42.0049 19.4639C43.0923 19.3359 44.1479 19.0317 45.1167 18.4878C47.9292 16.9199 49.064 14.3438 49.3315 11.2559C49.3711 10.7837 49.3237 10.2959 48.8354 10.0479ZM24.3262 37.8398C20.1196 34.4639 18.0791 33.3521 17.2358 33.3999C16.4482 33.4482 16.5898 34.3682 16.7632 34.9678C16.9443 35.5601 17.1812 35.9683 17.5117 36.4878C17.7402 36.832 17.8979 37.3442 17.2832 37.728C15.9282 38.584 13.5728 37.4399 13.4624 37.3838C10.7207 35.7358 8.42822 33.5601 6.81348 30.584C5.25342 27.7197 4.34766 24.6479 4.19775 21.3677C4.1582 20.5757 4.38672 20.2959 5.15869 20.1519C6.17529 19.96 7.22314 19.9199 8.23926 20.0718C12.5327 20.7119 16.1885 22.6719 19.2529 25.7759C21.002 27.5439 22.3252 29.6558 23.6885 31.7202C25.1377 33.9121 26.6978 36 28.6831 37.7119C29.3843 38.312 29.9434 38.7681 30.479 39.104C28.8643 39.2881 26.1699 39.3281 24.3262 37.8398ZM26.3433 24.6001C26.3433 24.248 26.6191 23.9678 26.9658 23.9678C27.0444 23.9678 27.1152 23.9839 27.1782 24.0078C27.2651 24.04 27.3438 24.0879 27.4067 24.1602C27.5171 24.272 27.5801 24.4321 27.5801 24.6001C27.5801 24.9521 27.3042 25.2319 26.9575 25.2319C26.6108 25.2319 26.3433 24.9521 26.3433 24.6001ZM32.6064 27.8799C32.2046 28.0479 31.8027 28.1919 31.4165 28.208C30.8179 28.2397 30.1641 27.9922 29.8096 27.688C29.2583 27.2158 28.8643 26.9521 28.6987 26.1279C28.6279 25.7759 28.6675 25.2319 28.7305 24.9199C28.8721 24.248 28.7144 23.8159 28.2495 23.4238C27.8716 23.104 27.3911 23.0161 26.8633 23.0161C26.666 23.0161 26.4849 22.9277 26.3511 22.856C26.1304 22.7441 25.9492 22.4639 26.1226 22.1201C26.1777 22.0078 26.4458 21.7358 26.5088 21.688C27.2256 21.272 28.0527 21.4077 28.8169 21.7197C29.5259 22.0161 30.0615 22.5601 30.834 23.3281C31.6216 24.2559 31.7632 24.5117 32.2124 25.208C32.5669 25.752 32.8901 26.312 33.1104 26.9521C33.2446 27.3521 33.0713 27.6802 32.6064 27.8799Z" fill="#4D6BFE"/>
|
|
10
|
+
</g>
|
|
11
|
+
<text x="112" y="53" fill="#94A3B8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="600" letter-spacing="1.2">DEEPSEEK HARNESS · AUTH PLUGIN</text>
|
|
12
|
+
|
|
13
|
+
<g id="title-block" transform="translate(64 88)">
|
|
14
|
+
<text x="0" y="64" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="58" font-weight="750">dsh-openai</text>
|
|
15
|
+
<text x="0" y="126" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="58" font-weight="750">codex-auth</text>
|
|
16
|
+
<text x="2" y="176" fill="#CBD5E1" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="23">设备码登录、用量查看与本地凭据接入</text>
|
|
17
|
+
|
|
18
|
+
<g transform="translate(0 214)" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17" font-weight="650">
|
|
19
|
+
<rect width="148" height="38" rx="19" fill="#102A24" stroke="#1F6F5A"/>
|
|
20
|
+
<text x="20" y="25" fill="#6EE7B7">DEVICE CODE</text>
|
|
21
|
+
<rect x="160" width="170" height="38" rx="19" fill="#111F33" stroke="#234A78"/>
|
|
22
|
+
<text x="180" y="25" fill="#93C5FD">OAUTH FALLBACK</text>
|
|
23
|
+
<rect x="342" width="120" height="38" rx="19" fill="#171E28" stroke="#334155"/>
|
|
24
|
+
<text x="363" y="25" fill="#CBD5E1">USAGE UI</text>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
|
|
28
|
+
<g id="usage-proof" transform="translate(700 76)">
|
|
29
|
+
<rect width="436" height="296" rx="22" fill="#111821" stroke="#334155" stroke-width="2"/>
|
|
30
|
+
<rect x="24" y="24" width="48" height="48" rx="13" fill="#F8FAFC"/>
|
|
31
|
+
<text x="48" y="55" text-anchor="middle" fill="#0B0F14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17" font-weight="800">OA</text>
|
|
32
|
+
<text x="88" y="44" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="22" font-weight="700">OpenAI Codex</text>
|
|
33
|
+
<text x="88" y="68" fill="#94A3B8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16">CHATGPT PLUS</text>
|
|
34
|
+
<rect x="326" y="29" width="86" height="34" rx="17" fill="#102A24"/>
|
|
35
|
+
<circle cx="344" cy="46" r="5" fill="#34D399"/>
|
|
36
|
+
<text x="358" y="52" fill="#6EE7B7" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="17" font-weight="650">已连接</text>
|
|
37
|
+
|
|
38
|
+
<path d="M24 94H412" stroke="#263241" stroke-width="2"/>
|
|
39
|
+
|
|
40
|
+
<text x="24" y="129" fill="#E2E8F0" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="19" font-weight="650">5 小时额度</text>
|
|
41
|
+
<text x="412" y="129" text-anchor="end" fill="#94A3B8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">42% USED</text>
|
|
42
|
+
<rect x="24" y="146" width="388" height="10" rx="5" fill="#263241"/>
|
|
43
|
+
<rect x="24" y="146" width="163" height="10" rx="5" fill="#34D399"/>
|
|
44
|
+
<text x="24" y="183" fill="#94A3B8" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="17">剩余 58% · 自动读取重置时间</text>
|
|
45
|
+
|
|
46
|
+
<text x="24" y="224" fill="#E2E8F0" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="19" font-weight="650">周额度</text>
|
|
47
|
+
<text x="412" y="224" text-anchor="end" fill="#94A3B8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">73% USED</text>
|
|
48
|
+
<rect x="24" y="241" width="388" height="10" rx="5" fill="#263241"/>
|
|
49
|
+
<rect x="24" y="241" width="283" height="10" rx="5" fill="#60A5FA"/>
|
|
50
|
+
<text x="24" y="278" fill="#94A3B8" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="17">剩余 27% · 凭据仅保存在 Host 侧</text>
|
|
51
|
+
</g>
|
|
52
|
+
|
|
53
|
+
<path d="M650 108V344" stroke="#263241" stroke-width="2" stroke-dasharray="7 9"/>
|
|
54
|
+
<circle cx="650" cy="109" r="7" fill="#60A5FA"/>
|
|
55
|
+
<circle cx="650" cy="344" r="7" fill="#34D399"/>
|
|
56
|
+
</svg>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="460" viewBox="0 0 1200 460" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">OpenAI Codex 设备码优先授权与凭据流</title>
|
|
3
|
+
<desc id="desc">DSH 设置页显示 OpenAI 设备码,Host 后台轮询授权并原子写入凭据;浏览器 OAuth 仅在登录期间临时监听 localhost:1455 作为备用。</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto" markerUnits="strokeWidth">
|
|
6
|
+
<path d="M0 0L10 5L0 10Z" fill="#64748B"/>
|
|
7
|
+
</marker>
|
|
8
|
+
</defs>
|
|
9
|
+
|
|
10
|
+
<rect width="1200" height="460" rx="26" fill="#0B0F14"/>
|
|
11
|
+
<text x="56" y="62" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="38" font-weight="750">设备码优先 · 浏览器回调备用</text>
|
|
12
|
+
<text x="56" y="96" fill="#94A3B8" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="20">令牌留在 Host;远程与反代入口无需 OAuth callback。</text>
|
|
13
|
+
|
|
14
|
+
<path d="M278 222H326" stroke="#64748B" stroke-width="3" marker-end="url(#arrow)"/>
|
|
15
|
+
<path d="M560 222H608" stroke="#64748B" stroke-width="3" marker-end="url(#arrow)"/>
|
|
16
|
+
<path d="M842 222H890" stroke="#64748B" stroke-width="3" marker-end="url(#arrow)"/>
|
|
17
|
+
|
|
18
|
+
<g id="device" transform="translate(56 130)">
|
|
19
|
+
<rect width="222" height="184" rx="18" fill="#111821" stroke="#234A78" stroke-width="2"/>
|
|
20
|
+
<text x="22" y="36" fill="#93C5FD" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">01 · DEVICE</text>
|
|
21
|
+
<text x="22" y="78" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="24" font-weight="700">用户码</text>
|
|
22
|
+
<text x="22" y="114" fill="#CBD5E1" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">codex/device</text>
|
|
23
|
+
<rect x="22" y="139" width="132" height="28" rx="14" fill="#111F33"/>
|
|
24
|
+
<text x="38" y="159" fill="#93C5FD" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16">15 MINUTES</text>
|
|
25
|
+
</g>
|
|
26
|
+
|
|
27
|
+
<g id="poll" transform="translate(326 130)">
|
|
28
|
+
<rect width="234" height="184" rx="18" fill="#111821" stroke="#1F6F5A" stroke-width="2"/>
|
|
29
|
+
<text x="22" y="36" fill="#6EE7B7" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">02 · HOST</text>
|
|
30
|
+
<text x="22" y="78" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="24" font-weight="700">后台轮询</text>
|
|
31
|
+
<text x="22" y="114" fill="#CBD5E1" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="18">交换授权码与令牌</text>
|
|
32
|
+
<text x="22" y="153" fill="#94A3B8" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="17">可取消 · 可超时</text>
|
|
33
|
+
</g>
|
|
34
|
+
|
|
35
|
+
<g id="credential" transform="translate(608 130)">
|
|
36
|
+
<rect width="234" height="184" rx="18" fill="#111821" stroke="#1F6F5A" stroke-width="2"/>
|
|
37
|
+
<text x="22" y="36" fill="#6EE7B7" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">03 · CREDENTIAL</text>
|
|
38
|
+
<text x="22" y="78" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="24" font-weight="700">本地凭据</text>
|
|
39
|
+
<text x="22" y="114" fill="#CBD5E1" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="18">原子写入 · 自动刷新</text>
|
|
40
|
+
<rect x="22" y="139" width="126" height="28" rx="14" fill="#102A24"/>
|
|
41
|
+
<text x="38" y="159" fill="#6EE7B7" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16">OWNER ONLY</text>
|
|
42
|
+
</g>
|
|
43
|
+
|
|
44
|
+
<g id="dsh" transform="translate(890 130)">
|
|
45
|
+
<rect width="254" height="184" rx="18" fill="#111821" stroke="#334155" stroke-width="2"/>
|
|
46
|
+
<text x="22" y="36" fill="#CBD5E1" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">04 · DSH</text>
|
|
47
|
+
<text x="22" y="78" fill="#F8FAFC" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="24" font-weight="700">模型 + 用量</text>
|
|
48
|
+
<text x="22" y="114" fill="#CBD5E1" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">openai-codex</text>
|
|
49
|
+
<text x="22" y="149" fill="#94A3B8" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="18">状态与额度摘要</text>
|
|
50
|
+
</g>
|
|
51
|
+
|
|
52
|
+
<path d="M82 365H1118" stroke="#334155" stroke-width="2"/>
|
|
53
|
+
<circle cx="82" cy="365" r="6" fill="#93C5FD"/>
|
|
54
|
+
<text x="104" y="371" fill="#CBD5E1" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif" font-size="17">备用:Browser OAuth + PKCE + state → 临时 localhost:1455/auth/callback listener</text>
|
|
55
|
+
<text x="600" y="420" text-anchor="middle" fill="#6EE7B7" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">SAME-ORIGIN MANAGEMENT · HOST-ONLY TOKENS</text>
|
|
56
|
+
</svg>
|