@wu529778790/open-im 1.10.1-beta.0 → 1.10.1
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/workbuddy/oauth.js +10 -1
- package/package.json +1 -1
package/dist/workbuddy/oauth.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* WorkBuddy OAuth - CodeBuddy authentication for WeChat KF integration
|
|
3
3
|
*/
|
|
4
4
|
import { hostname } from 'node:os';
|
|
5
|
+
import { createLogger } from '../logger.js';
|
|
6
|
+
const log = createLogger('WorkBuddyOAuth');
|
|
5
7
|
const DEFAULT_BASE_URL = 'https://copilot.tencent.com';
|
|
6
8
|
const PLATFORM = 'ide';
|
|
7
9
|
export class WorkBuddyOAuth {
|
|
@@ -196,7 +198,14 @@ export class WorkBuddyOAuth {
|
|
|
196
198
|
return { success: false, message: `获取链接失败: ${res.status} ${body}` };
|
|
197
199
|
}
|
|
198
200
|
const body = (await res.json());
|
|
199
|
-
|
|
201
|
+
log.debug('getWeChatKfLink response:', JSON.stringify(body).slice(0, 500));
|
|
202
|
+
if (body.data)
|
|
203
|
+
return body.data;
|
|
204
|
+
// API may return fields directly without data wrapper
|
|
205
|
+
if (body.success !== undefined || body.url !== undefined) {
|
|
206
|
+
return body;
|
|
207
|
+
}
|
|
208
|
+
return { success: false, message: `Empty response: ${JSON.stringify(body).slice(0, 200)}` };
|
|
200
209
|
}
|
|
201
210
|
/**
|
|
202
211
|
* Check WeChat KF binding status
|