Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions PR_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# PR 说明(codex-console2 -> codex-console)

## 结论摘要
本次 PR 基于 `K:\github\codex-console2` 对比原仓库 `K:\github\codex-console`,当前实际代码差异为 **1 项**:
- 删除 GitHub Actions 工作流文件:`.github/workflows/docker-publish.yml`

除上述文件外,其余同名文件内容一致(按全量哈希比对)。

## 修改方案
### 目标
- 清理不需要的镜像发布流水线配置,保持当前仓库 CI 行为可控。

### 实施内容
- 移除:`.github/workflows/docker-publish.yml`

## 涉及文件
- 删除文件:`.github/workflows/docker-publish.yml`

## 影响范围
### 直接影响
- 仓库将不再触发该文件定义的 Docker 发布工作流。

### 间接影响
- 如果团队仍依赖该 workflow 进行镜像发布,发布链路会中断;需改由其它 workflow 或手动流程执行。

## 验证结果
- 已完成目录级全量比对(`K:\github\codex-console2` vs `K:\github\codex-console`):
- 同名文件:108
- 同名文件内容差异:0
- 新增文件:0
- 删除文件:1(即上述 workflow 文件)

## 回滚方案
如需回滚本次变更:
1. 从原仓库 `K:\github\codex-console` 恢复 `.github/workflows/docker-publish.yml`。
2. 提交回滚 commit 并重新触发 CI 验证。

## 风险评估
- 风险等级:低(仅 CI 配置变更)
- 关注点:确认团队当前是否仍需要该 Docker 发布流水线。

## 建议的 PR 标题
- `chore(ci): remove docker-publish workflow`

## 建议的 Commit Message
- `chore(ci): remove .github/workflows/docker-publish.yml`
74 changes: 20 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/)

- 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)
- 交流群: https://qm.qq.com/q/ZTCKxawxeo

## 致谢

首先感谢上游项目作者 [cnlimiter](https://github.com/cnlimiter) 提供的优秀基础工程。

本仓库是在原项目思路和结构之上进行兼容性修复、流程调整和体验优化,适合作为一个“当前可用的修复维护版”继续使用。

## 版本更新
## 这个分支修了什么

### v1.0
为适配当前注册链路,这个分支重点补了下面几个问题:

1. 新增 Sentinel POW 求解逻辑
OpenAI 现在会强制校验 Sentinel POW,原先直接传空值已经不行了,这里补上了实际求解流程。
Expand All @@ -41,52 +38,6 @@
5. 优化终端和 Web UI 提示文案
保留可读性的前提下,把一些提示改得更友好一点,出错时至少不至于像在挨骂。

### v1.1

1. 修复注册流程中的问题,解决 Outlook 和临时邮箱收不到邮件导致注册卡住、无法完成注册的问题。

2. 修复无法检查订阅状态的问题,提升订阅识别和状态检查的可用性。

3. 新增绑卡半自动模式,支持自动随机地址;3DS 无法跳过,需按实际流程完成验证。

4. 新增已订阅账号管理功能,支持查看和管理账号额度。

5. 新增后台日志功能,并补充数据导出与导入能力,方便排查问题和迁移数据。

6. 优化部分 UI 细节与交互体验,减少页面操作时的割裂感。

7. 补充细节稳定性处理,尽量减少注册、订阅检测和账号管理过程中出现卡住或误判的情况。

### v1.1.1

1. 新增 `CloudMail` 邮箱服务实现,并完成服务注册、配置接入、邮件轮询、验证码提取和基础收件处理能力。

2. 新增上传目标 `newApi` 支持,可根据配置选择不同导入目标类型。

3. 新增 `Codex` 账号导出格式,支持后续登录、迁移和导入使用。

4. 新增 `CPA` 认证文件 `proxy_url` 支持,现可在 CPA 服务配置中保存和使用代理地址。

5. 优化 OAuth token 刷新兼容逻辑,完善异常返回与一次性令牌场景处理,降低刷新报错概率。

6. 优化批量验证流程,改为受控并发执行,减少长时间阻塞和卡死问题。

7. 修复模板渲染兼容问题,提升不同 Starlette 版本下页面渲染稳定性。

8. 修复六位数字误判为 OTP 的问题,避免邮箱域名或无关文本中的六位数字被错误识别为验证码。

9. 新增 Outlook 账户“注册状态”识别与展示功能,可直接看到“已注册/未注册”,并支持显示关联账号编号(如“已注册 #1”)。

10. 修复 Outlook 邮箱匹配大小写问题,避免 Outlook.com 因大小写差异被误判为未注册。

11. 修复 Outlook 列表列错位、乱码和占位文案问题,恢复中文显示并优化列表信息布局。

12. 优化 WebUI 端口冲突处理,默认端口占用时自动切换可用端口。

13. 增加启动时轻量字段迁移逻辑,自动补齐新增字段,提升旧数据升级兼容性。

14. 批量注册上限由 `100` 提升至 `1000`(前后端同步)。

## 核心能力

- Web UI 管理注册任务和账号数据
Expand Down Expand Up @@ -262,10 +213,25 @@ dist/codex-console-windows-X64.exe

`codex-console`

## 安全基线说明(新增)

- `/api/*` 与 `/api/ws/*` 已统一接入登录鉴权。
- 首次启动检测到默认口令或默认密钥时,会强制跳转到 `/setup-password` 完成改密。
- 支付相关 API Key 不再使用代码内硬编码默认值,需通过环境变量或配置显式提供。

## 数据库迁移(Alembic)

```bash
alembic revision --autogenerate -m "your_change"
alembic upgrade head
```

初始化与更多说明见:

- `alembic/README.md`

## 免责声明

本项目仅供学习、研究和技术交流使用,请遵守相关平台和服务条款,不要用于违规、滥用或非法用途。

因使用本项目产生的任何风险和后果,由使用者自行承担。


38 changes: 38 additions & 0 deletions alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[alembic]
script_location = alembic
prepend_sys_path = .
sqlalchemy.url = sqlite:///data/database.db

[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers = console
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
25 changes: 25 additions & 0 deletions alembic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Alembic Migration Guide

## Initialize current schema baseline

```bash
alembic revision --autogenerate -m "baseline"
alembic upgrade head
```

## Create new migration

```bash
alembic revision --autogenerate -m "add_xxx"
```

## Upgrade / Downgrade

```bash
alembic upgrade head
alembic downgrade -1
```

Notes:
- The DB URL is read from `alembic.ini` first.
- If not set, Alembic falls back to `src.config.settings.get_database_url()`.
61 changes: 61 additions & 0 deletions alembic/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from __future__ import annotations

from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config, pool

from src.config.settings import get_database_url
from src.database.models import Base

config = context.config

if config.config_file_name is not None:
fileConfig(config.config_file_name)

target_metadata = Base.metadata


def _resolve_database_url() -> str:
configured = str(config.get_main_option("sqlalchemy.url") or "").strip()
if configured:
return configured
try:
return get_database_url()
except Exception:
return "sqlite:///data/database.db"


def run_migrations_offline() -> None:
url = _resolve_database_url()
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
compare_type=True,
)

with context.begin_transaction():
context.run_migrations()


def run_migrations_online() -> None:
section = config.get_section(config.config_ini_section) or {}
section["sqlalchemy.url"] = _resolve_database_url()
connectable = engine_from_config(
section,
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)

with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata, compare_type=True)
with context.begin_transaction():
context.run_migrations()


if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
26 changes: 26 additions & 0 deletions alembic/script.py.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""${message}

Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from __future__ import annotations

from alembic import op
import sqlalchemy as sa

${imports if imports else ""}

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}


def upgrade() -> None:
${upgrades if upgrades else "pass"}


def downgrade() -> None:
${downgrades if downgrades else "pass"}
1 change: 1 addition & 0 deletions alembic/versions/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 0 additions & 1 deletion codex_register.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ a = Analysis(
'src.core.utils',
'src.services.base',
'src.services.tempmail',
'src.services.yyds_mail',
'src.services.moe_mail',
'src.services.outlook',
'src.services.outlook.account',
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "codex-console"
version = "1.1.1"
version = "1.0.4"
description = "OpenAI account management console"
requires-python = ">=3.10"
dependencies = [
Expand All @@ -12,6 +12,7 @@ dependencies = [
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
"sqlalchemy>=2.0.0",
"alembic>=1.13.0",
"aiosqlite>=0.19.0",
"psycopg[binary]>=3.1.18",
"websockets>=16.0",
Expand Down
Loading
Loading