refactor: sync running-container source back to repo for reproducible docker compose build; remove dead code (orphan pipeline.py + 104 stale files from iterative dev) and drop unused app/ mirror dir
This commit is contained in:
1 parent
1346fbbd4b
commit
5d7f32db0a
138 files changed
+12846
-84248
No files matched your search
@@ -226,14 +226,13 @@ PLATFORM_SLACK = {
|
||||
PLATFORM_CONFIGS = {
|
||||
"feishu": PLATFORM_FEISHU,
|
||||
"wechat": PLATFORM_WECHAT,
|
||||
"personal_wechat": PLATFORM_WECHAT,
|
||||
"dingtalk": PLATFORM_DINGTALK,
|
||||
"whatsapp": PLATFORM_WHATSAPP,
|
||||
"telegram": PLATFORM_TELEGRAM,
|
||||
"slack": PLATFORM_SLACK,
|
||||
}
|
||||
|
||||
VALID_PLATFORMS = ("feishu", "wechat", "personal_wechat", "wecom", "dingtalk", "whatsapp", "telegram", "slack")
|
||||
VALID_PLATFORMS = ("feishu", "wechat", "wecom", "dingtalk", "whatsapp", "telegram", "slack")
|
||||
|
||||
SENSITIVE_FIELDS = {"app_secret", "secret", "access_token", "bot_token", "signing_secret", "token",
|
||||
"api_key", "password", "encrypt_key", "verification_token", "app_token",
|
||||
@@ -424,21 +423,19 @@ def get_platform_configs():
|
||||
|
||||
@router.post("/authorize/scan")
|
||||
def scan_authorize(
|
||||
platform: str = Query(None),
|
||||
platform: str = Query(...),
|
||||
body: dict = Body({}),
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""扫码授权流程 - 返回授权二维码(微信平台统一调用ClawBot API)"""
|
||||
if not platform:
|
||||
platform = body.get("platform", "")
|
||||
if platform not in VALID_PLATFORMS:
|
||||
raise HTTPException(status_code=400, detail="不支持的平台类型")
|
||||
|
||||
platform_name = PLATFORM_CONFIGS.get(platform, {}).get("name", platform)
|
||||
|
||||
# 微信平台:调用微信ClawBot API获取授权二维码
|
||||
if platform in ("wechat", "personal_wechat"):
|
||||
if platform == "wechat":
|
||||
# 获取AppID和Secret(优先从请求体 > 已保存频道配置 > 环境变量)
|
||||
appid = ""
|
||||
secret = ""
|
||||
@@ -450,7 +447,7 @@ def scan_authorize(
|
||||
|
||||
# 查找已保存的微信频道
|
||||
existing_channel = db.query(Channel).filter(
|
||||
and_(Channel.platform.in_(["wechat", "personal_wechat"]), Channel.owner_id == current_user.id)
|
||||
and_(Channel.platform == "wechat", Channel.owner_id == current_user.id)
|
||||
).first()
|
||||
|
||||
# 2. 从已保存的频道配置获取
|
||||
@@ -618,15 +615,13 @@ def scan_authorize_status(
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""查询扫码授权状态(微信平台调用ClawBot API轮询)"""
|
||||
if not platform:
|
||||
platform = body.get("platform", "")
|
||||
if platform not in VALID_PLATFORMS:
|
||||
raise HTTPException(status_code=400, detail="不支持的平台类型")
|
||||
|
||||
# 微信平台:调用ClawBot API轮询扫码状态
|
||||
if platform in ("wechat", "personal_wechat"):
|
||||
if platform == "wechat":
|
||||
channel = db.query(Channel).filter(
|
||||
and_(Channel.platform.in_(["wechat", "personal_wechat"]), Channel.owner_id == current_user.id)
|
||||
and_(Channel.platform == "wechat", Channel.owner_id == current_user.id)
|
||||
).first()
|
||||
|
||||
qrcode_token = channel.oauth_state if channel else None
|
||||
@@ -1349,7 +1344,7 @@ def channel_reset(
|
||||
raise HTTPException(status_code=404, detail="频道不存在")
|
||||
|
||||
# 微信平台:调用ClawBot API重置通道
|
||||
if channel.platform in ("wechat", "personal_wechat"):
|
||||
if channel.platform == "wechat":
|
||||
# 获取AppID和Secret用于签名
|
||||
appid = os.environ.get("WECHAT_APPID", "")
|
||||
secret = os.environ.get("WECHAT_SECRET", "")
|
||||
|
||||
Reference in new issue
Block a user