dsh-qqbot-muu 0.1.8 → 0.1.9

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # 更新日志
2
2
 
3
+ ## 0.1.9
4
+
5
+ ### 文档
6
+ - README 新增「默认谁都不会被回(空名单 = 全拒)」一节:写清出厂默认(`care` 模式 + 空名单 = 私聊/群聊一律不回复)、三个添加入口(桌宠面板按名字加 / 配置里填 OpenID / 临时改 `open`),以及自己的 OpenID 在哪看。
7
+ - 市场条目按上游规范迁到 `data/plugins/<owner>__<repo>.yml`,描述里明确写出访问默认值。
8
+
9
+ > 0.1.9 与 0.1.8 的代码完全一致,只补了访问控制的说明与市场提交结构;npm 同版本不可覆盖,所以用新版本号带上这批文档修正。
10
+
3
11
  ## 0.1.8
4
12
 
5
13
  ### 修复
package/README.md CHANGED
@@ -240,10 +240,31 @@ access:
240
240
  groupAllow: ['额外放行的群openid']
241
241
  ```
242
242
 
243
- > 不知道 openid?试者在群里 @ 她一句,然后 `harness.log` 搜 `not in allowlist`,括号里就是;
243
+ > 不知道 openid?让对方在群里 @ 她一句或私聊发一句,然后 `harness.log` 搜 `not in allowlist`,括号里就是;
244
244
  > care/allowlist 名单为空时启动日志会打醒目提示(不会静默)。
245
245
  > 拒绝时日志会打醒目提示(不会静默)。
246
246
 
247
+ ### 默认谁都不会被回(空名单 = 全拒)
248
+
249
+ **这是刻意的安全默认,不是 bug。** 装完 `care` 模式下两份名单都是空的,
250
+ 所以**私聊和群聊默认谁都不理**(只记录、不回复)——先把人加进去,她才会开口。
251
+
252
+ 三个入口,任选一个(改完 5 秒内生效,不用重启):
253
+
254
+ 1. **浮窗「🧠 记忆」页 → 特别关心**:按**名字**加人/加群(最省事,不用 id)。
255
+ 2. **配置 `access` 段填 openid**(要精确控制时用):
256
+ ```yaml
257
+ access:
258
+ c2cMode: care # care = 只认特别关心 + 下面两个白名单
259
+ c2cAllow: ['对方的 openid'] # 私聊额外放行;"*" = 全放行
260
+ groupMode: care
261
+ groupAllow: ['群的 openid'] # 群聊额外放行
262
+ ```
263
+ 3. **临时全开**:把 `c2cMode` / `groupMode` 改成 `open`(任何人可用,公开 bot 才建议)。
264
+
265
+ **自己的 openid 在哪看**:对方发一条消息后,`harness.log` 里那条入站记录会带完整 openid;
266
+ 浮窗「任务管理」新建任务时也要求填同一串完整 openid(不是尾号)。
267
+
247
268
  ## 🚀 新装即用(v0.1.7 · 只缺省才写入的默认值)
248
269
 
249
270
  下载插件后**不用手工调**:启动时做一次"补丁式迁移",只往**空位**里补默认值。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-qqbot-muu",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "独立的 DSH QQ 桌宠助手插件:统一记忆库/印象卡、人格注入、表情包视觉打标、三形态桌宠+公网受限链接、逐帧视频流水线、B站运营(自持底盘,零 @zaofan 依赖)",
5
5
  "type": "module",
6
6
  "main": "./entry.js",
@@ -17,7 +17,7 @@
17
17
  */
18
18
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
19
19
  import { execFileSync } from 'node:child_process';
20
- import { dirname, join, resolve } from 'node:path';
20
+ import { dirname, join, relative, resolve, sep } from 'node:path';
21
21
  import { fileURLToPath } from 'node:url';
22
22
 
23
23
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
@@ -84,17 +84,25 @@ function readJson(p) {
84
84
  }
85
85
 
86
86
  // ── 1) 条目文件 ─────────────────────────────────────────────────────────
87
+ function walkYml(dir, acc = []) {
88
+ if (!existsSync(dir)) return acc;
89
+ for (const ent of readdirSync(dir, { withFileTypes: true })) {
90
+ const full = join(dir, ent.name);
91
+ if (ent.isDirectory()) walkYml(full, acc);
92
+ else if (ent.name.endsWith('.yml') || ent.name.endsWith('.yaml')) acc.push(full);
93
+ }
94
+ return acc;
95
+ }
87
96
  const subDir = join(ROOT, 'submission');
88
- const entries = existsSync(subDir)
89
- ? readdirSync(subDir).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'))
90
- : [];
91
- if (!entries.length) {
97
+ const entryFiles = walkYml(subDir);
98
+ if (!entryFiles.length) {
92
99
  bad('submission/ 下没有 .yml 条目');
93
100
  } else {
94
- for (const f of entries) {
101
+ for (const fullPath of entryFiles) {
102
+ const f = fullPath.split(sep).pop();
95
103
  if (f.endsWith('.yaml')) bad(`${f}: 市场只收 .yml,.yaml 会被直接跳过`);
96
- const rel = `submission/${f}`;
97
- const e = parseEntryYaml(readFileSync(join(subDir, f), 'utf8'));
104
+ const rel = relative(ROOT, fullPath).split(sep).join('/');
105
+ const e = parseEntryYaml(readFileSync(fullPath, 'utf8'));
98
106
 
99
107
  if (!e.url || !/^https:\/\/github\.com\/[^/]+\/[^/]+/.test(e.url)) bad(`${rel}: url 必须是 https://github.com/<owner>/<repo>`);
100
108
  if (!e.name) bad(`${rel}: 缺 name`);