This commit is contained in:
xiaobai committed 2026-03-24 17:25:29 +08:00
1 parent 0c740f5a53
commit a1867fd03e
5 files changed
+26 -12

No files matched your search

+9 -6
View File
@@ -8,6 +8,8 @@ from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Optional
from maintain.paths_config import CPA_AUTHS_DIR
ROOT = Path(__file__).resolve().parent.parent
DB_PATH = ROOT / "maintain" / "data" / "maintain.db"
ACCOUNTS_OAUTH = ROOT / "accounts" / "oauth"
@@ -18,11 +20,12 @@ _lock = threading.Lock()
def resolve_oauth_stats_dir() -> Path:
"""
统计 / 巡检用的 codex JSON 目录。
留空 = 项目内 accounts/oauth;若注册成功后文件迁入 Cliproxy auth 目录,填该目录绝对路径。
配置留空时使用 maintain/paths_config.CPA_AUTHS_DIR(部署时写死挂载点)。
若需退回项目内目录,在「配置编辑」显式填项目 accounts/oauth 绝对路径。
"""
raw = get_setting("codex_stats_oauth_dir", "").strip()
if not raw:
return ACCOUNTS_OAUTH.resolve()
return Path(CPA_AUTHS_DIR).expanduser().resolve()
return Path(raw).expanduser().resolve()
@@ -92,7 +95,7 @@ def init_db() -> None:
if cur.fetchone()[0] == 0:
c.execute(
"INSERT INTO cpa (name, code, target_count, api_base_url) VALUES (?,?,?,?)",
("账号池", "default", 8000, ""),
("账号池", "default", 500, ""),
)
defaults = {
"auto_inspect_enabled": "0",
@@ -107,7 +110,7 @@ def init_db() -> None:
"pipeline_interval_min": "10",
"pipeline_run_script": str(ROOT / "run.py"),
"pipeline_oauth_dir": str(ROOT / "accounts" / "oauth"),
"cpa_target_dir": str(ROOT / "export" / "cpa_auths"),
"cpa_target_dir": CPA_AUTHS_DIR,
"pipeline_python_bin": "python3",
"run_subprocess_timeout_sec": "480",
"cpa_exit_on_empty": "0",
@@ -120,8 +123,8 @@ def init_db() -> None:
"cliproxy_sweeper_threshold": "3",
"cliproxy_sweeper_run_mode": "delete",
"cliproxy_sweeper_allow_name_fallback": "1",
# 成功后 JSON 若在 Cliproxy auth 目录,填绝对路径;留空则用项目 accounts/oauth
"codex_stats_oauth_dir": "",
# 与 paths_config.CPA_AUTHS_DIR 一致;可在 Web 里改
"codex_stats_oauth_dir": CPA_AUTHS_DIR,
"inspect_probe_valid_json": "",
"pipeline_state_file": str(ROOT / "maintain" / "data" / "pipeline_state.json"),
"pipeline_log_file": str(ROOT / "maintain" / "data" / "pipeline.log"),