完善自动注册代理和状态恢复
This commit is contained in:
@@ -23,7 +23,7 @@ from core.sms_provider import parse_sms_lines
|
||||
|
||||
from ..database import SessionLocal, get_db
|
||||
from ..deps import authenticate_websocket, get_current_user, require_permission
|
||||
from ..models import HuyaAccount, HuyaConfig, HuyaGoodsSnapshot, HuyaRechargeGoodsSnapshot, HuyaTask, User
|
||||
from ..models import HuyaAccount, HuyaConfig, HuyaGoodsSnapshot, HuyaRechargeGoodsSnapshot, HuyaTask, ProxyConfig, User
|
||||
from ..permissions import user_has_permission
|
||||
from ..schemas import (
|
||||
AccountAssign,
|
||||
@@ -344,6 +344,7 @@ def sms_login_account(
|
||||
@router.post("/register/batches", response_model=HuyaAutoRegisterBatchOut)
|
||||
def create_auto_register_batch(
|
||||
req: HuyaAutoRegisterRequest,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(get_current_user),
|
||||
):
|
||||
"""启动虎牙手机号自动注册批次。"""
|
||||
@@ -352,6 +353,7 @@ def create_auto_register_batch(
|
||||
if not sms_lines:
|
||||
raise HTTPException(status_code=400, detail="没有识别到有效手机号,格式为:手机号----短信查询URL")
|
||||
|
||||
proxy_config = db.query(ProxyConfig).first() if req.use_proxy else None
|
||||
runner = huya_register_registry.create(
|
||||
sms_lines=sms_lines,
|
||||
tag=req.tag.strip(),
|
||||
@@ -361,6 +363,8 @@ def create_auto_register_batch(
|
||||
poll_interval=req.poll_interval,
|
||||
password_prefix=req.password_prefix,
|
||||
fixed_password=req.fixed_password,
|
||||
use_proxy=req.use_proxy,
|
||||
proxy_config=proxy_config,
|
||||
)
|
||||
thread = threading.Thread(target=runner.run, daemon=True)
|
||||
thread.start()
|
||||
|
||||
Reference in New Issue
Block a user