dsh-foxy-weibo 0.2.2 → 0.2.3
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/lib/client.js +12 -0
- package/lib/index.js +19 -6
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -213,6 +213,10 @@ window.__ModuleLoader__.load({
|
|
|
213
213
|
const data = await request('/run', { method: 'POST', body: '{}' })
|
|
214
214
|
setStatus(data.status)
|
|
215
215
|
const result = data.result || {}
|
|
216
|
+
if (result.error) {
|
|
217
|
+
setError(`检查失败:${result.error}`)
|
|
218
|
+
return
|
|
219
|
+
}
|
|
216
220
|
setNotice(
|
|
217
221
|
result.skipped === 'disabled'
|
|
218
222
|
? '未开始:自动浏览已关闭'
|
|
@@ -233,6 +237,10 @@ window.__ModuleLoader__.load({
|
|
|
233
237
|
const data = await request('/check-now', { method: 'POST', body: '{}' })
|
|
234
238
|
setStatus(data.status)
|
|
235
239
|
const result = data.result || {}
|
|
240
|
+
if (result.error) {
|
|
241
|
+
setError(`检查失败:${result.error}`)
|
|
242
|
+
return
|
|
243
|
+
}
|
|
236
244
|
setNotice(
|
|
237
245
|
result.skipped === 'no-target'
|
|
238
246
|
? '未开始:请先填写监控账号 UID'
|
|
@@ -251,6 +259,10 @@ window.__ModuleLoader__.load({
|
|
|
251
259
|
const data = await request('/reply-now', { method: 'POST', body: '{}' })
|
|
252
260
|
setStatus(data.status)
|
|
253
261
|
const result = data.result || {}
|
|
262
|
+
if (result.error) {
|
|
263
|
+
setError(`回复失败:${result.error}`)
|
|
264
|
+
return
|
|
265
|
+
}
|
|
254
266
|
setNotice(
|
|
255
267
|
result.replied > 0
|
|
256
268
|
? `已立即回复 ${result.replied} 条,可在下方日志查看`
|
package/lib/index.js
CHANGED
|
@@ -164,12 +164,6 @@ 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 targetUid = String(config.targetUid || '').trim()
|
|
168
|
-
if (!targetUid) return { skipped: 'no-target' }
|
|
169
|
-
const loginUid = String(config.accountUid || '').trim()
|
|
170
|
-
const maxPosts = Math.max(1, Math.min(20, Number(config.maxPostsPerRun) || 5))
|
|
171
|
-
const maxReplies = Math.max(1, Math.min(8, Number(options.maxReplies ?? config.maxCommentsPerDay) || 1))
|
|
172
|
-
const ignoreQuota = forceReply
|
|
173
167
|
const result = {
|
|
174
168
|
mode: options.mode || 'own-comments',
|
|
175
169
|
checked: 0,
|
|
@@ -179,6 +173,25 @@ async function scanOwnComments(ctx, config, state, log, force = false, options =
|
|
|
179
173
|
errors: 0,
|
|
180
174
|
items: [],
|
|
181
175
|
}
|
|
176
|
+
const targetUid = String(config.targetUid || '').trim()
|
|
177
|
+
if (!targetUid) return { skipped: 'no-target' }
|
|
178
|
+
let loginUid = String(config.accountUid || '').trim()
|
|
179
|
+
if (config.cookie) {
|
|
180
|
+
const account = await fetchAccount(config.cookie)
|
|
181
|
+
if (!account.uid) {
|
|
182
|
+
return {
|
|
183
|
+
...result,
|
|
184
|
+
errors: 1,
|
|
185
|
+
error: '微博登录态无效,请重新扫码登录后再检查',
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!loginUid) loginUid = account.uid
|
|
189
|
+
} else {
|
|
190
|
+
return { ...result, errors: 1, error: '请先扫码登录微博账号' }
|
|
191
|
+
}
|
|
192
|
+
const maxPosts = Math.max(1, Math.min(20, Number(config.maxPostsPerRun) || 5))
|
|
193
|
+
const maxReplies = Math.max(1, Math.min(8, Number(options.maxReplies ?? config.maxCommentsPerDay) || 1))
|
|
194
|
+
const ignoreQuota = forceReply
|
|
182
195
|
let posts = []
|
|
183
196
|
try {
|
|
184
197
|
posts = await fetchTimeline(targetUid, config)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-foxy-weibo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|
|
@@ -48,3 +48,4 @@
|
|
|
48
48
|
"test": "node test/test-weibo.cjs && node test/test-client.cjs"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|