feat(qoder): 弄清国际版每日 100 Credits 的「按设备下发」规则 + 一键设备授权登录
排查结论(本机对真实接口做了 30+ 组对照实验)
- GET /sash/api/v1/me/campaigns 只返回一条常驻 VIEW_DETAILS 广告
(act-20260901-493,BOGO 订阅推广,claimStatus=CLAIMED 与签到无关)
- 无论 Cosy-MachineToken/Code/Type 用 env 0/3/4/prod、裸调用/带 stdin、
是否附 Cosy-MachineId/OS/Hostname/Origin/Referer/X-*、是否带 clientType,
都拿不到 CLAIM_BEFIT 轮次;账号本人 balances/achievements 正常
- 三个社区实现(qoder2api-hub、dsh-connect-qoder、CreditDaddy)一致:
每日轮次按「登录过官方客户端的那台设备」下发,NAS 侧另造的设备看不到它
修复
- _benefits() 改为只认 actionType=CLAIM_BEFIT(不再把 VIEW_DETAILS 当签到),
窗口过期也排除;claimStatus 未知按可领处理(领取接口幂等)
- 两段式取活动:先裸取拿 uid → 按 uid 生成风控身份 → 再带设备身份重取
- 状态文案改为「未下发每日签到活动」而不是误导性的「今日已领取」
新功能
- Qoder 一键登录(OAuth 设备授权 / PKCE S256):应用内点按钮 → 浏览器确认一次,
Token 直接绑定本机设备;同 uid 已存在则更新凭证而不是新增重复账号
- 手工导入桌面端设备身份接口 /api/qoder/import_device
- 诊断接口:/api/qoder/{probe,experiment,growth,matrix,desktop}
测试:39 后端 + 25 E2E + 9 前端全绿
This commit is contained in:
@@ -224,6 +224,25 @@ def http_get(url, headers=None, timeout=20):
|
||||
return None, status, "non-JSON response: %s" % raw[:200]
|
||||
|
||||
|
||||
def http_get_text(url, headers=None, timeout=20, limit=4 * 1024 * 1024):
|
||||
"""GET returning the raw body as text (for HTML/JS). (text, status, error)."""
|
||||
req = urllib.request.Request(url, method="GET")
|
||||
req.add_header("User-Agent", USER_AGENT)
|
||||
if headers:
|
||||
for k, v in headers.items():
|
||||
req.add_header(k, v)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=timeout, context=_SSL_CTX) as resp:
|
||||
return resp.read(limit).decode("utf-8", errors="replace"), resp.status, None
|
||||
except urllib.error.HTTPError as e:
|
||||
try:
|
||||
return e.read(limit).decode("utf-8", errors="replace"), e.code, None
|
||||
except Exception as exc:
|
||||
return None, e.code, "HTTP %s: %s" % (e.code, exc)
|
||||
except Exception as e:
|
||||
return None, 0, "request failed: %s" % e
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Atomic JSON storage with flock
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user