dsh-foxy-weibo 0.2.1 → 0.2.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/README.md CHANGED
@@ -6,7 +6,7 @@ Foxy 的微博子插件:按 foxy3 预设关注微博账号、阅读博文、
6
6
 
7
7
  ## 功能
8
8
 
9
- - **主模式**:检查自己的微博 UID,读取自己新博文下的评论,只回复未回复的他人评论;
9
+ - **博文评论回复**:检查指定的监控账号 UID,读取其新博文下的评论,只回复未处理的他人评论;登录账号是机器人自己,监控账号通常是主人账号;
10
10
  - 可设置每日检查时间(`HH:MM`,最多 6 个),例如 `08:30, 20:00`;
11
11
  - 回复前按 foxy3 预设判断 `skip / comment`,不设最少字数,最多 80 字;
12
12
  - 旧模式保留:关注一个或多个微博 UID,定时读取时间线并评论;
@@ -47,7 +47,7 @@ Cookie 只保存在本机 `~/.dsh/foxy-weibo/settings.json`,不会回传给前
47
47
 
48
48
  ### 自己的 UID / 关注 UID
49
49
 
50
- `自己的微博 UID` 是主模式使用的账号,插件只检查它的新博文和评论。
50
+ `监控账号 UID` 是要检查博文评论的目标账号(通常是主人账号);`当前账号` 是扫码登录的机器人账号,两者可以不同。
51
51
 
52
52
  `关注 UID` 是旧模式使用,多个 UID 用逗号分隔,最多 20 个。UID 是微博用户主页 URL 里的数字 ID,例如 `https://weibo.com/u/1234567890`。
53
53
 
@@ -63,7 +63,7 @@ Cookie 只保存在本机 `~/.dsh/foxy-weibo/settings.json`,不会回传给前
63
63
 
64
64
  ## 建议顺序
65
65
 
66
- 1. 扫码登录,填自己的微博 UID,`enabled: true`、`replyMode: off`;
66
+ 1. 扫码登录,填监控账号 UID,`enabled: true`、`replyMode: off`;
67
67
  2. 设置每日检查时间,或先点「立即运行」,看日志和「调试」里的模型决策;
68
68
  3. 确认判断正常后,再开启 `replyMode: auto`,每日上限先设为 1;
69
69
  4. 「立即检查」只判断不发布,用来预览回复;「立即回复」会真实发布一条,适合测试;
package/cordis.patch.yml CHANGED
@@ -10,7 +10,7 @@
10
10
  config:
11
11
  enabled: false
12
12
  cookie: ''
13
- selfUid: ''
13
+ targetUid: ''
14
14
  targetUids: []
15
15
  replyOwnPosts: true
16
16
  replyMode: 'off'
package/lib/client.js CHANGED
@@ -218,8 +218,8 @@ window.__ModuleLoader__.load({
218
218
  ? '未开始:自动浏览已关闭'
219
219
  : result.skipped === 'busy'
220
220
  ? '正在运行,请稍候'
221
- : result.skipped === 'no-self'
222
- ? '未开始:请先填写自己的微博 UID'
221
+ : result.skipped === 'no-target'
222
+ ? '未开始:请先填写监控账号 UID'
223
223
  : `运行完成:检查 ${result.checked || 0} 条,回复 ${result.replied || 0} 条` +
224
224
  (result.previewed ? `,预览 ${result.previewed} 条` : '') +
225
225
  `,跳过 ${result.skipped || 0} 条`,
@@ -234,8 +234,8 @@ window.__ModuleLoader__.load({
234
234
  setStatus(data.status)
235
235
  const result = data.result || {}
236
236
  setNotice(
237
- result.skipped === 'no-self'
238
- ? '未开始:请先扫码登录或填写自己的微博 UID'
237
+ result.skipped === 'no-target'
238
+ ? '未开始:请先填写监控账号 UID'
239
239
  : result.skipped === 'busy'
240
240
  ? '正在运行,请稍候'
241
241
  : `检查完成:检查 ${result.checked || 0} 条评论,预览 ${result.previewed || 0} 条,跳过 ${result.skipped || 0} 条` +
@@ -254,8 +254,8 @@ window.__ModuleLoader__.load({
254
254
  setNotice(
255
255
  result.replied > 0
256
256
  ? `已立即回复 ${result.replied} 条,可在下方日志查看`
257
- : result.skipped === 'no-self'
258
- ? '未开始:请先扫码登录或填写自己的微博 UID'
257
+ : result.skipped === 'no-target'
258
+ ? '未开始:请先填写监控账号 UID'
259
259
  : '没有可立即回复的评论(可能已处理或模型选择跳过)',
260
260
  )
261
261
  } catch (e) { setError(e.message) } finally { setBusy('') }
@@ -272,7 +272,7 @@ window.__ModuleLoader__.load({
272
272
  h('div', { className: 'fw-head' },
273
273
  h('div', null,
274
274
  h('p', { className: 'fw-eyebrow' }, 'FOXY EXTENSION'),
275
- h('h1', null, '微博浏览'),
275
+ h('h1', null, '微博评论'),
276
276
  h('p', null, 'Foxy 按 foxy3 预设关注微博账号,阅读、判断、评论并写入记忆。'),
277
277
  ),
278
278
  h('span', { className: 'fw-badge' }, settings.enabled ? '自动浏览已开启' : '自动浏览已关闭'),
@@ -284,8 +284,8 @@ window.__ModuleLoader__.load({
284
284
  h(Field, { label: '当前账号', hint: '扫码成功后自动显示' },
285
285
  h('input', { value: settings.accountName ? `${settings.accountName}(${settings.accountUid || '?'})` : settings.cookieSet ? '已登录' : '未登录', readOnly: true }),
286
286
  ),
287
- h(Field, { label: '自己的微博 UID', hint: '主功能会检查这个账号的新博文评论' },
288
- h('input', { value: settings.selfUid || '', placeholder: '例如 1234567890', onChange: (e) => setField('selfUid', e.target.value) })),
287
+ h(Field, { label: '监控账号 UID', hint: '要检查博文评论的目标账号;不是登录的机器人账号' },
288
+ h('input', { value: settings.targetUid || '', placeholder: '例如 1234567890', onChange: (e) => setField('targetUid', e.target.value) })),
289
289
  ),
290
290
  h('div', { className: 'fw-actions' },
291
291
  h('button', { className: 'fw-btn primary', disabled: !!busy, onClick: startLogin }, busy === 'login' ? '获取二维码…' : qr ? '刷新二维码' : '扫码登录'),
@@ -314,9 +314,9 @@ window.__ModuleLoader__.load({
314
314
  ),
315
315
 
316
316
  h('section', { className: 'fw-card' },
317
- h(SectionHead, { title: '回复自己的博文', description: '主功能:每天按设定时间检查自己的新博文,只回复未回复的他人评论。' }),
317
+ h(SectionHead, { title: '博文评论回复', description: '每日按设定时间检查目标账号的新博文,并回复其评论区中尚未处理的他人评论。' }),
318
318
  h(Toggle, { checked: settings.enabled, onChange: (v) => setField('enabled', v), label: '启用自动检查', hint: '关闭后定时任务不运行,仍可使用「立即运行」。' }),
319
- h(Toggle, { checked: settings.replyOwnPosts, onChange: (v) => setField('replyOwnPosts', v), label: '主模式:只看自己的博文评论', hint: '关闭后回到旧模式,浏览关注账号的时间线并评论博文。' }),
319
+ h(Toggle, { checked: settings.replyOwnPosts, onChange: (v) => setField('replyOwnPosts', v), label: '仅监控目标账号的博文', hint: '关闭后回到旧模式,浏览关注账号的时间线并评论博文。' }),
320
320
  h('div', { className: 'fw-grid' },
321
321
  h(Field, { label: '每日检查时间', hint: 'HH:MM,多个用逗号分隔,最多 6 个,例如 08:30, 20:00' },
322
322
  h('input', { value: scheduleText, placeholder: '20:00', onChange: (e) => setScheduleText(e.target.value) })),
@@ -331,7 +331,7 @@ window.__ModuleLoader__.load({
331
331
  h('input', { type: 'number', min: 0, max: 10, value: settings.maxCommentsPerDay, onChange: (e) => setField('maxCommentsPerDay', e.target.value) })),
332
332
  ),
333
333
  h('div', { className: 'fw-grid' },
334
- h(Field, { label: '时间线轮询(旧模式备用)', hint: '关闭主模式时使用,分钟' },
334
+ h(Field, { label: '时间线轮询(旧模式备用)', hint: '关闭“仅监控目标账号的博文”时使用,分钟' },
335
335
  h('input', { type: 'number', min: 5, max: 1440, value: settings.intervalMinutes, onChange: (e) => setField('intervalMinutes', e.target.value) })),
336
336
  h(Field, { label: '旧模式评论模式', hint: '浏览他人博文时是否发一级评论' },
337
337
  h('select', { value: settings.commentMode, onChange: (e) => setField('commentMode', e.target.value) },
package/lib/index.js CHANGED
@@ -164,8 +164,9 @@ async function scanOwnComments(ctx, config, state, log, force = false, options =
164
164
  const forceReply = options.forceReply === true
165
165
  const canReply = !previewOnly && (forceReply || config.replyMode === 'auto')
166
166
  const targetCid = String(options.cid || '').trim()
167
- const selfUid = String(config.selfUid || config.accountUid || '').trim()
168
- if (!selfUid) return { skipped: 'no-self' }
167
+ const targetUid = String(config.targetUid || '').trim()
168
+ if (!targetUid) return { skipped: 'no-target' }
169
+ const loginUid = String(config.accountUid || '').trim()
169
170
  const maxPosts = Math.max(1, Math.min(20, Number(config.maxPostsPerRun) || 5))
170
171
  const maxReplies = Math.max(1, Math.min(8, Number(options.maxReplies ?? config.maxCommentsPerDay) || 1))
171
172
  const ignoreQuota = forceReply
@@ -180,7 +181,7 @@ async function scanOwnComments(ctx, config, state, log, force = false, options =
180
181
  }
181
182
  let posts = []
182
183
  try {
183
- posts = await fetchTimeline(selfUid, config)
184
+ posts = await fetchTimeline(targetUid, config)
184
185
  } catch (error) {
185
186
  return { ...result, errors: 1, error: error?.message || String(error) }
186
187
  }
@@ -199,7 +200,7 @@ async function scanOwnComments(ctx, config, state, log, force = false, options =
199
200
  if (targetCid && String(comment.cid) !== targetCid) continue
200
201
  if (canReply && result.replied >= maxReplies) break
201
202
  if (!comment.cid || state.commentSeen[comment.cid]) continue
202
- if (String(comment.author?.uid || '') === selfUid) {
203
+ if (loginUid && String(comment.author?.uid || '') === loginUid) {
203
204
  state.commentSeen[comment.cid] = { at: Date.now(), status: 'self' }
204
205
  continue
205
206
  }
@@ -529,7 +530,8 @@ export function apply(ctx, rawConfig = {}) {
529
530
  enabled: config.enabled === true,
530
531
  running,
531
532
  mode: config.replyOwnPosts === false ? 'timeline' : 'own-comments',
532
- selfUid: config.selfUid || config.accountUid || '',
533
+ targetUid: config.targetUid || '',
534
+ loginUid: config.accountUid || '',
533
535
  scheduleTimes: config.scheduleTimes,
534
536
  nextRunAt,
535
537
  replyMode: config.replyMode,
@@ -631,7 +633,6 @@ export function apply(ctx, rawConfig = {}) {
631
633
  config.cookie = result.cookie
632
634
  config.accountName = result.account?.screenName || ''
633
635
  config.accountUid = result.account?.uid || ''
634
- if (!config.selfUid && result.account?.uid) config.selfUid = result.account.uid
635
636
  saveSettings(config)
636
637
  }
637
638
  return json({ ok: true, ...result, settings: publicSettings(config), status: status() })
package/lib/settings.js CHANGED
@@ -5,7 +5,7 @@ import { dirname, join } from 'node:path'
5
5
  export const DEFAULTS = {
6
6
  enabled: false,
7
7
  cookie: '',
8
- selfUid: '',
8
+ targetUid: '',
9
9
  targetUids: [],
10
10
  replyOwnPosts: true,
11
11
  replyMode: 'off', // off | auto
@@ -26,7 +26,7 @@ export const DEFAULTS = {
26
26
 
27
27
  export const SETTING_KEYS = [
28
28
  'enabled',
29
- 'selfUid',
29
+ 'targetUid',
30
30
  'targetUids',
31
31
  'replyOwnPosts',
32
32
  'replyMode',
@@ -45,7 +45,7 @@ export const SETTING_KEYS = [
45
45
  ]
46
46
 
47
47
  const TEXT_KEYS = new Set([
48
- 'selfUid',
48
+ 'targetUid',
49
49
  'commentMode',
50
50
  'replyMode',
51
51
  'memoryPresetId',
@@ -137,6 +137,8 @@ export function loadSettings(base = {}) {
137
137
  if (existsSync(settingsPath())) {
138
138
  const parsed = JSON.parse(readFileSync(settingsPath(), 'utf8'))
139
139
  next = normalizePatch(next, parsed)
140
+ // 0.2.x used selfUid for the monitored account; migrate it once.
141
+ if (!next.targetUid && typeof parsed.selfUid === 'string') next.targetUid = parsed.selfUid.trim()
140
142
  if (typeof parsed.cookie === 'string') next.cookie = parsed.cookie
141
143
  if (typeof parsed.llmApiKey === 'string') next.llmApiKey = parsed.llmApiKey
142
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-foxy-weibo",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Foxy's Weibo transport for DeepSeek Harness: follow users, read posts, comment, reply, and remember events.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",