@wu529778790/open-im 1.8.3-beta.0 → 1.8.3-beta.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/setup.js
CHANGED
|
@@ -443,21 +443,14 @@ export async function runInteractiveSetup() {
|
|
|
443
443
|
}, { onCancel });
|
|
444
444
|
if (wechatModeResp.mode === "qr") {
|
|
445
445
|
console.log("\n正在启动微信扫码登录...\n");
|
|
446
|
-
const appIdResp = await prompts({
|
|
447
|
-
type: "text",
|
|
448
|
-
name: "appId",
|
|
449
|
-
message: "请输入微信 AppID",
|
|
450
|
-
initial: wc?.appId ?? "",
|
|
451
|
-
validate: (v) => (v.trim() ? true : "AppID 不能为空"),
|
|
452
|
-
}, { onCancel });
|
|
453
446
|
try {
|
|
454
447
|
const { performWeChatLogin } = await import("./wechat/auth/index.js");
|
|
455
448
|
const credentials = await performWeChatLogin({
|
|
456
449
|
envName: "production",
|
|
457
|
-
appId:
|
|
450
|
+
appId: wc?.appId || undefined,
|
|
458
451
|
});
|
|
459
452
|
config.platforms.wechat = {
|
|
460
|
-
appId:
|
|
453
|
+
appId: wc?.appId,
|
|
461
454
|
enabled: true,
|
|
462
455
|
token: credentials.channelToken,
|
|
463
456
|
jwtToken: credentials.jwtToken,
|
|
@@ -8,6 +8,7 @@ import { QClawAPI } from './qclaw-api.js';
|
|
|
8
8
|
import { getDeviceGuid } from './device-guid.js';
|
|
9
9
|
import { getEnvironment } from './environments.js';
|
|
10
10
|
import { performDeviceBinding } from './device-bind.js';
|
|
11
|
+
const DEFAULT_WX_APP_ID = 'wx9d11056dd75b7240';
|
|
11
12
|
const log = createLogger('WeChatLogin');
|
|
12
13
|
function nested(obj, ...keys) {
|
|
13
14
|
let cur = obj;
|
|
@@ -88,10 +89,7 @@ async function waitForAuthCode() {
|
|
|
88
89
|
*/
|
|
89
90
|
export async function performWeChatLogin(options = {}) {
|
|
90
91
|
const envName = options.envName ?? 'production';
|
|
91
|
-
const appId = options.appId;
|
|
92
|
-
if (!appId) {
|
|
93
|
-
throw new Error('appId is required. 请在配置中提供 wechatAppId 或通过环境变量 WECHAT_APP_ID 设置');
|
|
94
|
-
}
|
|
92
|
+
const appId = options.appId || DEFAULT_WX_APP_ID;
|
|
95
93
|
const env = getEnvironment(envName, appId);
|
|
96
94
|
const guid = getDeviceGuid();
|
|
97
95
|
const api = new QClawAPI(env, guid);
|