@michengai/dsh-im-connect 1.0.47 → 1.0.49
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/CHANGELOG.md +18 -0
- package/CHANGELOG.zh-CN.md +18 -0
- package/README.de.md +12 -1
- package/README.en.md +12 -1
- package/README.es.md +12 -1
- package/README.fr.md +12 -1
- package/README.ja.md +12 -1
- package/README.md +12 -1
- package/README.pt.md +12 -1
- package/README.ru.md +12 -1
- package/README.zh-CN.md +12 -1
- package/client.js +293 -71
- package/lib/channels/factory.js +1 -1
- package/lib/channels/factory.js.map +1 -1
- package/lib/channels/meta.d.ts +1 -0
- package/lib/channels/meta.d.ts.map +1 -1
- package/lib/channels/meta.js +1 -0
- package/lib/channels/meta.js.map +1 -1
- package/lib/channels/wecom.d.ts +2 -0
- package/lib/channels/wecom.d.ts.map +1 -1
- package/lib/channels/wecom.js +33 -1
- package/lib/channels/wecom.js.map +1 -1
- package/lib/client.js +293 -71
- package/lib/manager.d.ts +12 -5
- package/lib/manager.d.ts.map +1 -1
- package/lib/manager.js +106 -8
- package/lib/manager.js.map +1 -1
- package/package.json +1 -1
- package/src/channels/factory.ts +1 -1
- package/src/channels/meta.ts +2 -0
- package/src/channels/wecom.ts +34 -2
- package/src/manager.ts +114 -9
package/client.js
CHANGED
|
@@ -428,8 +428,13 @@ window.__ModuleLoader__.load({
|
|
|
428
428
|
function parseChannelSettingsRequest(value) {
|
|
429
429
|
if (!value || typeof value !== "object") return undefined;
|
|
430
430
|
const channelId = typeof value.channelId === "string" ? value.channelId.trim() : "";
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
const accountId = typeof value.accountId === "string" ? value.accountId.trim() : "";
|
|
432
|
+
if (!channelId && !accountId) return undefined;
|
|
433
|
+
return {
|
|
434
|
+
channelId,
|
|
435
|
+
accountId: accountId || undefined,
|
|
436
|
+
name: typeof value.name === "string" ? value.name : "",
|
|
437
|
+
};
|
|
433
438
|
}
|
|
434
439
|
function writeChannelSettingsRequest(storage, request) {
|
|
435
440
|
try { storage && storage.setItem(CHANNEL_SETTINGS_STORAGE_KEY, JSON.stringify(request)); } catch { /* ignore */ }
|
|
@@ -452,10 +457,20 @@ window.__ModuleLoader__.load({
|
|
|
452
457
|
function resolveChannelSettingsTarget(request, channels) {
|
|
453
458
|
const parsed = parseChannelSettingsRequest(request);
|
|
454
459
|
if (!parsed || !Array.isArray(channels)) return undefined;
|
|
455
|
-
|
|
460
|
+
if (parsed.accountId) {
|
|
461
|
+
for (const channel of channels) {
|
|
462
|
+
const account = (channel.accounts || []).find((a) => a && a.id === parsed.accountId);
|
|
463
|
+
if (account) return { channelId: channel.id, accountId: account.id };
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
const channel = channels.find((item) => item && (item.id === parsed.channelId || (item.accounts || []).some((a) => a && a.id === parsed.channelId)));
|
|
456
467
|
if (!channel) return undefined;
|
|
457
468
|
const accounts = channel.accounts || [];
|
|
458
|
-
|
|
469
|
+
const matchedAccount = accounts.find((a) => a && (a.id === parsed.accountId || a.id === parsed.channelId));
|
|
470
|
+
return {
|
|
471
|
+
channelId: channel.id,
|
|
472
|
+
accountId: matchedAccount ? matchedAccount.id : (accounts.length === 1 ? accounts[0].id : undefined),
|
|
473
|
+
};
|
|
459
474
|
}
|
|
460
475
|
function pickSettingsSectionButton(buttons, labels) {
|
|
461
476
|
const normalize = (value) => String(value || "").replace(/\s+/g, "").trim().toLowerCase();
|
|
@@ -609,6 +624,9 @@ window.__ModuleLoader__.load({
|
|
|
609
624
|
"account.proxyNote": "仅影响当前账号;保存后自动重连生效。",
|
|
610
625
|
"account.proxySaved": "代理地址已保存;留空保存可保留当前地址。",
|
|
611
626
|
"account.proxyUrl": "代理地址",
|
|
627
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
628
|
+
"account.wecomWsUrlNote": "私有化部署时填写自定义长连接地址,留空使用官方默认地址;保存后自动重连生效。",
|
|
629
|
+
"account.wecomWsUrlPlaceholder": "默认 wss://openws.work.weixin.qq.com",
|
|
612
630
|
"account.receive": "接收消息",
|
|
613
631
|
"account.receiveDescription": "关闭后保留账号配置,但不接收新消息",
|
|
614
632
|
"account.remark": "名称备注",
|
|
@@ -779,6 +797,8 @@ window.__ModuleLoader__.load({
|
|
|
779
797
|
"field.telegram.token": "Bot Token",
|
|
780
798
|
"field.wecom.botId": "Bot ID",
|
|
781
799
|
"field.wecom.secret": "Secret",
|
|
800
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
801
|
+
"field.wecom.wsUrl.placeholder": "默认 wss://openws.work.weixin.qq.com",
|
|
782
802
|
"hover.copied": "已复制",
|
|
783
803
|
"loading": "加载中…",
|
|
784
804
|
"pending.notice": "有访问请求。批准后该用户才能驱动本机助手。",
|
|
@@ -915,6 +935,9 @@ window.__ModuleLoader__.load({
|
|
|
915
935
|
"account.proxyNote": "Affects only this account. The channel reconnects automatically after saving.",
|
|
916
936
|
"account.proxySaved": "A proxy address is saved. Leave the field blank to keep it.",
|
|
917
937
|
"account.proxyUrl": "Proxy address",
|
|
938
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
939
|
+
"account.wecomWsUrlNote": "Enter a custom WebSocket URL for on-premise deployments, or leave blank for the official default; reconnects automatically after saving.",
|
|
940
|
+
"account.wecomWsUrlPlaceholder": "Default: wss://openws.work.weixin.qq.com",
|
|
918
941
|
"account.receive": "Receive messages",
|
|
919
942
|
"account.receiveDescription": "Turn this off to keep the account settings without receiving new messages",
|
|
920
943
|
"account.remark": "Name remark",
|
|
@@ -1085,6 +1108,8 @@ window.__ModuleLoader__.load({
|
|
|
1085
1108
|
"field.telegram.token": "Bot Token",
|
|
1086
1109
|
"field.wecom.botId": "Bot ID",
|
|
1087
1110
|
"field.wecom.secret": "Secret",
|
|
1111
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
1112
|
+
"field.wecom.wsUrl.placeholder": "Default: wss://openws.work.weixin.qq.com",
|
|
1088
1113
|
"hover.copied": "Copied",
|
|
1089
1114
|
"loading": "Loading…",
|
|
1090
1115
|
"pending.notice": "There are access requests. Approve a user before they can control the local assistant.",
|
|
@@ -1221,6 +1246,9 @@ window.__ModuleLoader__.load({
|
|
|
1221
1246
|
"account.proxyNote": "現在のアカウントにのみ影響します。保存後に自動再接続して反映されます。",
|
|
1222
1247
|
"account.proxySaved": "プロキシアドレスは保存されています。空のまま保存すると現在のアドレスが維持されます。",
|
|
1223
1248
|
"account.proxyUrl": "プロキシアドレス",
|
|
1249
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
1250
|
+
"account.wecomWsUrlNote": "オンプレミス展開の場合はカスタム WebSocket URL を入力し、公式デフォルトを使用する場合は空欄にします。保存後に自動再接続されます。",
|
|
1251
|
+
"account.wecomWsUrlPlaceholder": "デフォルト wss://openws.work.weixin.qq.com",
|
|
1224
1252
|
"account.receive": "メッセージを受信",
|
|
1225
1253
|
"account.receiveDescription": "無効にするとアカウント設定を維持したまま新規メッセージを受信しません",
|
|
1226
1254
|
"account.remark": "名称備考",
|
|
@@ -1391,6 +1419,8 @@ window.__ModuleLoader__.load({
|
|
|
1391
1419
|
"field.telegram.token": "Bot Token",
|
|
1392
1420
|
"field.wecom.botId": "Bot ID",
|
|
1393
1421
|
"field.wecom.secret": "Secret",
|
|
1422
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
1423
|
+
"field.wecom.wsUrl.placeholder": "デフォルト wss://openws.work.weixin.qq.com",
|
|
1394
1424
|
"hover.copied": "コピー完了",
|
|
1395
1425
|
"loading": "読み込み中…",
|
|
1396
1426
|
"pending.notice": "アクセスリクエストがあります。承認されたユーザーのみがローカルアシスタントを操作できます。",
|
|
@@ -1527,6 +1557,9 @@ window.__ModuleLoader__.load({
|
|
|
1527
1557
|
"account.proxyNote": "Afecta solo a esta cuenta. El canal se reconecta automáticamente al guardar.",
|
|
1528
1558
|
"account.proxySaved": "Se ha guardado una dirección de proxy. Deje el campo en blanco para conservarla.",
|
|
1529
1559
|
"account.proxyUrl": "Dirección del proxy",
|
|
1560
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
1561
|
+
"account.wecomWsUrlNote": "Ingrese una URL de WebSocket personalizada para implementaciones locales o déjela en blanco para el valor predeterminado oficial; se reconecta automáticamente al guardar.",
|
|
1562
|
+
"account.wecomWsUrlPlaceholder": "Predeterminado: wss://openws.work.weixin.qq.com",
|
|
1530
1563
|
"account.receive": "Recibir mensajes",
|
|
1531
1564
|
"account.receiveDescription": "Desactive esto para conservar la configuración de la cuenta sin recibir nuevos mensajes",
|
|
1532
1565
|
"account.remark": "Observación del nombre",
|
|
@@ -1697,6 +1730,8 @@ window.__ModuleLoader__.load({
|
|
|
1697
1730
|
"field.telegram.token": "Bot Token",
|
|
1698
1731
|
"field.wecom.botId": "Bot ID",
|
|
1699
1732
|
"field.wecom.secret": "Secret",
|
|
1733
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
1734
|
+
"field.wecom.wsUrl.placeholder": "Predeterminado: wss://openws.work.weixin.qq.com",
|
|
1700
1735
|
"hover.copied": "Copiado",
|
|
1701
1736
|
"loading": "Cargando…",
|
|
1702
1737
|
"pending.notice": "Hay solicitudes de acceso. Apruebe a un usuario para que pueda controlar el asistente local.",
|
|
@@ -1833,6 +1868,9 @@ window.__ModuleLoader__.load({
|
|
|
1833
1868
|
"account.proxyNote": "Ne concerne que ce compte. Le canal se reconnecte automatiquement après enregistrement.",
|
|
1834
1869
|
"account.proxySaved": "Une adresse de proxy est enregistrée. Laissez vide pour la conserver.",
|
|
1835
1870
|
"account.proxyUrl": "Adresse du proxy",
|
|
1871
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
1872
|
+
"account.wecomWsUrlNote": "Saisissez une URL WebSocket personnalisée pour les déploiements sur site, ou laissez vide pour la valeur par défaut officielle ; se reconnecte automatiquement après enregistrement.",
|
|
1873
|
+
"account.wecomWsUrlPlaceholder": "Par défaut : wss://openws.work.weixin.qq.com",
|
|
1836
1874
|
"account.receive": "Recevoir des messages",
|
|
1837
1875
|
"account.receiveDescription": "Désactivez cette option pour conserver les paramètres sans recevoir de nouveaux messages",
|
|
1838
1876
|
"account.remark": "Remarque sur le nom",
|
|
@@ -2003,6 +2041,8 @@ window.__ModuleLoader__.load({
|
|
|
2003
2041
|
"field.telegram.token": "Bot Token",
|
|
2004
2042
|
"field.wecom.botId": "Bot ID",
|
|
2005
2043
|
"field.wecom.secret": "Secret",
|
|
2044
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
2045
|
+
"field.wecom.wsUrl.placeholder": "Par défaut : wss://openws.work.weixin.qq.com",
|
|
2006
2046
|
"hover.copied": "Copié",
|
|
2007
2047
|
"loading": "Chargement…",
|
|
2008
2048
|
"pending.notice": "Demandes d'accès en attente. Approuvez un utilisateur pour lui permettre de piloter l'assistant local.",
|
|
@@ -2139,6 +2179,9 @@ window.__ModuleLoader__.load({
|
|
|
2139
2179
|
"account.proxyNote": "Betrifft nur dieses Konto. Der Kanal verbindet sich nach dem Speichern automatisch neu.",
|
|
2140
2180
|
"account.proxySaved": "Eine Proxy-Adresse ist gespeichert. Feld leer lassen, um sie beizubehalten.",
|
|
2141
2181
|
"account.proxyUrl": "Proxy-Adresse",
|
|
2182
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
2183
|
+
"account.wecomWsUrlNote": "Geben Sie eine benutzerdefinierte WebSocket-URL für On-Premise-Bereitstellungen ein oder lassen Sie das Feld leer für den offiziellen Standard; verbindet sich nach dem Speichern automatisch neu.",
|
|
2184
|
+
"account.wecomWsUrlPlaceholder": "Standard: wss://openws.work.weixin.qq.com",
|
|
2142
2185
|
"account.receive": "Nachrichten empfangen",
|
|
2143
2186
|
"account.receiveDescription": "Ausschalten, um Kontoeinstellungen zu behalten, ohne neue Nachrichten zu empfangen",
|
|
2144
2187
|
"account.remark": "Namensnotiz",
|
|
@@ -2309,6 +2352,8 @@ window.__ModuleLoader__.load({
|
|
|
2309
2352
|
"field.telegram.token": "Bot Token",
|
|
2310
2353
|
"field.wecom.botId": "Bot ID",
|
|
2311
2354
|
"field.wecom.secret": "Secret",
|
|
2355
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
2356
|
+
"field.wecom.wsUrl.placeholder": "Standard: wss://openws.work.weixin.qq.com",
|
|
2312
2357
|
"hover.copied": "Kopiert",
|
|
2313
2358
|
"loading": "Wird geladen…",
|
|
2314
2359
|
"pending.notice": "Es liegen Zugriffsanfragen vor. Genehmigen Sie Benutzer, damit sie den lokalen Assistenten steuern können.",
|
|
@@ -2445,6 +2490,9 @@ window.__ModuleLoader__.load({
|
|
|
2445
2490
|
"account.proxyNote": "Влияет только на этот аккаунт. Канал автоматически переподключается после сохранения.",
|
|
2446
2491
|
"account.proxySaved": "Адрес прокси сохранен. Оставьте поле пустым, чтобы сохранить его.",
|
|
2447
2492
|
"account.proxyUrl": "Адрес прокси",
|
|
2493
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
2494
|
+
"account.wecomWsUrlNote": "Укажите пользовательский URL WebSocket для локального развертывания или оставьте пустым для официального адреса по умолчанию; переподключается автоматически после сохранения.",
|
|
2495
|
+
"account.wecomWsUrlPlaceholder": "По умолчанию: wss://openws.work.weixin.qq.com",
|
|
2448
2496
|
"account.receive": "Прием сообщений",
|
|
2449
2497
|
"account.receiveDescription": "Отключите, чтобы сохранить настройки аккаунта без приема новых сообщений",
|
|
2450
2498
|
"account.remark": "Примечание к имени",
|
|
@@ -2615,6 +2663,8 @@ window.__ModuleLoader__.load({
|
|
|
2615
2663
|
"field.telegram.token": "Bot Token",
|
|
2616
2664
|
"field.wecom.botId": "Bot ID",
|
|
2617
2665
|
"field.wecom.secret": "Secret",
|
|
2666
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
2667
|
+
"field.wecom.wsUrl.placeholder": "По умолчанию: wss://openws.work.weixin.qq.com",
|
|
2618
2668
|
"hover.copied": "Скопировано",
|
|
2619
2669
|
"loading": "Загрузка…",
|
|
2620
2670
|
"pending.notice": "Есть запросы на доступ. Одобрите пользователя, чтобы он мог взаимодействовать с локальным ассистентом.",
|
|
@@ -2751,6 +2801,9 @@ window.__ModuleLoader__.load({
|
|
|
2751
2801
|
"account.proxyNote": "Afeta apenas esta conta. O canal reconecta automaticamente após salvar.",
|
|
2752
2802
|
"account.proxySaved": "Um endereço de proxy foi salvo. Deixe em branco para mantê-lo.",
|
|
2753
2803
|
"account.proxyUrl": "Endereço do proxy",
|
|
2804
|
+
"account.wecomWsUrl": "WebSocket URL",
|
|
2805
|
+
"account.wecomWsUrlNote": "Insira uma URL WebSocket personalizada para implantações locais ou deixe em branco para o padrão oficial; reconecta automaticamente após salvar.",
|
|
2806
|
+
"account.wecomWsUrlPlaceholder": "Padrão: wss://openws.work.weixin.qq.com",
|
|
2754
2807
|
"account.receive": "Receber mensagens",
|
|
2755
2808
|
"account.receiveDescription": "Desative para manter as configurações da conta sem receber novas mensagens",
|
|
2756
2809
|
"account.remark": "Observação do nome",
|
|
@@ -2921,6 +2974,8 @@ window.__ModuleLoader__.load({
|
|
|
2921
2974
|
"field.telegram.token": "Bot Token",
|
|
2922
2975
|
"field.wecom.botId": "Bot ID",
|
|
2923
2976
|
"field.wecom.secret": "Secret",
|
|
2977
|
+
"field.wecom.wsUrl": "WebSocket URL",
|
|
2978
|
+
"field.wecom.wsUrl.placeholder": "Padrão: wss://openws.work.weixin.qq.com",
|
|
2924
2979
|
"hover.copied": "Copiado",
|
|
2925
2980
|
"loading": "Carregando…",
|
|
2926
2981
|
"pending.notice": "Existem solicitações de acesso. Aprove um usuário para permitir que ele controle o assistente local.",
|
|
@@ -3257,15 +3312,33 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
3257
3312
|
let requestHostSessionRefresh = () => {};
|
|
3258
3313
|
let channelSessionIds = new Set();
|
|
3259
3314
|
let channelSessionChannels = new Map();
|
|
3315
|
+
let channelSessionAccounts = new Map();
|
|
3316
|
+
let channelAccountMeta = new Map();
|
|
3260
3317
|
let channelMembershipRevision = 0;
|
|
3261
3318
|
const channelMembershipListeners = new Set();
|
|
3319
|
+
function parsePlatformFromChannelId(id) {
|
|
3320
|
+
const val = String(id || "");
|
|
3321
|
+
const split = val.indexOf("_");
|
|
3322
|
+
return split > 0 ? val.slice(0, split) : val;
|
|
3323
|
+
}
|
|
3262
3324
|
function updateChannelMembership(groups) {
|
|
3263
3325
|
const next = new Set();
|
|
3264
3326
|
const channels = new Map();
|
|
3265
|
-
|
|
3327
|
+
const accounts = new Map();
|
|
3328
|
+
const meta = new Map();
|
|
3329
|
+
for (const group of groups || []) {
|
|
3330
|
+
const platform = group.platform || parsePlatformFromChannelId(group.id);
|
|
3331
|
+
const accountId = group.accountId || group.id;
|
|
3332
|
+
meta.set(accountId, {
|
|
3333
|
+
id: accountId,
|
|
3334
|
+
accountId,
|
|
3335
|
+
platform,
|
|
3336
|
+
label: group.label || "",
|
|
3337
|
+
});
|
|
3266
3338
|
for (const session of group.sessions || []) {
|
|
3267
3339
|
next.add(session.sessionId);
|
|
3268
|
-
channels.set(String(session.sessionId),
|
|
3340
|
+
channels.set(String(session.sessionId), platform);
|
|
3341
|
+
accounts.set(String(session.sessionId), accountId);
|
|
3269
3342
|
}
|
|
3270
3343
|
}
|
|
3271
3344
|
let changed = next.size !== channelSessionIds.size || [...next].some(id => !channelSessionIds.has(id));
|
|
@@ -3274,15 +3347,35 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
3274
3347
|
if (channelSessionChannels.get(id) !== channel) { changed = true; break; }
|
|
3275
3348
|
}
|
|
3276
3349
|
}
|
|
3350
|
+
if (!changed) {
|
|
3351
|
+
for (const [id, account] of accounts) {
|
|
3352
|
+
if (channelSessionAccounts.get(id) !== account) { changed = true; break; }
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
if (!changed) {
|
|
3356
|
+
if (meta.size !== channelAccountMeta.size) {
|
|
3357
|
+
changed = true;
|
|
3358
|
+
} else {
|
|
3359
|
+
for (const [id, item] of meta) {
|
|
3360
|
+
const prev = channelAccountMeta.get(id);
|
|
3361
|
+
if (!prev || prev.label !== item.label || prev.platform !== item.platform) {
|
|
3362
|
+
changed = true;
|
|
3363
|
+
break;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3277
3368
|
if (changed) {
|
|
3278
3369
|
channelSessionIds = next;
|
|
3279
3370
|
channelSessionChannels = channels;
|
|
3371
|
+
channelSessionAccounts = accounts;
|
|
3372
|
+
channelAccountMeta = meta;
|
|
3280
3373
|
channelMembershipRevision += 1;
|
|
3281
3374
|
for (const listener of channelMembershipListeners) listener();
|
|
3282
3375
|
}
|
|
3283
3376
|
try { requestHostSessionRefresh(changed); } catch { /* 下次频道轮询继续重试 */ }
|
|
3284
3377
|
}
|
|
3285
|
-
/** IM 会话 ID
|
|
3378
|
+
/** IM 会话 ID 所属渠道平台(如 weixin/feishu),供会话行图标展示。 */
|
|
3286
3379
|
function channelIdOfSession(sessionId) {
|
|
3287
3380
|
const value = String(sessionId || "");
|
|
3288
3381
|
const mapped = channelSessionChannels.get(value);
|
|
@@ -3295,6 +3388,17 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
3295
3388
|
const platform = instance.split("_", 1)[0];
|
|
3296
3389
|
return platform || undefined;
|
|
3297
3390
|
}
|
|
3391
|
+
/** IM 会话 ID 所属具体账号实例(如 feishu_1)。 */
|
|
3392
|
+
function accountIdOfSession(sessionId) {
|
|
3393
|
+
const value = String(sessionId || "");
|
|
3394
|
+
const mapped = channelSessionAccounts.get(value);
|
|
3395
|
+
if (mapped) return mapped;
|
|
3396
|
+
if (!value.startsWith("im:")) return channelSessionChannels.get(value);
|
|
3397
|
+
const rest = value.slice(3);
|
|
3398
|
+
const split = rest.indexOf(":");
|
|
3399
|
+
const instance = split > 0 ? rest.slice(0, split) : rest;
|
|
3400
|
+
return instance || undefined;
|
|
3401
|
+
}
|
|
3298
3402
|
// 新旧两代 IM 前缀都要认,否则存量会话升级后会掉出渠道页签。
|
|
3299
3403
|
const isChannelSession = (id) => {
|
|
3300
3404
|
const value = String(id);
|
|
@@ -3561,6 +3665,12 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
3561
3665
|
const translated = t(key);
|
|
3562
3666
|
return translated === key ? field.label : translated;
|
|
3563
3667
|
}
|
|
3668
|
+
function fieldPlaceholder(ch, field, t) {
|
|
3669
|
+
const key = "field." + ch.id + "." + field.key + ".placeholder";
|
|
3670
|
+
const translated = t(key);
|
|
3671
|
+
if (translated !== key) return translated;
|
|
3672
|
+
return field.placeholder || fieldLabel(ch, field, t);
|
|
3673
|
+
}
|
|
3564
3674
|
function hintOf(ch, t) {
|
|
3565
3675
|
const key = "qr." + ch.id;
|
|
3566
3676
|
const translated = t(key);
|
|
@@ -4015,7 +4125,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4015
4125
|
h(Input, {
|
|
4016
4126
|
type: f.secret ? "password" : "text",
|
|
4017
4127
|
value: draft[f.key] || "",
|
|
4018
|
-
placeholder:
|
|
4128
|
+
placeholder: fieldPlaceholder(ch, f, t),
|
|
4019
4129
|
onChange: (e) => setDraft({ ...draft, [f.key]: e.target.value }),
|
|
4020
4130
|
}),
|
|
4021
4131
|
)),
|
|
@@ -4096,6 +4206,11 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4096
4206
|
result.threadSessions = patch.threadSessions;
|
|
4097
4207
|
}
|
|
4098
4208
|
}
|
|
4209
|
+
if (platform === "wecom") {
|
|
4210
|
+
if (Object.prototype.hasOwnProperty.call(patch, "wsUrl")) {
|
|
4211
|
+
result.wsUrl = patch.wsUrl;
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4099
4214
|
return result;
|
|
4100
4215
|
}
|
|
4101
4216
|
|
|
@@ -4595,6 +4710,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4595
4710
|
const [draft, setDraft] = useState(account);
|
|
4596
4711
|
const [proxyModeDraft, setProxyModeDraft] = useState(account.proxyMode || "inherit");
|
|
4597
4712
|
const [proxyUrlDraft, setProxyUrlDraft] = useState(account.proxyUrl || "");
|
|
4713
|
+
const [wsUrlDraft, setWsUrlDraft] = useState(account.wsUrl || "");
|
|
4598
4714
|
const [mentionPolicyDraft, setMentionPolicyDraft] = useState(
|
|
4599
4715
|
account.mentionPolicy === "always" ? "always" : (account.freeChatGroups ? "custom" : "addressed")
|
|
4600
4716
|
);
|
|
@@ -4651,6 +4767,9 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4651
4767
|
useEffect(() => {
|
|
4652
4768
|
setProxyUrlDraft(account.proxyUrl || "");
|
|
4653
4769
|
}, [account.id, account.proxyUrl]);
|
|
4770
|
+
useEffect(() => {
|
|
4771
|
+
setWsUrlDraft(account.wsUrl || "");
|
|
4772
|
+
}, [account.id, account.wsUrl]);
|
|
4654
4773
|
const save = (patch) => {
|
|
4655
4774
|
const seq = ++saveSeq.current;
|
|
4656
4775
|
const next = { ...draft, ...patch };
|
|
@@ -4699,6 +4818,11 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4699
4818
|
res.threadSessions = patch.threadSessions;
|
|
4700
4819
|
}
|
|
4701
4820
|
}
|
|
4821
|
+
if (platform === "wecom") {
|
|
4822
|
+
if (Object.prototype.hasOwnProperty.call(patch, "wsUrl")) {
|
|
4823
|
+
res.wsUrl = patch.wsUrl;
|
|
4824
|
+
}
|
|
4825
|
+
}
|
|
4702
4826
|
return res;
|
|
4703
4827
|
};
|
|
4704
4828
|
filterPayload(account.platform, patch, payload);
|
|
@@ -4842,6 +4966,32 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4842
4966
|
})(),
|
|
4843
4967
|
h("div", { className: "ima-picker-note" }, t("account.telegramGroupPolicyNote")),
|
|
4844
4968
|
),
|
|
4969
|
+
account.platform === "wecom" && h("div", { className: "ima-wecom-settings" },
|
|
4970
|
+
h("label", { className: "ima-picker-field wide" },
|
|
4971
|
+
h("span", { className: "ima-picker-label" }, t("account.wecomWsUrl")),
|
|
4972
|
+
h(Input, {
|
|
4973
|
+
type: "text",
|
|
4974
|
+
value: wsUrlDraft,
|
|
4975
|
+
placeholder: t("account.wecomWsUrlPlaceholder"),
|
|
4976
|
+
"aria-label": t("account.wecomWsUrl"),
|
|
4977
|
+
onChange: (event) => setWsUrlDraft(event.target.value),
|
|
4978
|
+
onBlur: (event) => {
|
|
4979
|
+
const value = event.target.value.trim();
|
|
4980
|
+
if (value === (account.wsUrl || "")) return;
|
|
4981
|
+
save({ wsUrl: value }).then((ok) => {
|
|
4982
|
+
if (ok && !value) setWsUrlDraft("");
|
|
4983
|
+
});
|
|
4984
|
+
},
|
|
4985
|
+
onKeyDown: (event) => {
|
|
4986
|
+
if (event.key === "Enter") {
|
|
4987
|
+
event.preventDefault();
|
|
4988
|
+
event.currentTarget.blur();
|
|
4989
|
+
}
|
|
4990
|
+
},
|
|
4991
|
+
}),
|
|
4992
|
+
),
|
|
4993
|
+
h("div", { className: "ima-picker-note" }, t("account.wecomWsUrlNote")),
|
|
4994
|
+
),
|
|
4845
4995
|
h(CommandPermissionSettings, { value: draft.commandPermissions, onSave: commandPermissions => save({ commandPermissions }), t }),
|
|
4846
4996
|
note && h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, t(note)),
|
|
4847
4997
|
h("div", { className: "ima-inspector-actions" },
|
|
@@ -5183,7 +5333,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5183
5333
|
// ---------------------------------------------------------------------
|
|
5184
5334
|
|
|
5185
5335
|
const CHANNEL_WORKSPACE_PREFIX = "dsh-im-channel:";
|
|
5186
|
-
const CHANNEL_GROUP_IDS = ["weixin", "wecom", "qq", "feishu", "lark", "dingtalk", "telegram", "discord", "slack"];
|
|
5187
5336
|
const EMPTY_SESSION_STATE = { ids: [], byId: {}, current: null };
|
|
5188
5337
|
const EMPTY_WORKSPACE_STATE = { items: [], archivedSessionIds: [], pinnedSessionIds: [], state: "idle", phase: "ready", error: null };
|
|
5189
5338
|
const CHANNEL_GROUP_OPTION_ATTR = "data-ima-channel-group-option";
|
|
@@ -5311,16 +5460,34 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5311
5460
|
}
|
|
5312
5461
|
|
|
5313
5462
|
function channelGroupsFromSessionState(state, t) {
|
|
5314
|
-
const groups = new Map(
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5463
|
+
const groups = new Map();
|
|
5464
|
+
const metaMap = channelAccountMeta;
|
|
5465
|
+
for (const [accountId, meta] of metaMap) {
|
|
5466
|
+
groups.set(accountId, {
|
|
5467
|
+
id: accountId,
|
|
5468
|
+
platform: meta.platform,
|
|
5469
|
+
label: meta.label || channelLabel({ id: meta.platform }, t),
|
|
5470
|
+
sessions: [],
|
|
5471
|
+
});
|
|
5472
|
+
}
|
|
5319
5473
|
const src = state || EMPTY_SESSION_STATE;
|
|
5320
5474
|
for (const id of src.ids || []) {
|
|
5321
|
-
const
|
|
5475
|
+
const platform = channelIdOfSession(id);
|
|
5476
|
+
if (!platform) continue;
|
|
5477
|
+
const accountId = accountIdOfSession(id) || platform;
|
|
5478
|
+
let group = groups.get(accountId);
|
|
5479
|
+
if (!group) {
|
|
5480
|
+
const meta = metaMap.get(accountId);
|
|
5481
|
+
group = {
|
|
5482
|
+
id: accountId,
|
|
5483
|
+
platform,
|
|
5484
|
+
label: (meta && meta.label) || channelLabel({ id: platform }, t),
|
|
5485
|
+
sessions: [],
|
|
5486
|
+
};
|
|
5487
|
+
groups.set(accountId, group);
|
|
5488
|
+
}
|
|
5322
5489
|
const session = src.byId && src.byId[id];
|
|
5323
|
-
if (
|
|
5490
|
+
if (session) group.sessions.push({ sessionId: id, updatedAt: session.updatedAt });
|
|
5324
5491
|
}
|
|
5325
5492
|
return [...groups.values()].filter((group) => group.sessions.length > 0);
|
|
5326
5493
|
}
|
|
@@ -5342,7 +5509,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5342
5509
|
const src = state || EMPTY_WORKSPACE_STATE;
|
|
5343
5510
|
const key = groups.map((group) => [
|
|
5344
5511
|
group.id,
|
|
5345
|
-
channelLabel(group, t),
|
|
5512
|
+
group.label || channelLabel(group, t),
|
|
5346
5513
|
channelGroupCreatedAt(group),
|
|
5347
5514
|
(group.sessions || []).map((session) => session.sessionId).join(","),
|
|
5348
5515
|
].join("\0")).join("\0\0");
|
|
@@ -5353,7 +5520,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5353
5520
|
return {
|
|
5354
5521
|
workspaceId,
|
|
5355
5522
|
id: workspaceId,
|
|
5356
|
-
title: channelLabel(group, t),
|
|
5523
|
+
title: group.label || channelLabel(group, t),
|
|
5357
5524
|
path: "",
|
|
5358
5525
|
sessionIds: (group.sessions || []).map((session) => session.sessionId),
|
|
5359
5526
|
createdAt: channelGroupCreatedAt(group),
|
|
@@ -5380,8 +5547,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5380
5547
|
return result;
|
|
5381
5548
|
}
|
|
5382
5549
|
|
|
5383
|
-
let channelIconCssValue;
|
|
5384
|
-
|
|
5385
5550
|
/** 把 React 元素渲染成可直接注入官方 DOM 的 HTML。 */
|
|
5386
5551
|
function channelMarkup(element) {
|
|
5387
5552
|
if (typeof document === "undefined") return "";
|
|
@@ -5408,7 +5573,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5408
5573
|
}
|
|
5409
5574
|
|
|
5410
5575
|
const channelLogoUrlCache = new Map();
|
|
5411
|
-
/** 频道品牌标 data URL
|
|
5576
|
+
/** 频道品牌标 data URL,供工作区图标和会话行复用。 */
|
|
5412
5577
|
function channelLogoUrl(id) {
|
|
5413
5578
|
if (channelLogoUrlCache.has(id)) return channelLogoUrlCache.get(id);
|
|
5414
5579
|
const markup = channelMarkup(h(BrandMark, { id, compact: true }));
|
|
@@ -5417,26 +5582,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5417
5582
|
return url;
|
|
5418
5583
|
}
|
|
5419
5584
|
|
|
5420
|
-
/** 频道分组头图标:用品牌标覆盖官方文件夹图标,并保持悬停时可见。 */
|
|
5421
|
-
function channelIconCss() {
|
|
5422
|
-
if (channelIconCssValue !== undefined) return channelIconCssValue;
|
|
5423
|
-
if (typeof document === "undefined") {
|
|
5424
|
-
channelIconCssValue = "";
|
|
5425
|
-
return channelIconCssValue;
|
|
5426
|
-
}
|
|
5427
|
-
channelIconCssValue = CHANNEL_GROUP_IDS.map((id) => {
|
|
5428
|
-
const logo = channelLogoUrl(id);
|
|
5429
|
-
if (!logo) return "";
|
|
5430
|
-
const row = `[data-row-key="workspace:${channelWorkspaceId(id)}"]`;
|
|
5431
|
-
return `.ima-channel-official ${row}>span:first-child>svg{display:none!important}`
|
|
5432
|
-
+ `.ima-channel-official ${row}>span:first-child{display:inline-flex!important;background:${logo} center/contain no-repeat!important}`
|
|
5433
|
-
// 宿主在悬停时用 chevron 换掉文件夹;频道分组保持品牌图标可见。
|
|
5434
|
-
+ `.ima-channel-official ${row}:hover>span:first-child{display:inline-flex!important}`
|
|
5435
|
-
+ `.ima-channel-official ${row}:hover>span:nth-child(2){display:none!important}`;
|
|
5436
|
-
}).join("");
|
|
5437
|
-
return channelIconCssValue;
|
|
5438
|
-
}
|
|
5439
|
-
|
|
5440
5585
|
let channelWorkspaceIconCache = { key: "", css: "" };
|
|
5441
5586
|
/**
|
|
5442
5587
|
* 按工作区/工作区树分组时,如果某个工作区的频道会话都来自同一个频道,
|
|
@@ -5473,6 +5618,55 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5473
5618
|
return css;
|
|
5474
5619
|
}
|
|
5475
5620
|
|
|
5621
|
+
/**
|
|
5622
|
+
* 替换菜单项内的图标与文案,兼容各种带有嵌套包装、CSS Module 类名或纯结构节点的宿主 DOM。
|
|
5623
|
+
*/
|
|
5624
|
+
function replaceMenuItemContent(button, templateText, label, icon) {
|
|
5625
|
+
const ownerDoc = button.ownerDocument || (typeof document !== "undefined" ? document : null);
|
|
5626
|
+
let iconContainer = button.querySelector('[class*="itemIcon"], [class*="Icon"]');
|
|
5627
|
+
if (!iconContainer && button.firstElementChild) {
|
|
5628
|
+
const first = button.firstElementChild;
|
|
5629
|
+
const isSvg = first.tagName && first.tagName.toLowerCase() === "svg";
|
|
5630
|
+
const isImg = first.tagName && first.tagName.toLowerCase() === "img";
|
|
5631
|
+
if (isSvg || isImg || button.children.length > 1) {
|
|
5632
|
+
iconContainer = first;
|
|
5633
|
+
}
|
|
5634
|
+
}
|
|
5635
|
+
const isInsideIcon = (el) => iconContainer && typeof iconContainer.contains === "function" && iconContainer.contains(el);
|
|
5636
|
+
const labelContainer = button.querySelector('[class*="itemLabel"], [class*="Label"]')
|
|
5637
|
+
|| [...button.querySelectorAll("span, div")].find((el) => el !== iconContainer && !isInsideIcon(el) && (el.textContent || "").trim() === templateText)
|
|
5638
|
+
|| (button.children.length > 1 ? button.children[1] : null)
|
|
5639
|
+
|| (button.lastElementChild !== iconContainer ? button.lastElementChild : null);
|
|
5640
|
+
|
|
5641
|
+
if (icon !== undefined) {
|
|
5642
|
+
if (!iconContainer && ownerDoc && typeof ownerDoc.createElement === "function") {
|
|
5643
|
+
iconContainer = ownerDoc.createElement("span");
|
|
5644
|
+
if (typeof iconContainer.setAttribute === "function") {
|
|
5645
|
+
iconContainer.setAttribute("class", "ima-menu-item-icon");
|
|
5646
|
+
iconContainer.setAttribute("aria-hidden", "true");
|
|
5647
|
+
}
|
|
5648
|
+
button.insertBefore(iconContainer, button.firstChild);
|
|
5649
|
+
}
|
|
5650
|
+
if (iconContainer) {
|
|
5651
|
+
iconContainer.innerHTML = icon;
|
|
5652
|
+
}
|
|
5653
|
+
}
|
|
5654
|
+
if (labelContainer && labelContainer !== iconContainer) {
|
|
5655
|
+
labelContainer.textContent = label;
|
|
5656
|
+
} else {
|
|
5657
|
+
const remaining = [...button.children].filter((el) => el !== iconContainer);
|
|
5658
|
+
if (remaining.length >= 1) {
|
|
5659
|
+
remaining[0].textContent = label;
|
|
5660
|
+
} else if (ownerDoc && typeof ownerDoc.createElement === "function") {
|
|
5661
|
+
const textNode = ownerDoc.createElement("span");
|
|
5662
|
+
textNode.textContent = label;
|
|
5663
|
+
button.appendChild(textNode);
|
|
5664
|
+
} else {
|
|
5665
|
+
button.textContent = label;
|
|
5666
|
+
}
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
5669
|
+
|
|
5476
5670
|
/**
|
|
5477
5671
|
* 官方视图选项菜单没有扩展位,注入第四个分组项「按频道」。
|
|
5478
5672
|
* 只在频道页签挂载期间生效。
|
|
@@ -5499,11 +5693,11 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5499
5693
|
button.removeAttribute("disabled");
|
|
5500
5694
|
button.disabled = false;
|
|
5501
5695
|
button.classList.remove("danger");
|
|
5502
|
-
for (const
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5696
|
+
for (const child of [...button.children]) {
|
|
5697
|
+
if (child.tagName && child.tagName.toLowerCase() === "svg") child.remove();
|
|
5698
|
+
}
|
|
5699
|
+
for (const check of button.querySelectorAll('[class*="check"], svg[class*="check"]')) check.remove();
|
|
5700
|
+
replaceMenuItemContent(button, (first.textContent || "").trim(), options.label, channelMarkup(h(IconQueueOutline, { size: 16 })));
|
|
5507
5701
|
if (options.checked) {
|
|
5508
5702
|
const check = document.createElement("span");
|
|
5509
5703
|
check.innerHTML = channelMarkup(h(IconCheckOutline, { size: 16 }));
|
|
@@ -5560,23 +5754,53 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5560
5754
|
}
|
|
5561
5755
|
if (target.closest('[role="menu"]') === null) channelId = undefined;
|
|
5562
5756
|
};
|
|
5563
|
-
const
|
|
5757
|
+
const hiddenElements = new Map();
|
|
5758
|
+
const hideElement = (el) => {
|
|
5759
|
+
if (!el || typeof el.getAttribute !== "function") return;
|
|
5760
|
+
if (!hiddenElements.has(el)) {
|
|
5761
|
+
hiddenElements.set(el, {
|
|
5762
|
+
display: el.style.display || "",
|
|
5763
|
+
ariaHidden: el.getAttribute("aria-hidden"),
|
|
5764
|
+
});
|
|
5765
|
+
}
|
|
5766
|
+
el.style.display = "none";
|
|
5767
|
+
el.setAttribute("aria-hidden", "true");
|
|
5768
|
+
};
|
|
5769
|
+
const purgeDetached = () => {
|
|
5770
|
+
for (const el of hiddenElements.keys()) {
|
|
5771
|
+
if (typeof document.contains === "function" && !document.contains(el)) {
|
|
5772
|
+
hiddenElements.delete(el);
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
};
|
|
5564
5776
|
const hideOthers = (menu, ours) => {
|
|
5777
|
+
purgeDetached();
|
|
5565
5778
|
for (const item of menu.querySelectorAll('button[role="menuitem"]')) {
|
|
5566
5779
|
if (ours.has(item)) continue;
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5780
|
+
hideElement(item);
|
|
5781
|
+
const wrapper = item.parentElement;
|
|
5782
|
+
if (wrapper && wrapper !== menu && wrapper.parentElement === menu) {
|
|
5783
|
+
let containsOurs = false;
|
|
5784
|
+
for (const o of ours) {
|
|
5785
|
+
if (typeof wrapper.contains === "function" && wrapper.contains(o)) {
|
|
5786
|
+
containsOurs = true;
|
|
5787
|
+
break;
|
|
5788
|
+
}
|
|
5789
|
+
}
|
|
5790
|
+
if (!containsOurs) hideElement(wrapper);
|
|
5572
5791
|
}
|
|
5573
|
-
|
|
5574
|
-
|
|
5792
|
+
}
|
|
5793
|
+
for (const sep of menu.querySelectorAll('[role="separator"], hr, [class*="separator"], [class*="divider"]')) {
|
|
5794
|
+
hideElement(sep);
|
|
5575
5795
|
}
|
|
5576
5796
|
};
|
|
5577
5797
|
const inject = (menu) => {
|
|
5578
5798
|
if (channelId === undefined || performance.now() - rememberedAt > 2000) return;
|
|
5579
|
-
|
|
5799
|
+
const existing = menu.querySelector(`button[${CHANNEL_GROUP_MENU_ATTR}="true"]`);
|
|
5800
|
+
if (existing !== null) {
|
|
5801
|
+
hideOthers(menu, new Set([existing]));
|
|
5802
|
+
return;
|
|
5803
|
+
}
|
|
5580
5804
|
const items = [...menu.querySelectorAll('button[role="menuitem"]')];
|
|
5581
5805
|
if (items.length === 0) return;
|
|
5582
5806
|
const menuText = items.map((item) => item.textContent || "").join(" ");
|
|
@@ -5596,15 +5820,15 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5596
5820
|
button.removeAttribute(CHANNEL_GROUP_MENU_ATTR);
|
|
5597
5821
|
button.removeAttribute("aria-disabled");
|
|
5598
5822
|
button.removeAttribute("disabled");
|
|
5823
|
+
button.removeAttribute("aria-keyshortcuts");
|
|
5824
|
+
button.removeAttribute("aria-describedby");
|
|
5599
5825
|
button.disabled = false;
|
|
5600
5826
|
button.style.opacity = "";
|
|
5601
5827
|
button.style.cursor = "";
|
|
5602
5828
|
button.classList.remove("danger");
|
|
5603
5829
|
button.setAttribute(CHANNEL_GROUP_MENU_ATTR, "true");
|
|
5604
|
-
const
|
|
5605
|
-
|
|
5606
|
-
if (spans[1] !== undefined) spans[1].textContent = label;
|
|
5607
|
-
else button.textContent = label;
|
|
5830
|
+
for (const extra of button.querySelectorAll('[class*="check"], [class*="shortcut"]')) extra.remove();
|
|
5831
|
+
replaceMenuItemContent(button, (template.textContent || "").trim(), label, icon);
|
|
5608
5832
|
let fired = false;
|
|
5609
5833
|
const activate = (event) => {
|
|
5610
5834
|
if (fired) return;
|
|
@@ -5645,12 +5869,12 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5645
5869
|
observer.disconnect();
|
|
5646
5870
|
document.removeEventListener("pointerdown", remember, true);
|
|
5647
5871
|
document.removeEventListener("click", remember, true);
|
|
5648
|
-
for (const [
|
|
5649
|
-
|
|
5650
|
-
if (previous.ariaHidden === null)
|
|
5651
|
-
else
|
|
5872
|
+
for (const [el, previous] of hiddenElements) {
|
|
5873
|
+
el.style.display = previous.display;
|
|
5874
|
+
if (previous.ariaHidden === null) el.removeAttribute("aria-hidden");
|
|
5875
|
+
else el.setAttribute("aria-hidden", previous.ariaHidden);
|
|
5652
5876
|
}
|
|
5653
|
-
|
|
5877
|
+
hiddenElements.clear();
|
|
5654
5878
|
for (const item of document.querySelectorAll(`[${CHANNEL_GROUP_MENU_ATTR}="true"]`)) item.parentElement?.remove();
|
|
5655
5879
|
};
|
|
5656
5880
|
}
|
|
@@ -5705,7 +5929,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5705
5929
|
const groups = useMemo(() => channelGroupsFromSessionState(sessionSource, t), [membershipRevision, sessionSource, t]);
|
|
5706
5930
|
const groupsRef = useRef(groups);
|
|
5707
5931
|
groupsRef.current = groups;
|
|
5708
|
-
const [channelIcons, setChannelIcons] = useState("");
|
|
5709
5932
|
const [workspaceIcons, setWorkspaceIcons] = useState("");
|
|
5710
5933
|
const open = props.openSession || hostProps.open || hostProps.openSession;
|
|
5711
5934
|
const openChannelSettings = props.openChannelSettings || hostProps.openChannelSettings;
|
|
@@ -5713,10 +5936,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5713
5936
|
|
|
5714
5937
|
useEffect(() => { ensureStyle(); }, []);
|
|
5715
5938
|
|
|
5716
|
-
useEffect(() => {
|
|
5717
|
-
if (groupBy === "channel" && channelIcons === "") setChannelIcons(channelIconCss());
|
|
5718
|
-
}, [channelIcons, groupBy]);
|
|
5719
|
-
|
|
5720
5939
|
const memberKey = groups.map((group) => group.id + ":" + (group.sessions || []).map((session) => session.sessionId).join(",")).join("|");
|
|
5721
5940
|
const memberIds = useMemo(() => {
|
|
5722
5941
|
const ids = new Set();
|
|
@@ -5784,7 +6003,11 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5784
6003
|
resolve: (channelId) => groupsRef.current.find((group) => group.id === channelId),
|
|
5785
6004
|
onSettings: (group) => {
|
|
5786
6005
|
if (typeof openChannelSettings === "function") {
|
|
5787
|
-
openChannelSettings({
|
|
6006
|
+
openChannelSettings({
|
|
6007
|
+
channelId: group.platform || group.id,
|
|
6008
|
+
accountId: group.accountId || group.id,
|
|
6009
|
+
name: group.label || channelLabel(group, t),
|
|
6010
|
+
});
|
|
5788
6011
|
return;
|
|
5789
6012
|
}
|
|
5790
6013
|
openImSettings();
|
|
@@ -5852,7 +6075,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
5852
6075
|
|
|
5853
6076
|
return h(React.Fragment, null,
|
|
5854
6077
|
h("div", { className: "ima-channel-official", "data-mode": groupBy },
|
|
5855
|
-
groupBy === "channel" && channelIcons !== "" && h("style", null, channelIcons),
|
|
5856
6078
|
groupBy !== "channel" && workspaceIcons !== "" && h("style", null, workspaceIcons),
|
|
5857
6079
|
// 宿主列表失败时 phase 仍停在 pending,没有横幅就是整页空白。
|
|
5858
6080
|
groupsError && h("div", { className: "ima-channel-error", role: "alert" }, t("error.load")),
|