- Add rl_handle_callback() to init.py: handles Volcengine H5 auth callback, queries vendor for result, registers rl_org_group mapping - Add rl_query_groups() to init.py: client API to query authenticated group_ids for an org - Add wwwroot/api/rl_callback.dspy endpoint (no auth required for vendor POST) - Add wwwroot/api/rl_query_groups.dspy endpoint (login required) - Remove deprecated rl_app_user_* files (no longer used) - Update scripts/load_path.py: rl_callback -> any role, rl_query_groups -> logined
32 lines
968 B
Plaintext
32 lines
968 B
Plaintext
import json
|
|
|
|
# Volcengine callback POSTs JSON body with BytedToken and result info.
|
|
# The callback URL is configured when calling CreateVisualValidateSession.
|
|
# Typical payload: {"BytedToken": "...", "ReqUUID": "...", "Status": "..."}
|
|
|
|
# Try to parse JSON body first
|
|
body_str = http_request.get("body", "") or ""
|
|
byted_token = ""
|
|
project_name = "default"
|
|
|
|
try:
|
|
body = json.loads(body_str) if body_str else {}
|
|
byted_token = body.get("BytedToken", "")
|
|
# Also check alternative field names
|
|
if not byted_token:
|
|
byted_token = body.get("byted_token", "")
|
|
if not byted_token:
|
|
byted_token = body.get("Token", "")
|
|
except:
|
|
byted_token = ""
|
|
|
|
# Fallback: check query params
|
|
if not byted_token:
|
|
byted_token = params_kw.get("BytedToken", params_kw.get("byted_token", ""))
|
|
|
|
if not byted_token:
|
|
return {"success": False, "message": "缺少 BytedToken 参数"}
|
|
|
|
result = await rl_handle_callback(byted_token, project_name)
|
|
return result
|