dsh-napcat-keeper 2.8.0 → 2.8.2
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 +30 -0
- package/README.md +52 -4
- package/lib/client.js +110 -10
- package/lib/index.js +676 -38
- package/package.json +5 -2
- package/scripts/selftest-companion.mjs +488 -0
- package/scripts/selftest-layout.mjs +93 -0
- package/scripts/selftest-probe.mjs +6 -1
- package/scripts/smoke-client.mjs +89 -0
package/scripts/smoke-client.mjs
CHANGED
|
@@ -147,6 +147,74 @@ delete states[0].runtime.clients;
|
|
|
147
147
|
const auth = collect(render());
|
|
148
148
|
check('401 时显示「端口要求鉴权」', auth.text.includes('端口要求鉴权'));
|
|
149
149
|
|
|
150
|
+
// 和 dsh-onebot-qq 共存:没装时说没检测到;装了要说清版本 / 挂没挂 / 端口 / 令牌
|
|
151
|
+
states[0].runtime.mode = 'reverse';
|
|
152
|
+
states[0].runtime.online = true;
|
|
153
|
+
states[0].runtime.portStatus = 426;
|
|
154
|
+
const noComp = collect(render());
|
|
155
|
+
check('没装共存插件时也有「共存插件」那行', noComp.text.includes('共存插件'));
|
|
156
|
+
check('没装时写「没检测到 dsh-onebot-qq」', noComp.text.includes('没检测到 dsh-onebot-qq'));
|
|
157
|
+
check('没装时设置页不画「跟随 dsh-onebot-qq」这一行', !noComp.text.includes('只在 dsh-onebot-qq 装了'));
|
|
158
|
+
states[0].runtime.companion = { version: '0.9.6', profile: 'desktop', mounted: true, mode: 'reverse', host: '127.0.0.1', port: 8643, url: 'ws://127.0.0.1:3001', tokenKnown: true };
|
|
159
|
+
states[0].runtime.companionReady = true;
|
|
160
|
+
states[0].runtime.companionTokenMatch = false;
|
|
161
|
+
states[0].runtime.portUsed = 8643;
|
|
162
|
+
states[0].runtime.followed = true;
|
|
163
|
+
const comp = collect(render());
|
|
164
|
+
check('装了会说版本与「已启用」', comp.text.includes('dsh-onebot-qq 0.9.6') && comp.text.includes('已启用'));
|
|
165
|
+
check('反向模式写出监听端口', /反向 WS :8643/.test(comp.text));
|
|
166
|
+
check('令牌不一致要标出来', comp.text.includes('令牌不一致'));
|
|
167
|
+
check('跟随了就说跟到了哪个端口', comp.text.includes('端口 8643') && comp.text.includes('跟随 dsh-onebot-qq'));
|
|
168
|
+
check('装了且启用时才画「跟随 dsh-onebot-qq」这一行', comp.text.includes('只在 dsh-onebot-qq 装了'));
|
|
169
|
+
states[0].runtime.companion.mounted = false;
|
|
170
|
+
states[0].runtime.companionReady = false;
|
|
171
|
+
states[0].runtime.companionTokenMatch = null;
|
|
172
|
+
states[0].runtime.followed = false;
|
|
173
|
+
const notMounted = collect(render());
|
|
174
|
+
check('没挂进 profile 时说清楚(免得以为在生效)', notMounted.text.includes('已安装但没挂进 profile'));
|
|
175
|
+
check('没启用时那一行也不画', !notMounted.text.includes('只在 dsh-onebot-qq 装了'));
|
|
176
|
+
check('共存那行顺带说明「跟随」开关不会出现', notMounted.text.includes('「跟随」那个开关不会出现'));
|
|
177
|
+
delete states[0].runtime.companion;
|
|
178
|
+
delete states[0].runtime.companionReady;
|
|
179
|
+
delete states[0].runtime.companionTokenMatch;
|
|
180
|
+
|
|
181
|
+
// 和 dsh-qq-bridge 共存:它是「客户端」,要能看出装没装、挂没挂、连的端口对不对
|
|
182
|
+
const noBridge = collect(render());
|
|
183
|
+
check('没装桥接时也有「桥接插件」那行', noBridge.text.includes('桥接插件'));
|
|
184
|
+
check('没装时写「没检测到 dsh-qq-bridge」', noBridge.text.includes('没检测到 dsh-qq-bridge'));
|
|
185
|
+
states[0].runtime.bridgePlugin = {
|
|
186
|
+
version: '1.0.7',
|
|
187
|
+
profile: 'desktop',
|
|
188
|
+
mounted: true,
|
|
189
|
+
enabled: true,
|
|
190
|
+
dryRun: false,
|
|
191
|
+
napcatUrl: 'http://127.0.0.1:8643',
|
|
192
|
+
napcatPort: 8643,
|
|
193
|
+
tokenKnown: false,
|
|
194
|
+
bindings: 0,
|
|
195
|
+
configKnown: true,
|
|
196
|
+
check: 'bridge-hits-reverse',
|
|
197
|
+
note: 'dsh-qq-bridge 连的是 http://127.0.0.1:8643,而那个端口现在是反向 WebSocket',
|
|
198
|
+
};
|
|
199
|
+
const withBridge = collect(render());
|
|
200
|
+
check('装了会说版本与状态', withBridge.text.includes('dsh-qq-bridge 1.0.7') && withBridge.text.includes('已启用'));
|
|
201
|
+
check('在发 / 试运行 要分得清', withBridge.text.includes('在发'));
|
|
202
|
+
check('连的是反向 WS 端口要标出来', withBridge.text.includes('连的是反向 WS 端口'));
|
|
203
|
+
check('提示文案单独一行给出来', withBridge.text.includes('桥接提示:') && withBridge.text.includes('反向 WebSocket'));
|
|
204
|
+
states[0].runtime.bridgePlugin = {
|
|
205
|
+
...states[0].runtime.bridgePlugin,
|
|
206
|
+
mounted: false,
|
|
207
|
+
enabled: false,
|
|
208
|
+
dryRun: true,
|
|
209
|
+
check: 'not-mounted',
|
|
210
|
+
note: '',
|
|
211
|
+
};
|
|
212
|
+
const bridgeOff = collect(render());
|
|
213
|
+
check('没挂进 profile 时说清楚', bridgeOff.text.includes('已安装但没挂进 profile'));
|
|
214
|
+
check('总开关关着要说出来', bridgeOff.text.includes('总开关关着'));
|
|
215
|
+
|
|
216
|
+
delete states[0].runtime.bridgePlugin;
|
|
217
|
+
|
|
150
218
|
// 盘数跟 drives 走:1 块 / 5 块 / 0 块
|
|
151
219
|
for (const drives of [['C:'], ['C:', 'D:', 'E:', 'F:', 'G:'], []]) {
|
|
152
220
|
states[0].drives = drives;
|
|
@@ -220,4 +288,25 @@ const noSetup = collect(render());
|
|
|
220
288
|
check('缺 setup 字段时降级提示', noSetup.text.includes('读不到脚本状态'));
|
|
221
289
|
states[0].setup = keepSetup;
|
|
222
290
|
|
|
291
|
+
// 「进程」那行:按安装形态换词(boot 恒 0 不代表没进程)
|
|
292
|
+
const keepRuntime = states[0].runtime;
|
|
293
|
+
const 进程行 = (runtimePatch) => {
|
|
294
|
+
states[0].runtime = { ...keepRuntime, ...runtimePatch };
|
|
295
|
+
return collect(render()).text;
|
|
296
|
+
};
|
|
297
|
+
const nodeText = 进程行({ layout: 'node', procs: { boot: 0, qq: 2, chains: 1, dup: false, known: true } });
|
|
298
|
+
check('node 型写「主/工作进程 2(node)」而不是 NapCatWinBootMain 0', nodeText.includes('主/工作进程 2(node)'), nodeText.slice(0, 80));
|
|
299
|
+
check('node 型不再出现「NapCatWinBootMain 0」这种说法', !nodeText.includes('NapCatWinBootMain 0'), nodeText.slice(0, 80));
|
|
300
|
+
const bootText = 进程行({ layout: 'boot', procs: { boot: 1, qq: 4, chains: 1, dup: false, known: true } });
|
|
301
|
+
check('boot 型写「快登壳 1 | QQ 4」', bootText.includes('快登壳 1 | QQ 4 | 链 1'), bootText.slice(0, 80));
|
|
302
|
+
const legacyText = 进程行({ layout: undefined, procs: { boot: 0, qq: 2, chains: 1, dup: false, known: true } });
|
|
303
|
+
check('老服务端没给 layout → 退回原来三项', legacyText.includes('NapCatWinBootMain 0 | QQ 2 | 链 1'), legacyText.slice(0, 80));
|
|
304
|
+
const lyingText = 进程行({ layout: 'boot', procs: { boot: 0, qq: 2, chains: 1, dup: false, known: true } });
|
|
305
|
+
check('服务端还说是 boot、可壳是 0 个 → 按实际在跑的 node 说', lyingText.includes('主/工作进程 2(node)'), lyingText.slice(0, 80));
|
|
306
|
+
const unknownText = 进程行({ layout: 'node', procs: { boot: 0, qq: 0, chains: 0, dup: false, known: false } });
|
|
307
|
+
check('还没探测时说「(还没探测)」', unknownText.includes('(还没探测)'), unknownText.slice(0, 80));
|
|
308
|
+
const dupText = 进程行({ layout: 'node', procs: { boot: 0, qq: 2, chains: 2, dup: true, known: true } });
|
|
309
|
+
check('有重复链要标出来', dupText.includes('⚠ 有重复链'), dupText.slice(0, 80));
|
|
310
|
+
states[0].runtime = keepRuntime;
|
|
311
|
+
|
|
223
312
|
process.exit(bad ? 1 : 0);
|