Add bblbb mail provider and CPA push queue; sync runtime artifacts.

Switch default email provider to mail.bblbb.com, queue failed CPA auth pushes for retry, and refresh local auth/account outputs.
This commit is contained in:
chaos committed 2026-07-14 09:14:06 +08:00
1 parent a4dbe948b2
commit df9213463d
710 files changed
+742 -13418

No files matched your search

+45 -20
View File
@@ -158,24 +158,26 @@ def convert_one(
remote_base = str(cfg.get("cpa_remote_base") or "").strip()
secret = str(cfg.get("cpa_remote_secret") or "").strip()
if remote_base and secret:
try:
ok, status, text = cpa.push_auth_file(
remote_base=remote_base,
secret=secret,
filename=Path(path).name,
payload=payload,
proxy=str(cfg.get("cpa_push_proxy") or "").strip() or None,
verify_tls=bool(cfg.get("cpa_remote_verify_tls", True)),
)
result["pushed"] = ok
result["push_status"] = status
if ok:
log(f"pushed HTTP {status}")
else:
log(f"push fail HTTP {status}: {text[:160]}")
except Exception as exc: # noqa: BLE001
log(f"push error: {exc}")
result["push_error"] = str(exc)
# 仅首条在 convert 前统一 flush;这里 flush_first=False 避免并发重复重试
push_res = cpa.push_with_queue(
out_dir,
Path(path).name,
payload,
remote_base=remote_base,
secret=secret,
proxy=str(cfg.get("cpa_push_proxy") or "").strip() or None,
verify_tls=bool(cfg.get("cpa_remote_verify_tls", True)),
flush_first=False,
log=lambda m: log(m.replace("[Debug] ", "").replace("[!] ", "")),
)
result["pushed"] = bool(push_res.get("pushed"))
if "push_status" in push_res:
result["push_status"] = push_res["push_status"]
if push_res.get("push_error"):
result["push_error"] = push_res["push_error"]
else:
cpa.record_push_failure(out_dir, Path(path).name, "remote not configured")
log("push skipped: remote not configured (queued)")
return result
@@ -215,19 +217,42 @@ def main(argv: list[str] | None = None) -> int:
lock = threading.Lock()
total = len(records)
ok = fail = skipped = 0
do_push = args.push or bool(cfg.get("cpa_push_enabled"))
print(
f"开始转换 count={total} concurrency={args.concurrency} out={out_dir} proxy={proxy}",
flush=True,
)
# 开启推送时先重试历史失败队列,再处理本批
if do_push:
import cpa
remote_base = str(cfg.get("cpa_remote_base") or "").strip()
secret = str(cfg.get("cpa_remote_secret") or "").strip()
if remote_base and secret:
flush = cpa.flush_push_pending(
out_dir,
remote_base=remote_base,
secret=secret,
proxy=str(cfg.get("cpa_push_proxy") or "").strip() or None,
verify_tls=bool(cfg.get("cpa_remote_verify_tls", True)),
log=lambda m: print(m, flush=True),
)
if flush.get("total"):
print(
f"队列重推 ok={flush.get('ok')} fail={flush.get('fail')} "
f"missing={flush.get('missing')} remaining={flush.get('remaining')}",
flush=True,
)
if args.concurrency <= 1:
for i, rec in enumerate(records, 1):
r = convert_one(
rec,
out_dir=out_dir,
proxy=proxy,
push=args.push or bool(cfg.get("cpa_push_enabled")),
push=do_push,
cfg=cfg,
lock=lock,
index=i,
@@ -249,7 +274,7 @@ def main(argv: list[str] | None = None) -> int:
rec,
out_dir=out_dir,
proxy=proxy,
push=args.push or bool(cfg.get("cpa_push_enabled")),
push=do_push,
cfg=cfg,
lock=lock,
index=i,