@xmanrui/dsh-im 4.31.0 → 4.32.0
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/docs/client-integration.md +4 -0
- package/lib/client.js +90 -16
- package/lib/index.js +2 -2
- package/locale/en.json +5 -0
- package/locale/zh.json +5 -0
- package/package.json +5 -3
- package/plugin-src/client/i18n.js +2 -0
- package/plugin-src/client/index.js +3 -0
- package/plugin-src/client/plugin-page.js +51 -0
- package/plugin-src/client/styles.js +9 -0
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmanrui/dsh-im",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.32.0",
|
|
4
4
|
"icon": "./assets/logo-plugin-message-link-gradient.webp",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "把微信、飞书、企微、钉钉、QQ、Telegram、WhatsApp、Slack、Discord、Matrix接入DSH。 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"deepseek-harness",
|
|
8
8
|
"dsh",
|
|
@@ -116,13 +116,15 @@
|
|
|
116
116
|
"exports": {
|
|
117
117
|
".": "./lib/index.js",
|
|
118
118
|
"./client": "./lib/client.js",
|
|
119
|
-
"./package.json": "./package.json"
|
|
119
|
+
"./package.json": "./package.json",
|
|
120
|
+
"./locale/*.json": "./locale/*.json"
|
|
120
121
|
},
|
|
121
122
|
"files": [
|
|
122
123
|
"assets",
|
|
123
124
|
"bin",
|
|
124
125
|
"cordis.patch.yml",
|
|
125
126
|
"lib",
|
|
127
|
+
"locale/*.json",
|
|
126
128
|
"plugin-src",
|
|
127
129
|
"scripts/verify-interface-language.mjs",
|
|
128
130
|
"scripts/verify-injected-context.mjs",
|
|
@@ -42,6 +42,8 @@ const EN = Object.freeze({
|
|
|
42
42
|
'无需安装第三方服务;请按指引授予 macOS Messages 访问权限。': 'No third-party service is required; follow the guide to grant macOS Messages access.',
|
|
43
43
|
'macOS Messages 权限': 'macOS Messages permissions',
|
|
44
44
|
'IM机器人': 'IM bots',
|
|
45
|
+
'打开 IM机器人': 'Open IM bots',
|
|
46
|
+
'返回插件详情': 'Back to plugin details',
|
|
45
47
|
'IM机器人设置': 'IM bot settings',
|
|
46
48
|
'IM 面板加载失败': 'Could not load the IM panel',
|
|
47
49
|
'更多机器人设置': 'More bot settings',
|
|
@@ -83,6 +83,7 @@ import { installSessionChannelLogos } from './session-channel-logos.js';
|
|
|
83
83
|
import { UpdatePanel, UPDATE_RPC_CHANNEL } from './update-panel.js';
|
|
84
84
|
import { WorkspaceDirectoryPickerContext } from './workspace-editor.js';
|
|
85
85
|
import { IMPanelErrorBoundary } from './panel-error-boundary.js';
|
|
86
|
+
import { installImPluginPage } from './plugin-page.js';
|
|
86
87
|
|
|
87
88
|
export const name = 'im-settings';
|
|
88
89
|
export const inject = ['slots', 'connection', 'locale', 'workspaces'];
|
|
@@ -566,6 +567,8 @@ export function apply(ctx) {
|
|
|
566
567
|
preferredSectionId: props.preferredSectionId,
|
|
567
568
|
});
|
|
568
569
|
|
|
570
|
+
installImPluginPage(ctx, { packageName: manifest.name, renderPanel: buildPanelElement });
|
|
571
|
+
|
|
569
572
|
ctx.effect(() => {
|
|
570
573
|
let disposed = false;
|
|
571
574
|
let stopSettings = null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IM_LOCALE_NAMESPACE } from './i18n.js';
|
|
3
|
+
|
|
4
|
+
export const IM_MAIN_PANEL_ID = 'xmanrui-dsh-im';
|
|
5
|
+
const h = React.createElement;
|
|
6
|
+
|
|
7
|
+
function OpenImAction({ subject, packageName, onOpen, t }) {
|
|
8
|
+
if (subject?.kind !== 'bundle' && subject?.kind !== 'row') return null;
|
|
9
|
+
if (subject.pkg?.name !== packageName) return null;
|
|
10
|
+
if (subject.kind === 'row' && subject.row?.moduleName !== packageName) return null;
|
|
11
|
+
return h('button', {
|
|
12
|
+
type: 'button', className: 'dim-pluginOpen', onClick: onOpen,
|
|
13
|
+
}, t('打开 IM机器人'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ImPluginPage({ renderPanel, onBack, t }) {
|
|
17
|
+
return h('div', { className: 'dim-pluginPage' },
|
|
18
|
+
h('div', { className: 'dim-pluginPageContent' },
|
|
19
|
+
h('button', { type: 'button', className: 'dim-pluginBack', onClick: onBack },
|
|
20
|
+
h('span', { 'aria-hidden': true }, '‹'), t('返回插件详情')),
|
|
21
|
+
renderPanel()));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Optional services and slots keep the existing settings entry working on
|
|
25
|
+
// older DSH versions. Reuse the same panel through public navigation APIs.
|
|
26
|
+
export function installImPluginPage(ctx, { packageName, renderPanel }) {
|
|
27
|
+
if (typeof ctx.inject !== 'function') return;
|
|
28
|
+
ctx.inject(['layout', 'pluginNavigation'], (pageCtx) =>
|
|
29
|
+
pageCtx.slots.inject('main', () => {
|
|
30
|
+
const unregisterPage = pageCtx.slots.register({
|
|
31
|
+
name: 'main', key: IM_MAIN_PANEL_ID, locale: IM_LOCALE_NAMESPACE,
|
|
32
|
+
inject: () => ({
|
|
33
|
+
renderPanel,
|
|
34
|
+
onBack: () => pageCtx.pluginNavigation.openBundle(packageName),
|
|
35
|
+
}),
|
|
36
|
+
}, ImPluginPage);
|
|
37
|
+
const stopActions = pageCtx.slots.inject('plugins.detail.actions', () =>
|
|
38
|
+
pageCtx.slots.register({
|
|
39
|
+
name: 'plugins.detail.actions', id: 'xmanrui-dsh-im-open',
|
|
40
|
+
order: 20, locale: IM_LOCALE_NAMESPACE,
|
|
41
|
+
inject: () => ({
|
|
42
|
+
packageName,
|
|
43
|
+
onOpen: () => pageCtx.layout.selectPanel(IM_MAIN_PANEL_ID),
|
|
44
|
+
}),
|
|
45
|
+
}, OpenImAction));
|
|
46
|
+
return () => {
|
|
47
|
+
stopActions();
|
|
48
|
+
unregisterPage();
|
|
49
|
+
};
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export const IM_STYLE_ID = 'xmanrui-dsh-im-settings';
|
|
2
2
|
|
|
3
3
|
const CSS = String.raw`
|
|
4
|
+
.dim-pluginOpen { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 8px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
|
|
5
|
+
.dim-pluginOpen:hover { background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
|
|
6
|
+
.dim-pluginOpen:focus-visible, .dim-pluginBack:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 3px; }
|
|
7
|
+
.dim-pluginPage { height: 100%; min-height: 0; overflow: auto; box-sizing: border-box; padding: 24px clamp(16px, 4vw, 48px) 32px; color: var(--dsw-alias-label-primary, #1f2329); }
|
|
8
|
+
.dim-pluginPageContent { max-width: 1080px; margin: 0 auto; }
|
|
9
|
+
.dim-pluginBack { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; margin: 0 0 24px; padding: 6px 8px; border: 0; border-radius: 8px; color: var(--dsw-alias-label-secondary, #646a73); background: transparent; font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
|
|
10
|
+
.dim-pluginBack:hover { color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
|
|
11
|
+
.dim-pluginBack > span { font-size: 22px; line-height: 20px; }
|
|
12
|
+
@media (pointer: coarse) { .dim-pluginOpen, .dim-pluginBack { min-height: 44px; } }
|
|
4
13
|
.dim-connectionDiagnostic { min-width: 0; width: 100%; color: var(--dsw-alias-label-secondary, #646a73); overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
|
|
5
14
|
.dim-connectionDiagnostic[data-warning="true"] { color: var(--dsw-alias-state-warn-primary, #d97706); }
|
|
6
15
|
.dim-connectionDiagnostic p { margin: 4px 0; }
|