From b1cc714d7550f10efdf9e0be039bf50647737ea2 Mon Sep 17 00:00:00 2001 From: doujiang <527191253@qq.com> Date: Tue, 31 Mar 2026 22:34:25 +0800 Subject: [PATCH 1/2] release: prepare v1.1.2 --- .env.example | 7 + .github/workflows/build.yml | 8 + .github/workflows/tests.yml | 31 + README.md | 264 +- alembic.ini | 38 + alembic/README.md | 25 + alembic/env.py | 61 + alembic/script.py.mako | 26 + alembic/versions/.gitkeep | 1 + docs/assets/alipay-pay.png | Bin 0 -> 280223 bytes docs/assets/wechat-pay.png | Bin 0 -> 103777 bytes pyproject.toml | 3 +- release/v1.1.2.md | 34 + requirements.txt | 1 + src/__init__.py | 23 +- src/config/__init__.py | 2 + src/config/constants.py | 78 +- src/config/project_notice.py | 21 +- src/config/settings.py | 230 +- src/core/__init__.py | 33 +- src/core/anyauto/__init__.py | 0 src/core/anyauto/chatgpt_client.py | 911 +++++ src/core/anyauto/oauth_client.py | 1614 ++++++++ src/core/anyauto/register_flow.py | 405 ++ src/core/anyauto/sentinel_token.py | 206 + src/core/anyauto/utils.py | 362 ++ src/core/auto_registration.py | 297 ++ src/core/circuit_breaker.py | 212 + src/core/db_logs.py | 4 +- src/core/openai/overview.py | 106 +- src/core/openai/payment.py | 96 +- src/core/openai/token_refresh.py | 7 +- src/core/register.py | 220 +- src/core/system_selfcheck.py | 1311 ++++++ src/core/timezone_utils.py | 6 +- src/core/upload/cpa_upload.py | 67 +- src/core/upload/new_api_upload.py | 225 ++ src/core/utils.py | 9 +- src/database/__init__.py | 14 +- src/database/crud.py | 535 ++- src/database/models.py | 201 +- src/database/session.py | 175 + src/services/__init__.py | 6 + src/services/luckmail_mail.py | 1051 +++++ src/services/outlook/account.py | 2 +- src/services/outlook_legacy_mail.py | 6 +- src/services/temp_mail.py | 122 +- src/services/tempmail.py | 2 +- src/services/yyds_mail.py | 448 +++ src/web/app.py | 370 +- src/web/auth.py | 95 + src/web/auto_quick_refresh_scheduler.py | 304 ++ src/web/repositories/__init__.py | 4 + src/web/repositories/account_repository.py | 56 + src/web/routes/__init__.py | 8 + src/web/routes/accounts.py | 252 +- src/web/routes/auto_team.py | 3516 +++++++++++++++++ src/web/routes/email.py | 142 +- src/web/routes/logs.py | 6 +- src/web/routes/payment.py | 102 +- src/web/routes/registration.py | 1119 +++++- src/web/routes/selfcheck.py | 440 +++ src/web/routes/settings.py | 232 +- src/web/routes/tasks.py | 193 + src/web/routes/upload/cpa_services.py | 5 +- src/web/routes/upload/new_api_services.py | 199 + src/web/routes/upload/sub2api_services.py | 5 +- src/web/routes/upload/tm_services.py | 5 +- src/web/routes/websocket.py | 9 + src/web/schedule_utils.py | 106 + src/web/scheduler.py | 125 + src/web/selfcheck_scheduler.py | 247 ++ src/web/services/__init__.py | 4 + src/web/services/accounts_service.py | 17 + src/web/task_manager.py | 278 +- static/css/style.css | 434 +- static/js/accounts.js | 1146 +++++- static/js/accounts_overview.js | 251 +- static/js/app.js | 1075 ++++- static/js/auto_team.js | 990 +++++ static/js/auto_team_manage.js | 1172 ++++++ static/js/card_pool.js | 831 ++++ static/js/email_services.js | 227 +- static/js/payment.js | 1251 +++++- static/js/selfcheck.js | 559 +++ static/js/settings.js | 360 +- static/js/utils.js | 352 +- tags/v1.1.2.json | 1 + templates/accounts.html | 284 +- templates/accounts_overview.html | 75 +- templates/auto_team.html | 1146 +++++- templates/card_pool.html | 402 +- templates/email_services.html | 175 +- templates/index.html | 258 +- templates/login.html | 13 + templates/logs.html | 12 +- templates/partials/site_footer.html | 25 + templates/partials/site_notice.html | 47 +- templates/payment.html | 224 +- templates/selfcheck.html | 349 ++ templates/settings.html | 179 +- templates/setup_password.html | 84 + tests/test_auto_quick_refresh_routes.py | 125 + tests/test_auto_registration_merge.py | 105 + tests/test_email_service_yyds_routes.py | 137 + tests/test_frontend_new_api_presence.py | 23 + tests/test_new_api_services.py | 17 + tests/test_new_api_upload.py | 117 + tests/test_registration_new_api.py | 117 + tests/test_registration_password_hardening.py | 51 + tests/test_retry_policy_markers.py | 21 + tests/test_security_and_task_routes.py | 35 + .../test_settings_registration_auto_fields.py | 149 + tests/test_yyds_mail_service.py | 147 + webui.py | 59 +- 115 files changed, 28970 insertions(+), 1400 deletions(-) create mode 100644 .github/workflows/tests.yml create mode 100644 alembic.ini create mode 100644 alembic/README.md create mode 100644 alembic/env.py create mode 100644 alembic/script.py.mako create mode 100644 alembic/versions/.gitkeep create mode 100644 docs/assets/alipay-pay.png create mode 100644 docs/assets/wechat-pay.png create mode 100644 release/v1.1.2.md create mode 100644 src/core/anyauto/__init__.py create mode 100644 src/core/anyauto/chatgpt_client.py create mode 100644 src/core/anyauto/oauth_client.py create mode 100644 src/core/anyauto/register_flow.py create mode 100644 src/core/anyauto/sentinel_token.py create mode 100644 src/core/anyauto/utils.py create mode 100644 src/core/auto_registration.py create mode 100644 src/core/circuit_breaker.py create mode 100644 src/core/system_selfcheck.py create mode 100644 src/core/upload/new_api_upload.py create mode 100644 src/services/luckmail_mail.py create mode 100644 src/services/yyds_mail.py create mode 100644 src/web/auth.py create mode 100644 src/web/auto_quick_refresh_scheduler.py create mode 100644 src/web/repositories/__init__.py create mode 100644 src/web/repositories/account_repository.py create mode 100644 src/web/routes/auto_team.py create mode 100644 src/web/routes/selfcheck.py create mode 100644 src/web/routes/tasks.py create mode 100644 src/web/routes/upload/new_api_services.py create mode 100644 src/web/schedule_utils.py create mode 100644 src/web/scheduler.py create mode 100644 src/web/selfcheck_scheduler.py create mode 100644 src/web/services/__init__.py create mode 100644 src/web/services/accounts_service.py create mode 100644 static/js/auto_team.js create mode 100644 static/js/auto_team_manage.js create mode 100644 static/js/card_pool.js create mode 100644 static/js/selfcheck.js create mode 100644 tags/v1.1.2.json create mode 100644 templates/partials/site_footer.html create mode 100644 templates/selfcheck.html create mode 100644 templates/setup_password.html create mode 100644 tests/test_auto_quick_refresh_routes.py create mode 100644 tests/test_auto_registration_merge.py create mode 100644 tests/test_email_service_yyds_routes.py create mode 100644 tests/test_frontend_new_api_presence.py create mode 100644 tests/test_new_api_services.py create mode 100644 tests/test_new_api_upload.py create mode 100644 tests/test_registration_new_api.py create mode 100644 tests/test_registration_password_hardening.py create mode 100644 tests/test_retry_policy_markers.py create mode 100644 tests/test_security_and_task_routes.py create mode 100644 tests/test_settings_registration_auto_fields.py create mode 100644 tests/test_yyds_mail_service.py diff --git a/.env.example b/.env.example index 821fd168..c16511c9 100644 --- a/.env.example +++ b/.env.example @@ -24,3 +24,10 @@ # 第三方绑卡 API Key(可留空,后端会先尝试无鉴权) # BIND_CARD_API_KEY=your_api_key_here + +# ── 卡商 EFun(aimizy bindcard)接口版(可选) ─────────────── +# vendor_efun 模式接口地址(默认 https://card.aimizy.com/api/v1/bindcard) +# VENDOR_BINDCARD_API_URL=https://card.aimizy.com/api/v1/bindcard + +# vendor_efun 模式接口 Bearer Token +# VENDOR_BINDCARD_API_KEY=your_vendor_api_key_here diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 803b6333..594c8160 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,9 +25,15 @@ jobs: - os: ubuntu-latest source_name: codex-console asset_name: codex-console-linux-x64 + - os: ubuntu-24.04-arm + source_name: codex-console + asset_name: codex-console-linux-arm64 - os: macos-latest source_name: codex-console asset_name: codex-console-macos-arm64 + - os: macos-26-intel + source_name: codex-console + asset_name: codex-console-macos-amd64 steps: - name: Checkout code @@ -89,8 +95,10 @@ jobs: | Platform | File | |------|------| | Windows x64 | `codex-console-windows-x64.exe` | + | Linux ARM64 | `codex-console-linux-arm64` | | Linux x64 | `codex-console-linux-x64` | | macOS ARM64 | `codex-console-macos-arm64` | + | macOS AMD64 | `codex-console-macos-amd64` | ### Usage ```bash diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..321eb064 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Python Tests + +on: + push: + branches: ["main", "master"] + pull_request: + branches: ["main", "master"] + workflow_dispatch: + +jobs: + pytest: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest httpx + + - name: Run tests + run: | + pytest -q diff --git a/README.md b/README.md index 520234b4..cbd34484 100644 --- a/README.md +++ b/README.md @@ -1,188 +1,136 @@ # codex-console -基于 [cnlimiter/codex-manager](https://github.com/cnlimiter/codex-manager) 持续修复和维护的增强版本。 - -这个版本的目标很直接: 把近期 OpenAI 注册链路里那些“昨天还能跑,今天突然翻车”的坑补上,让注册、登录、拿 token、打包运行都更稳一点。 - [](LICENSE) [](https://www.python.org/) +[](https://github.com/dou-jiang/codex-console/releases) -- GitHub Repo: [https://github.com/dou-jiang/codex-console](https://github.com/dou-jiang/codex-console) - -## QQ群 - -- 交流群: [291638849(点击加群)](https://qm.qq.com/q/4TETC3mWco) -- Telegram 频道: [codex_console](https://t.me/codex_console) - -## 致谢 - -首先感谢上游项目作者 [cnlimiter](https://github.com/cnlimiter) 提供的优秀基础工程。 - -本仓库是在原项目思路和结构之上进行兼容性修复、流程调整和体验优化,适合作为一个“当前可用的修复维护版”继续使用。 - -## 版本更新 - -### v1.0 - -1. 新增 Sentinel POW 求解逻辑 - OpenAI 现在会强制校验 Sentinel POW,原先直接传空值已经不行了,这里补上了实际求解流程。 - -2. 注册和登录拆成两段 - 现在注册完成后通常不会直接返回可用 token,而是跳转到绑定手机或后续页面。 - 本分支改成“先注册成功,再单独走一次登录流程拿 token”,避免卡死在旧逻辑里。 - -3. 去掉重复发送验证码 - 登录流程里服务端本身会自动发送验证码邮件,旧逻辑再手动发一次,容易让新旧验证码打架。 - 现在改成直接等待系统自动发来的那封验证码邮件。 - -4. 修复重新登录流程的页面判断问题 - 针对重新登录时页面流转变化,调整了登录入口和密码提交逻辑,减少卡在错误页面的情况。 - -5. 优化终端和 Web UI 提示文案 - 保留可读性的前提下,把一些提示改得更友好一点,出错时至少不至于像在挨骂。 - -### v1.1 - -1. 修复注册流程中的问题,解决 Outlook 和临时邮箱收不到邮件导致注册卡住、无法完成注册的问题。 - -2. 修复无法检查订阅状态的问题,提升订阅识别和状态检查的可用性。 - -3. 新增绑卡半自动模式,支持自动随机地址;3DS 无法跳过,需按实际流程完成验证。 +基于 [cnlimiter/codex-manager](https://github.com/cnlimiter/codex-manager) 持续修复、整合并增强的维护版本,重点补齐当前 OpenAI / Codex CLI 注册链路、任务调度、邮箱服务、支付绑定、系统自检与 Web 管理能力。 -4. 新增已订阅账号管理功能,支持查看和管理账号额度。 +项目地址: -5. 新增后台日志功能,并补充数据导出与导入能力,方便排查问题和迁移数据。 +- GitHub: [https://github.com/dou-jiang/codex-console](https://github.com/dou-jiang/codex-console) +- Blog: [https://blog.cysq8.cn/](https://blog.cysq8.cn/) -6. 优化部分 UI 细节与交互体验,减少页面操作时的割裂感。 +## v1.1.2 更新内容 -7. 补充细节稳定性处理,尽量减少注册、订阅检测和账号管理过程中出现卡住或误判的情况。 +`v1.1.2` 主要整合并落地了多组 PR 与后续修复,当前版本重点包括: -### v1.1.1 +- 统一鉴权与安全基线:新增 `auth.py`、首次改密页、API 与 WebSocket 鉴权统一收口。 +- 自动注册链路增强:补齐自动补货、库存监控、批次取消感知、注册重试与 PR60 anyauto V2 回退链路。 +- 系统自检与修复中心:新增自检路由、页面、调度器和运行记录。 +- 统一任务中心:将注册、支付、自检、Auto Team 等任务状态统一管理。 +- 周期任务调度:支持计划任务创建、启停、立即执行与前端管理。 +- New-API 上传:支持独立服务配置、测试、单账号和批量上传,以及注册成功后自动上传。 +- Auto Team 模块:新增后端接口与前端管理页面。 +- 卡池与绑卡能力:增加卡池管理、上游对接与自动绑卡支持。 +- 邮箱服务扩展:补齐 CloudMail、LuckMail、YYDS Mail 等邮箱服务,并保留原有邮件链路。 +- 数据库迁移体系:引入 Alembic,补齐迁移目录与说明。 +- 测试与 CI:补充多组接口、任务、注册与上传相关测试,并加入测试工作流。 -1. 新增 `CloudMail` 邮箱服务实现,并完成服务注册、配置接入、邮件轮询、验证码提取和基础收件处理能力。 - -2. 新增上传目标 `newApi` 支持,可根据配置选择不同导入目标类型。 - -3. 新增 `Codex` 账号导出格式,支持后续登录、迁移和导入使用。 - -4. 新增 `CPA` 认证文件 `proxy_url` 支持,现可在 CPA 服务配置中保存和使用代理地址。 - -5. 优化 OAuth token 刷新兼容逻辑,完善异常返回与一次性令牌场景处理,降低刷新报错概率。 - -6. 优化批量验证流程,改为受控并发执行,减少长时间阻塞和卡死问题。 - -7. 修复模板渲染兼容问题,提升不同 Starlette 版本下页面渲染稳定性。 - -8. 修复六位数字误判为 OTP 的问题,避免邮箱域名或无关文本中的六位数字被错误识别为验证码。 +## 核心能力 -9. 新增 Outlook 账户“注册状态”识别与展示功能,可直接看到“已注册/未注册”,并支持显示关联账号编号(如“已注册 #1”)。 +- Web UI 管理注册、支付、账号、自检、日志、卡池、Auto Team 等功能。 +- 支持单任务、批量任务、自动补货、定时任务、任务暂停/继续/取消/重试。 +- 支持多种邮箱服务:Tempmail、YYDS Mail、Outlook、CloudMail、LuckMail、DuckMail、Freemail、IMAP、Temp-Mail 自部署等。 +- 支持支付链接、绑卡任务、卡池管理、账户快照保留、审计日志。 +- 支持 CPA、Sub2API、Team Manager、New-API 等上传链路。 +- 支持 SQLite 与 PostgreSQL。 +- 支持 Windows / Linux / macOS 打包。 -10. 修复 Outlook 邮箱匹配大小写问题,避免 Outlook.com 因大小写差异被误判为未注册。 +## Blog 说明 -11. 修复 Outlook 列表列错位、乱码和占位文案问题,恢复中文显示并优化列表信息布局。 +维护者会在 Blog 持续更新以下内容: -12. 优化 WebUI 端口冲突处理,默认端口占用时自动切换可用端口。 +- 部署教程与环境配置说明 +- 版本更新日志与 Release 说明 +- 常见问题、报错排查和修复记录 +- 邮箱服务、上传服务、任务调度等功能的使用说明 +- 与上游变化相关的兼容性调整说明 -13. 增加启动时轻量字段迁移逻辑,自动补齐新增字段,提升旧数据升级兼容性。 +访问地址: -14. 批量注册上限由 `100` 提升至 `1000`(前后端同步)。 +- [https://blog.cysq8.cn/](https://blog.cysq8.cn/) -15. 公告区改为固定文案与固定链接,强化“永久免费开源、禁止倒卖、付费请退款”提示,并新增爱发电支持入口。 +## 赞助支持 -## 核心能力 +如果这个项目对你有帮助,欢迎赞助支持项目继续维护与更新。 -- Web UI 管理注册任务和账号数据 -- 支持批量注册、日志实时查看、基础任务管理 -- 支持多种邮箱服务接码 -- 支持 SQLite 和远程 PostgreSQL -- 支持打包为 Windows/Linux/macOS 可执行文件 -- 更适配当前 OpenAI 注册与登录链路 +
|
+ 微信赞助 +
+ |
+
+ 支付宝赞助 +
+ |
+
sH6g`@Cb4b^2sXsCOs^GKZNI!-
zxO2YQyog}@v=wLhoc%1eV*ZN1p%38os&(;{l_=UYiXMv^xJYl~+!Exl0THb}tz;-a
z6W lb_xf48TkCV ZQgp;qO1BD;eqB-Gg%`BI;GeyboQ>on`n16E|uf4H=Gqyg@N4?oGbw(qxKl
z@El42Ye6gyX*r+&dZ`D?Y-Nu}{Ra!)2Wqwth2-TU4&QA5A<@f6vkn9zY>q8nWc4lC
znApwuLw}Hy>QC%VeumG7vwyJq?e$Q{e*@8zf3^1k`tf@R7w^9zY5r{#`~82y<_7B1
zk8xyzYD1z6l2<|GEaHRJx8?Xr%mn=0ALm`o(f@*{8O}*8=&3RYjQCOG7%?p+kf2wA
zy41HI-pArX>j 2bmx_XrYP0-
zWh#9=GEBo{D<^cv)2>sqHQU}V>kPeVr0$r5^IB*B;`6DK8Fq`lay|sLBx)ArN%Bco
z>-HW(#_S_8l?l=Yrg4UMxJq&HHKz^N7<;a&YMu+Sp={~nscWGt54}Ec^Nb;j|BF5x
zz4)BqDx8|Q|F>jeW4#rP0-XB24bFXLm(I;SjHZ>wbl9+L?#Twq#pk%5f1ESyJzrS1
zez^*dwHbj)g!W`%=&71YyfW4|OK3xgI(is|tiy20u|2pCAKYDFTghr9)xg^x_KEnk
zWM}=$!vav&V>-V?eA7cCzE~hxbEJVNI{8jMZS67o=XLyi+pkQbGPDcYniroZX;2P)Jyl*y$UVY^eGjV43uHwWgKd0g4gvs*NH?Ae`I~`M-L^;KtC8Kl(vDVQ>1A`n{
zOg0zVv;cG^OiKKk-#p>}X~)cW6YCPao+NC!md}?^jal0iQZA9lPWnWOK?8nyjI6ls
zxR=MfZ{gVMN7ch$?`r@852f|%g$3AmVCWEH0cg;)_i!MBm|uP#+>de=(8N^WmO=Ba
zs%%KNYUo?yzpW|b2v%)yDeZ9IgwzeS>N5A!%g=bAOc+CZ#cKdQqYI>J0v~|>50Wg9
zD~WHu=6v8yIGRjw
gD}i8jqh=o`}|O#{jJgZTUqxXb*z8$kpJKE
zkYAezN1ukk=}7*6=Dqy)|Nf_y6rZL4Ixd`^f&^JC^?)SRlW){(WTs(~hj|?<4!4
zc4X~;AKCx3BcuF%WdGBStnu$7`=54XP5
w)y)B4o|2RjgX1TRR-v333ikc6fpadbgPgZFYDIqu%k~YOUtZ+SG++j+Hu^`+
zqW9