@wu529778790/open-im 1.10.9-beta.15 → 1.10.9-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clawbot/client.js +12 -1
- package/dist/clawbot/qr-login.js +2 -2
- package/dist/setup.js +2 -0
- package/package.json +1 -1
package/dist/clawbot/client.js
CHANGED
|
@@ -145,7 +145,18 @@ async function fetchApi(path, signal) {
|
|
|
145
145
|
},
|
|
146
146
|
signal,
|
|
147
147
|
});
|
|
148
|
-
|
|
148
|
+
const text = await res.text();
|
|
149
|
+
try {
|
|
150
|
+
const json = JSON.parse(text);
|
|
151
|
+
if (!json.ok) {
|
|
152
|
+
log.warn(`ClawBot API ${path.split('?')[0]} response: ${text.substring(0, 500)}`);
|
|
153
|
+
}
|
|
154
|
+
return json;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
log.warn(`ClawBot API non-JSON response (${res.status}): ${text.substring(0, 300)}`);
|
|
158
|
+
return { ok: false, error: `HTTP ${res.status}: non-JSON response` };
|
|
159
|
+
}
|
|
149
160
|
}
|
|
150
161
|
function sleep(ms, signal) {
|
|
151
162
|
return new Promise((resolve) => {
|
package/dist/clawbot/qr-login.js
CHANGED
|
@@ -98,12 +98,12 @@ export async function waitForQRLogin(session, onStatusChange) {
|
|
|
98
98
|
if (!result.bot_token) {
|
|
99
99
|
return { connected: false, message: '登录失败:服务器未返回 bot_token' };
|
|
100
100
|
}
|
|
101
|
-
log.info(`Login confirmed! botId=${result.ilink_bot_id}`);
|
|
101
|
+
log.info(`Login confirmed! botId=${result.ilink_bot_id}, baseurl=${result.baseurl ?? '(empty)'}`);
|
|
102
102
|
return {
|
|
103
103
|
connected: true,
|
|
104
104
|
botToken: result.bot_token,
|
|
105
105
|
accountId: result.ilink_bot_id,
|
|
106
|
-
baseUrl: result.baseurl,
|
|
106
|
+
baseUrl: result.baseurl || ILINK_BASE_URL,
|
|
107
107
|
userId: result.ilink_user_id,
|
|
108
108
|
message: '登录成功',
|
|
109
109
|
};
|
package/dist/setup.js
CHANGED
|
@@ -607,6 +607,8 @@ export async function runInteractiveSetup() {
|
|
|
607
607
|
});
|
|
608
608
|
if (result.connected && result.botToken) {
|
|
609
609
|
cbApiToken = result.botToken;
|
|
610
|
+
if (result.baseUrl)
|
|
611
|
+
cbApiUrl = result.baseUrl;
|
|
610
612
|
console.log("\n✅ 登录成功!");
|
|
611
613
|
if (result.userId) {
|
|
612
614
|
console.log(` 用户 ID: ${result.userId}`);
|