feat(weixin_ilink): 扫码协议与腾讯官方对齐——POST local_token_list + iLink-App-Id/ClientVersion 头 + need_verifycode/redirect 状态机
This commit is contained in:
1 parent
bef398d47a
commit
f5950e4bde
9 files changed
+508
-99
No files matched your search
@@ -8,10 +8,10 @@ package weixin_ilink
|
||||
// concurrent QR binds.
|
||||
|
||||
import (
|
||||
"time"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Login status values reported by Adapter.LoginStatus.
|
||||
@@ -26,6 +26,17 @@ const (
|
||||
LoginStatusConfirmed = "confirmed"
|
||||
// LoginStatusFailed means the last scan/login attempt errored or timed out.
|
||||
LoginStatusFailed = "failed"
|
||||
// LoginStatusNeedVerifyCode means the WeChat server asks for a pairing code
|
||||
// shown on the phone WeChat; the panel should prompt the user to enter it.
|
||||
LoginStatusNeedVerifyCode = "need_verifycode"
|
||||
)
|
||||
|
||||
// loginNeedVerifyCodeHint is the detail LoginStatus reports for need_verifycode so
|
||||
// the panel can prompt the user; loginBindedRedirectDetail is what a binded_redirect
|
||||
// outcome reports.
|
||||
const (
|
||||
loginNeedVerifyCodeHint = "请输入微信显示的数字"
|
||||
loginBindedRedirectDetail = "已连接过此 OpenClaw,无需重复连接"
|
||||
)
|
||||
|
||||
// ErrAlreadyLoggedIn is returned by StartLogin when a bot token is already
|
||||
@@ -99,6 +110,9 @@ func (a *Adapter) StartLogin(ctx context.Context) (LoginQR, error) {
|
||||
}
|
||||
a.loginSession = sess
|
||||
a.setLoginState(LoginStatusWaiting, "")
|
||||
// Reset any IDC redirect host recorded by a previous (re-)scan so a new login
|
||||
// starts polling the configured base URL.
|
||||
a.setPollBaseURL("")
|
||||
// Log only the renderable URL, never the raw qrcode (it is a secret).
|
||||
a.log.Info("scan the qr code to bind the bot", "url", raw.QrcodeImgContent)
|
||||
|
||||
|
||||
Reference in new issue
Block a user